[erlang-questions] Patch to inets for correct handling of HTTP's Conditional GET

Ingela Anderton Andin ingela@REDACTED
Mon Aug 20 11:21:35 CEST 2007


Hello, thank you for the patch it will be included in the next release.
It should be fine for the pipelining as the server should not send a 
body together with 304 code.
So the client will after the 304 code, expect the answer to the next 
request in the pipeline.

Regards Ingela -OTP team


Frej Drejhammar wrote:
> Hi,
>
> The http client in inets for R11B-5 does not handle conditional get
> correctly. Doing a http:request/4 with the "If-None-Match" and
> "If-Modified-Since" headers set such that the server gives a 304 "Not
> Modified" reply, the httpc_handler still expects to receive a
> body. This eventually leads to a timeout. The attached bug.erl
> demonstrates the problem by retrieving the slashdot rss-feed.
>
> The included patch seems to fix the problem, although I'm not
> completely sure about its correctness when pipelining is used.
>
> Regards,
>
> Frej Drejhammar
>
> --- otp_src_R11B-5/lib/inets/src/http_client/httpc_handler.erl  2007-06-11 12:25:27.000000000 +0200
> +++ otp_src_R11B-5.orig/lib/inets/src/http_client/httpc_handler.erl   2007-08-19 18:09:16.000000000 +0200
> @@ -489,6 +489,9 @@
>      {NewBody, NewRequest}= stream(Body, State#state.request, Code),
>      handle_response(State#state{body = NewBody, request = NewRequest}).
>  
> +handle_http_body(<<>>, State = #state{status_line = {_,304, _}}) ->
> +    handle_response(State#state{body = <<>>});
> +
>  handle_http_body(<<>>, State = #state{request = #request{method = head}}) ->
>      handle_response(State#state{body = <<>>});
>
>   




More information about the erlang-questions mailing list