INETS-4.5.3 HTTP Client - 100 Continue

Stephen Han kruegger@REDACTED
Sat Sep 24 01:14:04 CEST 2005


Hi.

Some web servers return 100 Continue before 200 Ok without Content-Length.

Host-A -> Host-B
HTTP/1.1 100 Continue..Server: Microsoft-IIS/5.0..Date: Fri, 23 Sep 2005 22
:52:10 GMT..X-Powered-By: ASP.NET....

Host-A -> Host-B
HTTP/1.1 200 OK..Server: Microsoft-IIS/5.0..Date: Fri, 23 Sep 2005 22:52:27
GMT..X-Powered-By: ASP.NET..X-AspNet-Version: 1.1.4322..Cache-Control: pri
vate, max-age=0..Content-Type: text/xml; charset=utf-8..Content-Length: 199
94........ <omitted>

After running the debugger on httpc_handler.erl, I found out that HTTP
Client libary captures the length of the content from the first message and
uses it all the way. Since real content length was exists in next message,
200 OK, the http:request eventaully failed because it thinks the length is
0.

I just add another "handle_http_msg/2" function to "httpc_handler" module to
ignore first 100 Conitnue message.

handle_http_msg({_, 100, _, _, _}, State = #state{session = Session}) ->
http_transport:setopts(socket_type(Session#tcp_session.scheme),
Session#tcp_session.socket, [{active, once}]),
{noreply, State#state{mfa = {httpc_response, parse,
[State#state.max_header_size]}}};

This is just a quick fix for my work, and still I am not sure whose
behaviour is right or wrong.
I do see some original code to ignore 100 Continue message in the code but I
don't know in what situation reaches that point.

regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050923/30239fc0/attachment.htm>


More information about the erlang-questions mailing list