Re: [ curl-Bugs-1358860 ] libcurl not closing sockets
Date: Mon, 21 Nov 2005 14:06:51 +0100 (CET)
On Fri, 18 Nov 2005, SourceForge.net wrote:
(Taking this discussion to the libcurl list instead of in bug repot 1358860.)
> Okay, I think I understand. Could you humour me and reply correct or
> incorrect to the following points. Sorry if the questions appear daft but
> I'm trying to find out how libcurl works. If the questions are answered on
> your web site send me the url :">
> 1) libcurl only supervises sockets between a request and its response.
libcurl reads, writes and "supervises" the sockets during the whole operation:
the request and the subsequent response.
If the server keeps the connection open, so will libcurl to be able to re-use
the connection if the application decides to do so.
When libcurl has completed a transfer and leaves the connection open, there is
no "supervision" of any sockets as libcurl has no magic threads or any another
means of doing that.
When you then later on call curl_easy_perform() again with a URL that is fit
for connection re-use it checks if the connection previously left alive is
still alive and if so it re-uses it.
> 2) if the server closes a socket because it has been idle for X amount of
> time, libcurl will not be supervising the socket, hence not detect the
Correct. It won't detect that until you try to re-use that connection again.
> 3) to make libcurl supervise the socket during this time (i.e. after
> receiving the request) would be a fundamental change to the way libcurl is
> currently designed. Perhaps even introducing a performance hit.
Yes. It would require a separate thread or similar that would detect when the
peer closes the connection.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2005-11-21