cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: make only connect, but not issue GET request

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 15 Mar 2011 18:50:07 +0100 (CET)

On Tue, 15 Mar 2011, Pankaj Takawale wrote:

Please stop the top-posting.

> I'm polling web server using curl. Network trace shows me that - web server
> breaks the connection on prev hit after sending response. When I try to make
> next request, curl_easy_perform detects broken connection, re-connects and
> make transfer. Re-connection is expensive over here - around 300ms (TCP
> connection + SSL handshake).
>
> I would like to detect broken connection and re-connect only (NO transfer)
> well before I make next request. This would mostly save re-connection time
> at the time of next request. Do you see any work-around to achieve same
> effect?

I can see how it could possibly help your case, but libcurl doesn't support
just getting the connection up and put into the connection cache for
(possible) later use. Of course you could achieve almost that by doing just a
HEAD request on the site to get the connection back.

Also, putting back the connection like that would only be a work-around that
lowers the average re-connect time, it won't fix the worst case since you
could still experience that the connection gets dropped immediately before you
want to use the connection.

I would suggest that you make sure to use a modern libcurl version and that
you re-use the handle so that you get SSL session-id caching that will
minimize the re-connect time needed.

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