[erlang-questions] inets HTTP client does not persist connections when POSTing

Edwin Fine erlang-questions_efine@REDACTED
Tue Aug 5 17:04:25 CEST 2008


Chandru,

Thanks, that absolutely did the trick! I used the first version; that's all
I need.

Regards,
Edwin

On Tue, Aug 5, 2008 at 10:30 AM, Chandru <
chandrashekhar.mullaparthi@REDACTED> wrote:

> Hi Edwin,
>
> ibrowse by default tries to open a new connection if it is within the limit
> of the number of connections it is allowed. By default it is 10. It starts
> pipelining only after all connections in that pool are busy.
>
> If you want to use the same connection, there are two ways, set the
> max_sessions parameter in your request to 1. For example:
>
> ibrowse:send_req("http://localhost:7796/cgi-bin/erl/ebdc_web/country", [],
> post, [], [{max_sessions, 1}]).
>
> Or, you can do the following.
>
> {ok, Pid} = ibrowse:spawn_worker_process("localhost", 7796).
> ibrowse:send_req_direct(Pid, "
> http://localhost:7796/cgi-bin/erl/ebdc_web/country", [], post, [], []).
>
> The first option is if you don't care which connection it goes over. The
> second version is if you want fine grained control on which requests go on
> which connection. I hope this helps.
>
> cheers
> Chandru
>
> 2008/8/4 Edwin Fine <erlang-questions_efine@REDACTED>
>
>> Hi Chandru,
>>
>> Thanks for the tip. I am in fact aware of ibrowse. I tried a version of it
>> from Jungerl and it seemed to be doing the same thing. Maybe I have an old
>> version (1.4) or I am not setting something up correctly. To duplicate this
>> behavior, simply repeat the same ibrowse:send from the Erlang shell a few
>> times, while watching the TCP traffic with Ethereal or similar. What I saw
>> is different local ports being used each time even though posting to the
>> same URL each time. I want the same port (i.e. connection) to be kept open
>> and reused to avoid the connect/disconnect overhead. If there's a way to
>> circumvent this, I'd like to know how, please.
>>
>> Regards,
>> Edwin
>>
>>
>> On Mon, Aug 4, 2008 at 12:51 PM, Chandru <
>> chandrashekhar.mullaparthi@REDACTED> wrote:
>>
>>> Hi Edwin,
>>>
>>> 2008/8/4 Edwin Fine <erlang-questions_efine@REDACTED>
>>>
>>>> Thanks, Ingela, I look forward to seeing the modifications. Hopefully
>>>> you can post a patch so I don't have to wait for the next Erlang release.
>>>>
>>>> Regards,
>>>> Edwin
>>>>
>>>
>>> In case you didn't know, there is an alternative HTTP client called
>>> ibrowse. which has a very similar API. You can use that while you wait for a
>>> fix. I believe it doesn't impose any such restriction.
>>>
>>> cheers
>>> Chandru
>>>
>>> PS: I am the author!
>>>
>>
>>
>>
>> --
>> For every expert there is an equal and opposite expert - Arthur C. Clarke
>>
>
>


-- 
For every expert there is an equal and opposite expert - Arthur C. Clarke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080805/ce1d5501/attachment.htm>


More information about the erlang-questions mailing list