hostip: make CURLOPT_RESOLVE support replacing IPv6 addresses

This also applies to --resolve of course.

Applied strparse functions on the function.

Fixes #16357
Reported-by: rmg-x on github
Closes #16358
Assisted-by: Jay Satiro
This commit is contained in:
Daniel Stenberg 2025-02-17 08:33:52 +01:00
parent 61f85bf967
commit 2f4dc6525c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 84 additions and 74 deletions

View file

@ -73,6 +73,8 @@ resolves, include a string in the linked list that uses the format
The entry to remove must be prefixed with a dash, and the hostname and port
number must exactly match what was added previously.
Provide IPv6 addresses within [brackets].
Using this option multiple times makes the last set list override the previous
ones. Set it to NULL to disable its use again.
@ -90,6 +92,7 @@ int main(void)
CURL *curl;
struct curl_slist *host = NULL;
host = curl_slist_append(NULL, "example.com:443:127.0.0.1");
host = curl_slist_append(host, "example.com:443:[2001:db8::252f:efd6]");
curl = curl_easy_init();
if(curl) {
@ -117,6 +120,8 @@ Support for providing multiple IP addresses per entry was added in 7.59.0.
Support for adding non-permanent entries by using the "+" prefix was added in
7.75.0.
Support for specifying the host component as an IPv6 address was added in 8.13.0.
# %AVAILABILITY%
# RETURN VALUE