[erlang-bugs] http client parse (noncompliant) status-line

Paul Mineiro <>
Mon Sep 3 22:56:35 CEST 2007


Dear maintainers,

----------
% erl
Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0]
[kernel-poll:false]

Eshell V5.5.5  (abort with ^G)
1> http:request ("http://g-shock.trend-now.net/").

=INFO REPORT==== 3-Sep-2007::13:45:22 ===
The inets application was not started. Has now been started as a temporary
application.
{error,{badarg,[{erlang,list_to_integer,["302\r\nDate:"]},
                {httpc_response,parse_status_code,4},
                {httpc_handler,handle_info,2},
                {gen_server,handle_msg,6},
                {proc_lib,init_p,5}]}}
----------

The response clearly violates the rfc
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1) since
the response phrase is missing:

----------
% printf "GET / HTTP/1.1\r\nHost: g-shock.trend-now.net\r\nConnection: close\r\n\r\n" | nc g-shock.trend-now.net 80 | head -1 | hexdump -c
0000000   H   T   T   P   /   1   .   1       3   0   2  \r  \n
000000e
----------

and yet the server claims to be apache 2.0:

----------
% telnet g-shock.trend-now.net 80
~
Trying 208.113.213.164...
Connected to g-shock.trend-now.net.
Escape character is '^]'.
GET / HTTP/1.1
Host: g-shock.trend-now.net
Connection: close

HTTP/1.1 302
Date: Mon, 03 Sep 2007 20:48:38 GMT
Server: Apache/2.0.54 (Unix) PHP/4.4.7 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2
X-Powered-By: PHP/5.2.2
Location: http://g-shock.brand-items.com/
Vary: Accept-Encoding
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

Connection closed by foreign host.
----------

Anyway IMHO I think it would be good to be more robust in the parsing of
the response status-line.

Thanks,

-- p





More information about the erlang-bugs mailing list