dns: extend CURLOPT_RESOLVE syntax for adding non-permanent entries

Extend the syntax of CURLOPT_RESOLVE strings: allow using a '+' prefix
(similar to the existing '-' prefix for removing entries) to add
DNS cache entries that will time out just like entries that are added
by libcurl itself.

Append " (non-permanent)" to info log message in case a non-permanent
entry is added.

Adjust relevant comments to reflect the new behavior.

Adjust documentation.

Extend unit1607 to test the new functionality.

Closes #6294
This commit is contained in:
Paul Groke 2020-12-10 17:38:14 +01:00 committed by Daniel Stenberg
parent 68dde8e330
commit 8324dc8b1a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 82 additions and 40 deletions

View file

@ -1460,13 +1460,16 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
break;
case CURLOPT_RESOLVE:
/*
* List of NAME:[address] names to populate the DNS cache with
* Prefix the NAME with dash (-) to _remove_ the name from the cache.
*
* Names added with this API will remain in the cache until explicitly
* List of HOST:PORT:[addresses] strings to populate the DNS cache with
* Entries added this way will remain in the cache until explicitly
* removed or the handle is cleaned up.
*
* This API can remove any name from the DNS cache, but only entries
* Prefix the HOST with plus sign (+) to have the entry expire just like
* automatically added entries.
*
* Prefix the HOST with dash (-) to _remove_ the entry from the cache.
*
* This API can remove any entry from the DNS cache, but only entries
* that aren't actually in use right now will be pruned immediately.
*/
data->set.resolve = va_arg(param, struct curl_slist *);