Erlang/OTP Forums

Author Message

<  Advanced Erlang/OTP  ~  http request hangs

mpquique
Posted: Tue Aug 22, 2006 11:37 am Reply with quote
Joined: 10 Aug 2006 Posts: 4 Location: La Coruña, Spain
Hi,

The command:

http:request(get, {"http://www.google.com", []}, [], []).

BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
a

hangs. First of all I must say that I am not thinking in an inets problem (there's another weird symptom I will explain below), but hopefully some of the HTTP gurus out there, can recognize the problem.

I'm not aware of any proxy (at least there's no proxy in our local network), besides, the rest of applications are working perfectly, including the command:

ibrowse:send_req("http://www.google.com/", [], get).

{ok,"302",
[{"Location","http://www.google.es/"},
{"Cache-Control","private"},
{"Set-Cookie",
"PREF=ID=bc983ecf387ba336:TM=1156239649:LM=1156239649:S=ZSfv8LoQyM8z7sSA; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"},
{"Content-Type","text/html"},
{"Server","GWS/2.1"},
{"Content-Length","218"},
{"Date","Tue, 22 Aug 2006 09:40:49 GMT"}],
"<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<TITLE>302 Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A HREF=\"http://www.google.es/\">here</A>.\r\n</BODY></HTML>\r\n"}

I've been able to reproduce http:request/4 behaviour using a telnet (please note how I'm defining the host header as "host").

$ telnet www.google.com 80
Trying 216.239.59.104...
Connected to www.google.com.
Escape character is '^]'.
GET / HTTP/1.1
host: www.google.com

Hangs, just like http:request/4 does. On the other hand, using a capital H ("Host"), it works.

$ telnet www.google.com 80
Trying 216.239.59.103...
Connected to www.google.com.
Escape character is '^]'.
GET / HTTP/1.1
Host: www.google.com

HTTP/1.1 302 Found
Location: http://www.google.es/
Cache-Control: private
Set-Cookie: PREF=ID=dd5dc6de7a134f4d:TM=1156239349:LM=1156239349:S=QhWNPomUpMfXMEjZ; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com
Content-Type: text/html
Server: GWS/2.1
Content-Length: 218
Date: Tue, 22 Aug 2006 09:35:49 GMT

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.es/">here</A>.
</BODY></HTML>

I found that the ibrowse (Safari and Firefox) use "Host" format also. As far as I could see, inets seems to be the only application that doesn't use capital letters in the headers. Reading the Request Header Fields definitions (rfc2616), Host header is defined as "Host". Is this a must or just notation?

On the other hand, we used to think that we had "normal" Internet access, but a few days ago we realized that we could not access the site "http://www.esdebian.org" from any computer in our office (safari, firefox...all of them hang). Checking from a host outside of this network, we found that the site was alive. Since we didn't ever find problems with any other site, we didn't pay further attention to that, until we found this inets problem.

Note also that issuing the same http:request/4 from that host outside (the same one that accesses www.esdebian.org) it works.

Does anyone see how both facts could be related? or am I missing any inets configuration options (and our carrier is, for some extrange reason, banning debian Smile ? Thanks in advance.

Cheers,

Enrique

_________________
http://www.nomasystems.com
View user's profile Send private message Visit poster's website
Mazen
Posted: Wed Aug 23, 2006 9:57 am Reply with quote
User Joined: 20 Jul 2006 Posts: 164 Location: London
What version are you using?
I tried your examples and they work fine for me...

I tried: HOST, HoST, hOST, HoSt.... they all work Smile
HOWEVER, they return 302 (Moved)

The following in the erlang shell...
http:request(get, {"http://www.google.com", []}, [], []).
returns 200
View user's profile Send private message
francesco
Posted: Wed Aug 23, 2006 10:49 am Reply with quote
User Joined: 07 Jul 2006 Posts: 249 Location: London
My approach would be to turn on a local trace on all the functions using dbg and see where it hangs. A bit raw, but beats io format and should be straight to the point.

Francesco
View user's profile Send private message Visit poster's website

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum