Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wget implicitly decoding %2F in URL #333

Open
flyn-org opened this issue Jul 22, 2024 · 0 comments
Open

wget implicitly decoding %2F in URL #333

flyn-org opened this issue Jul 22, 2024 · 0 comments

Comments

@flyn-org
Copy link

flyn-org commented Jul 22, 2024

GitLab's API uses %2F in its URLs. For example, https://gitlab.com/api/v4/projects/foo%2Fbar refers to the user foo's project named bar.

Wget2 2.1.0 seems to implicitly convert "%2F" strings in URLs to "/". Here is an example:

$ nc -l 8080 -k &
[1] 18734
$ wget --progress=none --server-response -O - --header "Private-Token: x" http://localhost:8080/api/v4/projects/foo%2Fbar
[0] Downloading 'http://localhost:8080/api/v4/projects/foo%2Fbar' ...
GET /api/v4/projects/foo/bar HTTP/1.1
Host: localhost
Accept-Encoding: gzip, deflate, br, zstd
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: wget2/2.1.0
Connection: keep-alive
Private-Token: x

In this example, nc prints the GET request received from wget. Notice that it contains foo/bar, not foo%2Fbar as intended. I would expect that wget would URL encode URLs, but not URL DEcode URLs, as this example demonstrates.

I tried Wget 1.24.5, and it behaved as I would expect: it left the %2F intact when it sent its GET request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant