martes, 17 de septiembre de 2013

url-retrieve can't find localhost

Today I found a surprising bug in emacs url package. In fact, I'm not sure where the bug is.

The bug appears when trying to url-retrieve an url on localhost, like:
 
 
(url-retrieve "http://localhost:7070/api/services" 
  (lambda (s) (switch-to-buffer (current-buffer))))

The funny thing is that changing localhost to 127.0.0.1 works. Even adding a line "127.0.0.1 foobar" in my /etc/hosts also fixed it.

No clue why is that,but anyway,  it seems to be fixed in some development branch so I'm going to recompile my 24.3.50.1 to the latest one and see what happens.

1 comentario:

Ahmed Aldebrn Fasih dijo...

I ran across this recently too: see http://www.markhneedham.com/blog/2012/07/15/netcat-localhost-resolution-not-working-when-sending-udp-packets/ for an explanation. localhost might be getting resolved to an ipv6 address.