curl / Mailing Lists / curl-library / Single Mail


RE: Supporting HTTP/2 PINGs

From: Daniel Stenberg <>
Date: Wed, 7 Jun 2017 10:01:21 +0200 (CEST)

On Thu, 1 Jun 2017, Max Dymond wrote:

> I'm now thinking about the "sending HTTP/2 PINGs" part of this code. My
> sketch design for this is as follows:
> * Add a new top level API for curl_easy and curl_multi which does the "null
> transfer" mode above. Named appropriately for something which doesn't do a
> transfer, but checks to make sure things on that handle are still ok.
> (curl_easy_housekeeping?).

So this is an API that allows an application to keep the connections alive
without doing an active transfer? Maybe you could jot down a brief description
on how you envision this API to be used by an application?

Isn't it a better focus to first make those idle connections get monitored
while other transfers are ongoing, so that existing applications simply will
get their h2 connections kept alive better without any modification?

Getting a new API used by applications is a very very long tail.

> * Make that function iterate over the connections in its connection cache,
> and build on the code in my other fix
> ( to perform a "KEEPALIVE" check on
> those protocols with connection check callbacks. It could also clean up dead
> connections as well?

I think it should close dead connections too, yes. It'd cleanup the connection
cache sooner which I think is good. It would also make sense to consider
support for another old request: a dedicated timeout for connections in the
cache. The longest time a connection is accepted there until it gets forcibly
closed and removed. In real life, connection re-use is only really happening
successfully if done within N seconds from the previous use, where N most
certainly is way smaller than say 120.

> One question would be whether to make the HTTP/2 PING keepalive timeout
> configurable - if so, we'd have to store that using a CURLOPT/CURLMOPT.

If the ping time is per connection (which I think seems fair), then I'd say
that option belongs in the easy handle. Thus CURLOPT.

Received on 2017-06-07