cURL / Mailing Lists / curl-library / Single Mail


Re: [curl 4/5] dns: Support binding DNS to local interface/IP

From: Ben Greear <>
Date: Thu, 26 Aug 2010 21:41:27 -0700

On 08/26/2010 02:19 PM, Daniel Stenberg wrote:
> On Wed, 25 Aug 2010, Ben Greear wrote:
>> I wanted to follow up to see where this stands. I know I still need docs, but I want to make sure you are happy with the API before I write docs for it....
> Sorry for my slowness, I have like 50 mails marked by now to get back on and one of them is this subject! Thanks a lot for your work and your patience.
> I still think three options for setting a single source address is a bit strange. What if the user sets two of them? We need to document the prio order or
> possibly it should just override the previous value if the users sets a new. The differences between source address for DNS requests and the regular connections
> make the API a bit unexpected.
> But these are not strong opinions. If you think this is the better API for these things then I won't stand in the way. Bring it on!

My personal opinion is that a larger but simpler libcurl library is nice
because it means we don't have to do tricky string parsing in libcurl code.
Parsing adds areas for bugs and a bit of code bloat.

Let calling code deal with it..maybe the tokens are already separated in
calling code logic so there is no parsing to be done anyway.

I also think it's useful to be able to bind DNS and requests to different
networks. Most people won't care or need to do this, but there is very little
cost to support it, and it gives some flexibility for folks on interesting
multi-homed machines.

As for the ordering: They are independent.

You can bind to a device or bind to an IP, or you could bind to
both. Each has their advantages and subtle differences in
possible behaviour.

As for the current ability for curl to bind to a specific IP OR device,
we either need to add ability to parse something like IP_at_device, or add
another API that is specifically bind-to-device (and leave the old behaviour
as is). As I dislike parsing in c code, my preference is for a new API
and I'll be happy to provide a patch.

All this said, another option is to pass in IP_at_device tokens to a smaller
set of curl API options and have curl do the parsing. It's not my preferred
method, but I don't feel strongly about it, and I'll write up the patches
if you want it done that way.


Ben Greear <>
Candela Technologies Inc
List admin:
Received on 2010-08-27