How do I activate timeout in HttpClient* protocols?

7 views
Skip to first unread message

Levent

unread,
Nov 5, 2009, 9:58:24 AM11/5/09
to EventMachine
If the server is does not respond with the following code
> conn = EM::Protocols::HttpClient2.connect webserver, 80
> req = conn.get(url)
the req.callback is not called back and the connection is stuck.
I tried EM.addtimer(5)(conn.close_connection), but that doesn't seem
to invoke unbind or req.callback.
The documentation does not suggest any obvious handling of this
situation.
Any advice is appreciated.

Aman Gupta

unread,
Nov 6, 2009, 5:06:46 PM11/6/09
to eventm...@googlegroups.com
I would recommend using http://github.com/igrigorik/em-http-request,
which is far more robust and also allows setting a connect timeout.

Aman
Reply all
Reply to author
Forward
0 new messages