curl-library
Re: Patch: OpenSSL Server Name Indication value should match custom Host header
Date: Sat, 6 Nov 2010 08:45:50 +0100 (CET)
On Fri, 5 Nov 2010, Dan Fandrich wrote:
>> $ ./src/curl --resolve www.haxx.se:80:127.0.0.1 www.haxx.se -v
>
> What's the purpose of resolving based on port number as well as IP address?
My initial intent was not to use the port number like that. I did it
because...
"Everything" internally within libcurl uses the getaddrinfo concept, either
directly if the platform provides it or by a wrappr layer on top of the native
resolver functions.
getaddrinfo() has a port number in the resolve call (a bit deceivingly called
"service"), and it produces a result (linked list of addresses) that includes
the port number. Everything in that concept is wide open to allow systems to
resolve host+portA differently than host+portB. Since the port is in the
results we already cache name resolves associated with a unique host+port
pair. Changing that would require an effort.
First I did a special approach that would store this custom resolve as port 0
and if the host+port lookup in the cache failed, it would check host+port0 but
we still would have to fix the fact that the address structs have the port
number embedded which I decided to not do this time.
I decided that perhaps we can rather see it as an added bonus feature: now we
can provide a "fake" resolve for a specific port while other ports will
continue using the ordinary resolved address.
Of course all this is subject to discussion and change if we desire to.
> This use/abuse of the DNS cache does look like a fairly clean way of
> accomplishing this, though.
Yes I think so. The trickier part will be to remove entries nicely.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-11-06