cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: persistent connections in multi interface

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 11 Aug 2011 16:21:28 +0200 (CEST)

On Thu, 11 Aug 2011, Yamin Zhou wrote:

> I create a multi handle, and set its MAXCONNECTIONS as 20. When a POST
> request comes, I create a easy handle for that request and add it in the
> multi handle. I explicitly add "Connection: keep-alive" HTTP header

There's no need to do that. HTTP/1.1 has them persistent by default.

> When the transfer is finished, I call curl_easy_cleanup to free the easy
> handle. But I see the connection is closed immediately by libcurl. Shouldn't
> it be cached?

Yes, if there's room for the connection in the cache and nothing in the
connection/transfer made it not possible.

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