mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
urlapi: fix redirect to a new fragment or query (only)
The redirect logic was broken when the redirect-to URL was a relative URL only as a fragment or query (starting with '#' or '?'). Extended test 1560 to reproduce, then verify. Reported-by: Jeroen Ooms Fixes #15836 Closes #15848
This commit is contained in:
parent
687a62f100
commit
66e5351e0a
4 changed files with 66 additions and 86 deletions
|
|
@ -1143,6 +1143,38 @@ static CURLUcode updateurl(CURLU *u, const char *cmd, unsigned int setflags)
|
|||
}
|
||||
|
||||
static const struct redircase set_url_list[] = {
|
||||
{"http://example.org#withs/ash", "/moo#frag",
|
||||
"http://example.org/moo#frag",
|
||||
0, 0, CURLUE_OK},
|
||||
{"http://example.org/", "../path/././../././../moo",
|
||||
"http://example.org/moo",
|
||||
0, 0, CURLUE_OK},
|
||||
|
||||
{"http://example.org?bar/moo", "?weird",
|
||||
"http://example.org/?weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo?bar", "?weird",
|
||||
"http://example.org/foo?weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo", "?weird",
|
||||
"http://example.org/foo?weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org", "?weird",
|
||||
"http://example.org/?weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/#original", "?weird#moo",
|
||||
"http://example.org/?weird#moo", 0, 0, CURLUE_OK},
|
||||
|
||||
{"http://example.org?bar/moo#yes/path", "#new/slash",
|
||||
"http://example.org/?bar/moo#new/slash", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo?bar", "#weird",
|
||||
"http://example.org/foo?bar#weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo?bar#original", "#weird",
|
||||
"http://example.org/foo?bar#weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo#original", "#weird",
|
||||
"http://example.org/foo#weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/#original", "#weird",
|
||||
"http://example.org/#weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org#original", "#weird",
|
||||
"http://example.org/#weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/foo?bar", "moo?hey#weird",
|
||||
"http://example.org/moo?hey#weird", 0, 0, CURLUE_OK},
|
||||
{"http://example.org/",
|
||||
"../path/././../../moo",
|
||||
"http://example.org/moo",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue