cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: reusing connection on http2

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 15 Aug 2015 23:13:56 +0200 (CEST)

On Sat, 15 Aug 2015, Inca R wrote:

> What I notice in my tests is that all requests to the same host reuse the
> same connection or http2 stream, but curl ( or nghttp2 ) opens differnt
> connections, to the same IP, if the host is differnt. *host is the fqdn dnas
> name that resolves to the same IP
>
> This behavior is actually not good and I miss all the multiplexing and
> header compression benefits from http2.
>
> This is correct ? Am I missing something ( configuration, etc )

Yes, that's how libcurl works currently. It only re-uses connections to the
exact same host name and the IP address is never even considered then. In
fact, the decision to re-use a connection instead of creating a new one is
made before DNS resolving is even considered so it doesn't know the IP address
of the given host name.

But yes, to get better use of http2 it would be better if libcurl would be
better at figuring out which connections to different host names that still
could re-use the same connection (and then not only IPs need to match, when
talking TLS we also need to make sure the certificate allows for the host name
of that connection). This is something I'd like us to improve on and I welcome
patches and even just thoughts and ideas around how such a concept would work
with libcurl.

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