[erlang-questions] making http client close connections

Oscar Hellström oscar@REDACTED
Tue Jun 9 22:20:20 CEST 2009


Hi Joel,

In general I would say that you don't want lhttpc, inets or ibrowse. The way you're describing things you'd like to write a specific HTTP client. Actually, it could probably be extremely simple if it's created to suite your needs.

Comments inline...

----- "Joel Reymont" <joelr1@REDACTED> wrote:

> On Jun 9, 2009, at 6:59 PM, Roberto Ostinelli wrote:
> 
> > have you considered trying the Lightweight HTTP client, released  
> > today by
> > erlang consulting (avail here:
> > http://forum.trapexit.org/viewtopic.php?p=44654)?
> 
> 
> Can it limit the number of outgoing connections to just 1?

Not at the moment, but this isn't very hard to implement. I'm thinking of a second gen_server (or similar) that keeps a count of how many connections to each host, and will just wait with replying if there aren't any "free connections". The socket manager could also do this, but I'm afraid to overload the process.

> What about closing a connection on demand?

No, reading the request headers isn't implemented. It's however trivial to implement (remove the checking for the close token in read_length/4 and add a function maybe_close_socket(ReqHdrs, RspHdr, Socket, Resp read_response/7).

> Can I differentiate between connections started by many processes and close individual ones?

How would you like to identify them? You could maybe hack the manager?
 
> 	Thanks, Joel
> 
> ---
> Mac hacker with a performance bent
> http://www.linkedin.com/in/joelreymont
> 
> 
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org

Cheers
-- 
Oscar Hellström, oscar@REDACTED
Phone:  +44 (0)798 45 44 773
Mobile: +44 (0)207 65 50 337
Web:    http://www.erlang-consulting.com



More information about the erlang-questions mailing list