Subject: bug#17976: 24.3; url-retrieve-synchronously doesn't fallback to IPv4

From: Juliusz Chroboczek <[email-masked]>
Date: Wed, 09 Jul 2014 14:38:17 +0200

My machine has both IPv6 and IPv4.  I'm accessing a server that has both
IPv6 and IPv4, but whose web server listens on IPv4 only.  The web server
is doing the right thing, sending RST upon IPv6 connection attempts.  Wget
and telnet do the right thing, they fallback to IPv4:

  $ telnet moule.informatique.univ-paris-diderot.fr 8080
  Trying 2001:660:3301:8070::40...
  Trying 194.254.199.40...
  Connected to moule.informatique.univ-paris-diderot.fr.
  Escape character is '^]'.

On the other hand, url-retrieve-synchronously returns an empty string.
Tcpdump shows that it's never even trying IPv4:

  (with-current-buffer
    (url-retrieve-synchronously
     "http://moule.informatique.univ-paris-diderot.fr:8080")
    (buffer-substring (point-min) (point-max)))
  ""

  (with-current-buffer
    (url-retrieve-synchronously "http://194.254.199.40:8080")
    (buffer-substring (point-min) (point-max)))
  "HTTP/1.1 200 OK
  ..."