Luc, I have seen this kind of weirdness before, but I mostly see it with ab (apache benchmark tool). I really have no idea. Have you tried with telnet to do a manual HTTP request ? $ telnet localhost 1701 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /random HTTP/1.1 Host:localhost:1701 HTTP/1.1 200 OK Content-Type: text/plain;charset=utf-8 Content-Length: 64 Date: Sat, 14 Jun 2014 08:58:48 GMT Server: Zinc HTTP Components 1.0 EF97C091498F3FEA3F79F65D36C40ECAFD116A68BA31F45D027DB61EBDD1579 ^] telnet> close Connection closed. You could also try using the same or a second Pharo image to do the request. $ ./pharo Pharo.image eval "ZnClient new get: 'http://localhost:8080/random'" '766EF4E6E5664EF4C5163D30125B5C35BFE2AED408835CB6D6206DF0A7A15FD ' In any case, the server socket used is normally listening on all interfaces [0.0.0.0] Sven On 14 Jun 2014, at 09:17, Luc Fabresse <luc.fabresse@gmail.com> wrote:
2014-06-14 6:04 GMT+02:00 Ben Coman <btc@openinworld.com>: Luc Fabresse wrote:
Hi,
I experiencing a strange difference between localhost and 127.0.0.1.
In Pharo I do:
(ZnServer startDefaultOn: 4444) onRequestRespond: [ :request | ZnResponse ok: (ZnEntity text: 'hello') ]
In bash:
$ lsof -Pi | grep Pharo Pharo 2718 luc 7u IPv4 0x1e64a2e9381f409b 0t0 TCP *:4444 (LISTEN)
I perfectly listen on port 4444 from all interfaces *
$ curl http://127.0.0.1:4444 hello
$ curl http://localhost:4444 curl: (7) Failed to connect to localhost port 4444: Connection refused <- why ?
localhost is correctly resolved on my mac $ ping localhost PING localhost (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.044 ms
I tested with other programs than Zinc to open listening sockets and it works.
Any idea?
#Luc maybe http://sourceforge.net/p/curl/bugs/1337/
Humm, I use curl 7.36.0, so yes perhaps this bug fix is not integrated...
Anyway, I was also suspecting curl but I tested with server: Apache on port 8888 and here curl works:
httpd 621 luc 5u IPv6 0x6ea19c1d988f10db 0t0 TCP *:8888 <-- same as Zinc
but both:
curl http://127.0.0.1:8888 curl http://localhost:8888
are working.
wget always works (Apache and Zinc):
wget -qO- http://127.0.0.1:8888 wget -qO- http://localhost:8888
Thanks Max and Ben,
Luc