curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to Set Keep Alive Option in CURL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 4 Jan 2017 17:33:31 +0100 (CET)

On Wed, 4 Jan 2017, Praveen Pvs wrote:

> if we use keep alive options also host could still close the connection
> which is happening in my case.

Absolutely. No keep alive options will help much in your case.

> Adding to the question on top of this: In this link
> https://tools.ietf.org/id/draft-thomson-hybi-http-timeout-01.html#rfc.section.2

That's a draft for a header specification that never went into the HTTP spec.
Read RFC 7230 for understanding how HTTP 1.1 works.

> Below is the header generated by curl after enabling keep-alive. Why am I
> not seeing connection type and keepalive timeout in the headers ?

Because HTTP 1.1 has no such headers. Persistent connections are by default
and connections will be kept alive by the server for a while after use, but it
isn't normally advertised by the server. Clients and browsers also tend to
keep connections alive for N seconds after use.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2017-01-04