cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Patch Submission Agaisnt 7.21.7: Socket options for connection timeouts

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 15 Jul 2011 22:42:09 +0200 (CEST)

On Fri, 15 Jul 2011, David Chappelle wrote:

> libcurl, at least as of version 7.21.7, does not properly implement the
> timeout option. Basically it checks the timeout every time the
> send()/recv() call returns, and abandons the operation if the timeout has
> elapsed. If there is a network partition between the client and the server,
> then the recv() call will block indefinitely and the requested timeout is
> not honoured.

No, that's incorrect. libcurl always sets the socket to non-blocking mode so
instead of blocking it will return EAGAIN.

> The fix is to use the SNDTIMEO and RCVTIMEO socket options to set timeouts
> at the socket layer

Those options only make sense if the socket is used in blocking mode, which
libcurl doesn't.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-07-15