[Fwd: http client hell]

Ingela Anderton <>
Tue Dec 14 09:32:08 CET 2004


blaguehubert wrote:
> I'm a little bored, not by Ingela Anderton, but by the fact that I did 
> not have time to wait for the next release and this mean that I will 
> have to write my own http client (arg!!!).
You could put in the fix yourself while waiting for the new release,
as that particular bug is quite easy to fix.

In httpc_handler.erl change the following 
---------------------------------------
   "chunked" ->
            {ok, {ChunkedHeaders, NewBody}} =
                case http_chunk:decode(Body, State#state.max_body_size, 
                                       State#state.max_header_size) of
                    {Module, Function, Args} ->
                        http_transport:setopts(Session#tcp_session.scheme, 
					       Session#tcp_session.socket, 
					       [{active, once}]),
                        {noreply, State#state{mfa = 
					      {Module, Function, Args}}};
                    Decoded ->
                        Decoded
                end,
            NewHeaders = http_chunk:handle_headers(Headers, ChunkedHeaders),
            handle_response(State#state{headers = NewHeaders, 
					body = NewBody});

---------------
to:
    "chunked" ->
	    case http_chunk:decode(Body, State#state.max_body_size, 
				   State#state.max_header_size) of
		{Module, Function, Args} ->
		    http_transport:setopts(Session#tcp_session.scheme, 
					   Session#tcp_session.socket, 
					   [{active, once}]),
		    {noreply, State#state{mfa = 
					  {Module, Function, Args}}};
		{ok, {ChunkedHeaders, NewBody}} ->
		    NewHeaders = http_chunk:handle_headers(Headers, 
							   ChunkedHeaders),
		    handle_response(State#state{headers = NewHeaders, 
						body = NewBody})
	    end;

-------------------

Of course there where other things fixed for 4.0.1 so I can not
guarantee that it will work flawlessly but it might be worth a shot!

-- 
/Ingela

Ericsson AB - OTP team








More information about the erlang-questions mailing list