curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Retrieve all addresses mapped to specific host, not just one IP

From: myLC--- via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 13 Aug 2018 16:29:54 +0200

On 08/13/2018 12:24 PM, Daniel Stenberg wrote:
> ...
> Sure, I'm not totally against a callback. But we'd still have to convert
> the representation to something that we think we can stick to for the
> foreseeable future even if the internals would change...

I do not really care what the structure looks like. I simply predict, that the entire
caboose will be converted twice in most cases.
With a callback you'd make sure that the user takes care of it when the data
becomes available in that format - and only then.
The addrinfo structure is well documented (spares you the hassle of writing it up
yourself;-). If you name the constant/callback after this structure, you can have a
new one if the internal structure changes. Then the old addrinfo export would do
the copying and be marked as depreciated (you'd then delete the created structures
after the callback returns).

I simply look at it from a performance angle. Who needs all addresses? This is the
exception. It's likely that programs dealing with lots of entries will use this. They
will probably use their own format as they will store other information, and they
might not need all the data/addresses from your structures.

What you suggest surely sounds 'cleaner'. Nonetheless, you'll get the 'copy and
convert the whole list twice for every lookup' almost guarantied. That is, your
conversion will be discarded immediately afterwards, just to become something
new entirely.

I guess it depends on personal preference to determine, which of those solutions
do hurt more. :-)

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-08-13