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:
Daniel Stenberg 2024-12-28 14:47:01 +01:00
parent 687a62f100
commit 66e5351e0a
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 66 additions and 86 deletions

View file

@ -62,7 +62,7 @@ Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET /../%TESTNUMBER0002 HTTP/1.1
GET /%TESTNUMBER0002 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*