1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-24 07:40:52 +00:00
freebsd/lib/libfetch
Pietro Cerutti 1af7d5f389 libfetch: don't include fragments in HTTP requests
Summary:
Fragments are reserved for client-side processing, see
https://www.rfc-editor.org/rfc/rfc9110.html#section-7.1

Also, some servers don't like to receive HTTP requests with fragments.

```
$ fetch 'https://dropbox.com/a/b'
fetch: https://dropbox.com/a/b: Not Found

$ fetch 'https://dropbox.com/a/b#'
fetch: https://dropbox.com/a/b#: Bad Request
```

This is a real-world scenario, where some download link from dropbox
(eventually) redirects to an URL with a fragment:

```
$ fetch -v 'https://www.dropbox.com/sh/<some>/<thing>?dl=1' 2>&1 | grep requesting
requesting https://www.dropbox.com/sh/<some>/<thing>?dl=1
requesting https://www.dropbox.com/scl/fo/<foo>/<bar>?rlkey=<baz>&dl=1
requesting https://<boo>.dl.dropboxusercontent.com/zip_download_get/<some-long-strig>#
```

See how the last redirect ends with a `#`.

Currently, libfetch includes the ending fragment and makes it impossible
to download the file.

Differential Revision:	https://reviews.freebsd.org/D46318
MFC after:		2 weeks
2024-08-21 12:35:27 +00:00
..
common.c lib/libfetch/common.c: remove an extra semicolon 2024-02-02 18:35:02 -07:00
common.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
fetch.3 libfetch, fetch: Stop recommending the use of ca_root_nss. 2023-10-08 06:35:15 +02:00
fetch.c libfetch: don't include fragments in HTTP requests 2024-08-21 12:35:27 +00:00
fetch.h Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
file.c lib: Automated cleanup of cdefs and other formatting 2023-11-26 22:23:59 -07:00
ftp.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
ftp.errors Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
http.c Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:42 -06:00
http.errors Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00