curl / Mailing Lists / curl-library / Single Mail


Re: [PATCH] curl: Support CURLOPT_LOCALADDR to bind to local address.

From: Ben Greear <>
Date: Wed, 31 Jan 2018 07:25:50 -0800

On 01/31/2018 05:24 AM, Christian Hägele wrote:
> Am 09.11.2017, 16:17 Uhr, schrieb <>:
>> This allows a user to bind to both an interface (with CURLOPT_INTERFACE)
>> and a local IP address. In doing so, it allows the user to work-around
>> some serious performance issues on machines with lots of virtual interfaces
>> because curl no longer has to scan all interfaces each time it makes
>> a connection.
> I'm very interested in this feature.
> However, I think you missed one important topic. When you are using
> DNS-Names you cannot know if it resolves to IPv4 or IPv6 or both. So if
> you bind to a local IPv6 and the host only supports IPv4 connection will
> fail. Same is true vice versa.
> The only way I can think of solving this problem is by providing a local
> IPv4 and a local IPv6 at the same time and let Curl choose after
> DNS-Resolution which to use or maybe use both (for Happy-Eyeballs).
> Any comments on this? (Disclaimer: I did not look at the code, only at the
> documentation of the option)

There are already ways to bind to local IPs, my patch is adding a feature to bind
explicitly to an interface. This saves a large amount of time from the current feature,
which tries to figure out if a particular string is a device name or IP address.


> Regards,
> Christian
> -------------------------------------------------------------------
> Unsubscribe:
> Etiquette:

Ben Greear <>
Candela Technologies Inc
Received on 2018-01-31