cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: PATCH: Do not allow multi interface to block trying to perform DNS on interface names

From: Jason Glasgow <jglasgow_at_google.com>
Date: Fri, 4 Nov 2011 16:08:19 -0400

On Fri, Nov 4, 2011 at 2:13 AM, Dan Fandrich <dan_at_coneharvesters.com> wrote:
>
> On Thu, Nov 03, 2011 at 11:10:43PM -0400, Jason Glasgow wrote:
> > The following patch fixes a bug in which calling the multi-interfaces will
> > block.  The multi-interfaces should never block, but if you supply an interface
> > name as an INTERFACE option and the interface disappears between when you
> > created the request and when it starts executing, the code will erroneously
> > treat the interface/device name as a name to look up via DNS.  It then
> > potentially calls  Curl_resolver_wait_resolv(), which will block.
>
> Another approach would be to look for a magic prefix on the interface name
> and use that to specify the argument type. That also solves a related
> (but likely less common) problem of how to force use of a domain name that
> matches the name of an interface. e.g. "if!ppp0" would mean to use the
> interface named ppp0 and not the domain name ppp0, while
> "ip!ppp0" would mean to use the domain name ppp0 and not the interface ppp0.
> Plain "ppp0" would operate as it does now, searching for an interface with
> that name and trying to resolve it if no interface of that name is found.
> This could also allow specifying the type of binding to use, e.g. "ip6!host"
> would mean to bind to the IPv6 address returned by the DNS lookup on host.
>
> This simplifies implementation as well, since existing mechanisms for
> specifying an interface can be used instead of requiring applications to use
> and support one (or more) new setopt option(s).
>
> >>> Dan

I think it would be clearer to just have two different options.

- CURLOPT_INTERFACE which would only refer to an interface name
- CURLOPT_HOSTNAME which would only refer to a hostname and *might*
cause a DNS lookup

I do admit that this would require rework of some clients -- but I
think this is reasonable because the two are distinct arguments, and
clients may have to be rewritten anyway if they want to add the if! or
host! prefix.

Thoughts?
-Jason

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-11-04