mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:51:53 +03:00
urlapi: fix relative redirects to fragment-only
Using the URL API for a redirect URL when the redirected-to string starts with a hash, ie is only a fragment, the API would produce the wrong final URL. Adjusted test 1560 to test for several new redirect cases. Closes #13394
This commit is contained in:
parent
5fb018494d
commit
c37b694e46
2 changed files with 83 additions and 32 deletions
|
|
@ -1081,6 +1081,54 @@ static CURLUcode updateurl(CURLU *u, const char *cmd, unsigned int setflags)
|
|||
}
|
||||
|
||||
static const struct redircase set_url_list[] = {
|
||||
{"http://example.org/",
|
||||
"../path/././../../moo",
|
||||
"http://example.org/moo",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/",
|
||||
"//example.org/../path/../../",
|
||||
"http://example.org/",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/",
|
||||
"///example.org/../path/../../",
|
||||
"http://example.org/",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
":23",
|
||||
"http://example.org/foo/:23",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"\\x",
|
||||
"http://example.org/foo/\\x",
|
||||
/* WHATWG disagrees */
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"#/",
|
||||
"http://example.org/foo/bar#/",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"?/",
|
||||
"http://example.org/foo/bar?/",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"#;?",
|
||||
"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 fragments */
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"?",
|
||||
"http://example.org/foo/bar",
|
||||
/* This happens because the parser removes empty queries */
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo/bar",
|
||||
"?#",
|
||||
"http://example.org/foo/bar",
|
||||
/* This happens because the parser removes empty queries and fragments */
|
||||
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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue