[erlang-questions] http:request/5 returns econnrefused for localhost

Edwin Fine erlang-questions_efine@REDACTED
Tue Jun 24 03:08:57 CEST 2008


I have a really bizarre situation here.

I have code using http:request that used to work, apparently until I
installed R12B-3 (or did something stupid to break something somewhere). Now
I get this bizarre situation where it will work with a URL containing a
numeric IP, but not "localhost". Whenever I use localhost, I get
{error,econnrefused}, but if I use 0.0.0.0 or 127.0.0.1 it works. It always
used to work with localhost. I even replaced localhost in /etc/hosts with
0.0.0.0 instead of 127.0.0.1 but to no avail. If I post to localhost via
browser it works fine, it's only http:request that is giving problems. I can
ping localhost no problem.

I'm using Yaws 1.75 on Ubuntu 8.04 (Hardy Heron) x86_64 and Erlang OTP
R12B-3. Yaws is running in embedded mode on port 8888 of {0,0,0,0}.

Can anyone suggest what might have gone wrong?

(xhg_test@REDACTED)13>
http:request(post,{"http://localhost:8888/deliver/002",[],"text/xml;
charset='utf-8'","<Msg/>"}, [], [], 'XHG').
{error,econnrefused}
(xhg_test@REDACTED)14>
http:request(post,{"http://127.0.0.1:8888/deliver/002",[],"text/xml;
charset='utf-8'","<Msg/>"}, [], [], 'XHG').
{ok,{{"HTTP/1.1",200,"OK"},
     [{"date","Tue, 24 Jun 2008 00:58:58 GMT"},
      {"server","Yaws/1.75 Yet Another Web Server"},
      {"content-length","22"},
      {"content-type","text/xml"}],
     "<Response status='0'/>"}}
(xhg_test@REDACTED)15>
http:request(post,{"http://0.0.0.0:8888/deliver/002",[],"text/xml;
charset='utf-8'","<Msg/>"}, [], [], 'XHG').
{ok,{{"HTTP/1.1",200,"OK"},
     [{"date","Tue, 24 Jun 2008 00:59:16 GMT"},
      {"server","Yaws/1.75 Yet Another Web Server"},
      {"content-length","22"},
      {"content-type","text/xml"}],
     "<Response status='0'/>"}}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080623/88e042e2/attachment.htm>


More information about the erlang-questions mailing list