mirror of
https://github.com/curl/curl.git
synced 2026-08-25 13:23:33 +03:00
urlapi: preserve empty markers in relative URLs
Verified in test 1560 Closes #22298
This commit is contained in:
parent
4dc236a109
commit
c221469032
2 changed files with 21 additions and 11 deletions
|
|
@ -1629,19 +1629,26 @@ static const struct redircase set_url_list[] = {
|
|||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"#",
|
||||
"http://example.org/foo/bar",
|
||||
/* This happens because the parser removes empty fragments */
|
||||
"http://example.org/foo/bar#",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"?",
|
||||
"http://example.org/foo/bar",
|
||||
/* This happens because the parser removes empty queries */
|
||||
"http://example.org/foo/bar?",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"?#",
|
||||
"http://example.org/foo/bar",
|
||||
/* This happens because the parser removes empty queries and fragments */
|
||||
"http://example.org/foo/bar?#",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://host/path?", "#new",
|
||||
"http://host/path?#new", 0, 0, CURLUE_OK},
|
||||
{"http://host/path?#", "#new",
|
||||
"http://host/path?#new", 0, 0, CURLUE_OK},
|
||||
{"http://host/path#", "?new",
|
||||
"http://host/path?new", 0, 0, CURLUE_OK},
|
||||
{"http://host/path?#", "?new",
|
||||
"http://host/path?new", 0, 0, CURLUE_OK},
|
||||
{"http://host/path?#", "sub",
|
||||
"http://host/sub", 0, 0, CURLUE_OK},
|
||||
{"http://example.com/please/../gimme/%TESTNUMBER?foobar#hello",
|
||||
"http://example.net/there/it/is/../../tes t case=/%TESTNUMBER0002? yes no",
|
||||
"http://example.net/there/tes%20t%20case=/%TESTNUMBER0002?+yes+no",
|
||||
|
|
@ -1716,7 +1723,7 @@ static int set_url(void)
|
|||
}
|
||||
else {
|
||||
char *url = NULL;
|
||||
rc = curl_url_get(urlp, CURLUPART_URL, &url, 0);
|
||||
rc = curl_url_get(urlp, CURLUPART_URL, &url, CURLU_GET_EMPTY);
|
||||
if(rc) {
|
||||
curl_mfprintf(stderr, "%s:%d Get URL returned %d (%s)\n",
|
||||
__FILE__, __LINE__, (int)rc, curl_url_strerror(rc));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue