]> git.ipfire.org Git - thirdparty/curl.git/commit
urlapi: URL decode percent-encoded host names
authorDaniel Stenberg <daniel@haxx.se>
Fri, 8 Oct 2021 18:12:26 +0000 (20:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 11 Oct 2021 15:04:14 +0000 (17:04 +0200)
commit9a8564a920188e49d5bd8c1c8573ddef97f6e03a
treeebfc3b77a636822d4d5805553e59c2770d6c3dc2
parentab1671cafefcaf19ff6ac00a6cc7b36dfe16adcd
urlapi: URL decode percent-encoded host names

The host name is stored decoded and can be encoded when used to extract
the full URL. By default when extracting the URL, the host name will not
be URL encoded to work as similar as possible as before. When not URL
encoding the host name, the '%' character will however still be encoded.

Getting the URL with the CURLU_URLENCODE flag set will percent encode
the host name part.

As a bonus, setting the host name part with curl_url_set() no longer
accepts a name that contains space, CR or LF.

Test 1560 has been extended to verify percent encodings.

Reported-by: Noam Moshe
Reported-by: Sharon Brizinov
Reported-by: Raul Onitza-Klugman
Reported-by: Kirill Efimov
Fixes #7830
Closes #7834
docs/libcurl/curl_url_get.3
lib/urlapi.c
tests/libtest/lib1560.c