cURL / Mailing Lists / curl-library / Single Mail


Re: Connecting to multiple hosts that have the same hostname

From: Daniel Stenberg <>
Date: Tue, 2 Jun 2015 15:54:24 +0200 (CEST)

On Tue, 2 Jun 2015, Michael Kaufmann wrote:

> A callback function for the name resolution would be a powerful mechanism.
> Similar to CURLOPT_OPENSOCKETFUNCTION, but a bit on a "higher level". This
> new callback function should be able to either return an address, or to tell
> libcurl to proceed with the normal name resolution.

Sounds reasonable!

> I still think that libcurl's connection cache should also look at the
> addresses when reusing connections. This is useful for CURLOPT_RESOLVE (it's
> possible to add and remove "name to address" mappings), and it would also be
> useful for the callback function proposed above.

I wouldn't mind supporting that.

The primary reason it doesn't do it already is that it adds latency to the
transfer. You then cannot just re-use a connection simply based on the name
but it will instead have to wait for the name resolve response before it knows
how to proceed.

Of course, doing a name resolve first could then also make libcurl do
connection re-use for name based virtual servers on the same IP which it
currently doesn't do.

Such a modified behavior would need to be enabled with a new option.

List admin:
Received on 2015-06-02