I've started some work on fixing CURLOPT_RESOLVE. I have fixed it so that 
multiple addresses can be stored for each host:port. You can see a branch 
comparison at [1]. I'm exploring the removal of cache entries now. Currently it 
is documented that an entry can be removed by -host:port but it is not 
implemented [2][3]. I can't see an easy way to do it. If a Curl_dns_entry has 
an inuse count and that count is 1 it seems to me there's really no way to tell 
if that's because it's a user initiated entry (ie CURLOPT_RESOLVE incremented 
inuse so the cache entry is always in use) or because it's actually in use.
I'm thinking I'll add a member to Curl_dns_entry struct like user_specified so 
that we can distinguish exactly how the entry originated rather than rely on 
inuse. Let's say this happens, then:- Should a dns entry be removed only if 
user_specified, for example if !user_specified then maybe the caller is trying 
to use -host:port to clear the DNS records retrieved by the resolver?- If inuse 
(and we know it's actually in use now) then the entry cannot be deleted, so it 
has to be pending for delete. What would be the best way to handle that? Say 
caller has this list:    host = curl_slist_append(NULL, "-google.com:80");
    host = curl_slist_append(host, "google.com:80:167.206.145.177");
    host = curl_slist_append(host, "google.com:80:167.206.145.178");We can mark 
pending for delete somewhere (where?), then it would be pruned, but what to do 
about those next two entries? I was thinking maybe a swap space as another 
member of Curl_dns_entry like 
  Curl_addrinfo *addr, *swap;then swap during a prune or something. Just my 
thoughts so far, interested to get feedback.
Two more questions:- Shouldn't timeout be -1 for resolve entries?
- In the addrinfo comparison function I added I'm not comparing sin6_scope_id 
for IPv6, should I?

[1]: 
https://github.com/bagder/curl/compare/master...jay:fix-curlopt_resolve?expand=1
[2]: http://curl.haxx.se/libcurl/c/CURLOPT_RESOLVE.html
[3]: https://github.com/bagder/curl/blob/17abfd5/lib/hostip.c#L800-L802
 
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to