http client pipeline

Wilson Tam wilson.sh.tam@REDACTED
Wed Jun 15 10:34:50 CEST 2005


Thanks Ingela. Now it works perfect!. Sweet!


On 15 Jun 2005, at 4:03 PM, Ingela Anderton wrote:

>
> Humm ...
>
> The last line of the following code was also changed in the same file.
>
> handle_call(Request, _, State = #state{session = Session =
>                        #tcp_session{socket = Socket},
>                        timers = Timers,
>                        options = Options}) ->
>     Address = handle_proxy(Request#request.address,  
> Options#options.proxy),
>     case httpc_request:send(Address, Request, Socket) of
>         ok ->
>         %% Activate the request time out for the new request
>         NewState = activate_request_timeout(State#state{request =
>                                  Request}),
>
> Before it said:
>  NewState = activate_request_timeout(State),
>
> which is wrong!
>
> I am not sure but that could be the problem!
>
> /Ingela
>
>
> Wilson Tam wrote:
>
>> Thanks Ingela.
>>
>
>
>>
>> I patched the file httpc_handler.erl and tried again. It pops some
>> errors on the *second* request. The first one ran ok.  I have also
>> checked the apache log, it seems that it is still trying to make new
>> connection. Any other hints?
>>
>>
>> 56> http:request(get, {"http://192.168.0.207", []}, [], []).
>>
>> =ERROR REPORT==== 15-Jun-2005::15:44:12 ===
>> ** Generic server <0.146.0> terminating
>> ** Last message in was {request,#Ref<0.0.0.685>,
>>                                  <0.71.0>,
>>                                  0,
>>                                  http,
>>                                  {"192.168.0.207",80},
>>                                  "/",
>>                                  [],
>>                                  get,
>>                                  {http_request_h,
>>                                      undefined,
>>                                      "keep-alive",
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      "192.168.0.207",
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      [],
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      "0",
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      undefined,
>>                                      []},
>>                                  {[],[]},
>>                                  {http_options,infinity,true, 
>> [],false},
>>                                  "http://192.168.0.207"}
>> ** When Server state == {state,undefined,
>>                                 {tcp_session,
>>                                     {{"192.168.0.207",80},<0.146.0>},
>>                                     false,
>>                                     http,
>>                                     #Port<0.158>,
>>                                     1},
>>                                 undefined,
>>                                 undefined,
>>                                 undefined,
>>                                 {httpc_response,parse,[nolimit]},
>>                                 {[],[]},
>>                                 pipeline,
>>                                 [],
>>                                 nolimit,
>>                                 nolimit,
>>                                 {options,{undefined,[]},
>> 60000,1,1,disabled},
>>                                 {timers,[],#Ref<0.0.0.678>}}
>> ** Reason for termination ==
>> ** {badarg,[{httpc_handler,activate_request_timeout,1},
>>              {httpc_handler,handle_call,3},
>>              {gen_server,handle_msg,6},
>>              {proc_lib,init_p,5}]}
>> {ok,{{"HTTP/1.1",200,"OK"},
>>       [{"connection","Keep-Alive"},
>>        {"date","Wed, 15 Jun 2005 07:44:15 GMT"},
>>        {"server",
>>         "Apache/1.3.31 (Unix) PHP/4.3.10 mod_ssl/2.8.19 OpenSSL/
>> 0.9.7d"},
>>        {"content-length","936"},
>>        {"content-type","text/html"},
>>        {"x-powered-by","PHP/4.3.10"},
>>        {"keep-alive","timeout=15, max=100"}],....
>>
>>
>>
>>
>>
>>> Change the function is_keep_alive_connection/2 in httc_handler.erl
>>> to look like this:
>>>
>>> is_keep_alive_connection(Headers, Session) ->
>>>     (not ((Session#tcp_session.client_close) or
>>>       httpc_response:is_server_closing(Headers))).
>>>
>>>
>>> In inets 4.0.1 the pipelining mechanism was a bit to optimistic
>>> alas in the process of making it more realistic it became broken!
>>> Hence some enchantments of the test suite will be needed as this
>>> little bug was missed.
>>>
>>> -- 
>>>
>
>
>
>




More information about the erlang-questions mailing list