1712 Commits

Author SHA1 Message Date
Mohamed Daahir
9afa25ca19 bump version to v0.24.1 v0.24.1 2025-05-02 15:20:05 +01:00
Mohamed Daahir
418b20b133 update CHANGELOG.md 2025-05-02 15:14:21 +01:00
Mohamed Daahir
55b920e5ec
Merge pull request #416 from zuisong/parse-filename
download file parse filename add RFC 5987 support
2025-04-18 11:54:51 +01:00
zuisong
a1f4eacb76
Decoding RFC 5987 encoded filenames using Windows-1252, and add corresponding test cases.
Signed-off-by: zuisong <com.me@foxmail.com>
2025-04-16 22:25:39 +08:00
zuisong
2a9a23e2e4
apply suggestion 2025-04-14 10:57:27 +08:00
zuisong
31c515e403
use sanitize-filename crate to make filenames safe
Sanitizes filenames by removing or replacing potentially problematic characters
Makes filenames safe for cross-platform use
Prevents directory traversal attacks (e.g., "../../../")
2025-04-10 14:47:07 +08:00
zuisong
a60a52453a
download file parse filename add RFC 5987 support
support percent-encoded filename

Signed-off-by: zuisong <com.me@foxmail.com>
2025-04-10 13:22:11 +08:00
Mohamed Daahir
be990ac505
Merge pull request #413 from blyxxyz/better-rustls-errors
Improve rustls errors for invalid certificates
2025-03-19 21:25:10 +00:00
Jan Verbeek
300203338f Improve rustls error messages for invalid certificates
After a recent release rustls provides better error messages for
invalid certificates. For example:

```
invalid peer certificate: certificate not valid for name "wrong.host.badssl.com"; certificate is only valid for DnsName("*.badssl.com") or DnsName("badssl.com")
```

The message for expired certificates still isn't too readable but the
error now contains timestamps so we enhance it ourselves:

```
xh: error: error sending request for url (https://expired.badssl.com/)

Caused by:
    0: client error (Connect)
    1: invalid peer certificate: certificate expired: verification time 1742381579 (UNIX), but certificate is not valid after 1428883199 (313498380 seconds ago)

Certificate not valid after 2015-04-12 23:59:59.0 +00:00:00 (9years 11months 6days 8h 43m 24s ago).
```
2025-03-19 12:29:17 +01:00
Jan Verbeek
7ad28aa483 Re-enable badssl.com tests
Hopefully the random timeouts have stopped by now?
2025-03-19 12:29:17 +01:00
Jan Verbeek
79b47ee164 Use distinct error type for too many redirects 2025-03-19 12:29:17 +01:00
Jan Verbeek
e57c4e1c92 Use ExitCode return type instead of std::process::exit 2025-03-19 12:29:17 +01:00
Mohamed Daahir
24afadb354
Merge pull request #411 from blyxxyz/zstd-lazy-init
Fix crash on empty zstd response body
2025-03-16 22:24:52 +00:00
Jan Verbeek
884f5ba621 Accept Content-Encoding x-gzip as an alias of gzip 2025-03-09 18:51:27 +01:00
Jan Verbeek
4dc314b920 Document how other user agents handle empty "compressed" responses 2025-03-09 18:51:27 +01:00
Jan Verbeek
6bc87b3974 Use a proper error type for binary data detection
We used to use `ErrorKind::InvalidData` to communicate binary data
that should not be shown in the terminal but that one can actually
happen in other cases as well. brotli decoding uses that ErrorKind,
and we now use it for all decompressors.

So an invalid brotli response would under certain circumstances render
as "NOTE: binary data not shown in terminal".

We can use our own error type to track this properly.
2025-03-05 20:52:18 +01:00
Jan Verbeek
674be17a36 Increase Brotli decoder buffer size 2025-03-05 20:52:18 +01:00
Jan Verbeek
b4e3fb2012 Delay initialization of zstd decoder
Fixes a panic for `xh head https://httpbin.dev/zstd`.

`ZstdDecoder::new()` returns a `Result`. We used to panic on this, but
it needs to be a `Read` error instead, so we can suppress the error
for an empty input the way we do for other decoders.

Our existing approach couldn't handle this, so I ended up refactoring
the system. I think it's cleaner now, though still weird.

We now also preserve the original decoder error instead of
`.to_string()`ing it, or strip it completely if there was an I/O
error. That should improve the error reporting.
2025-03-05 20:52:18 +01:00
Mohamed Daahir
9f98ad634a
Merge pull request #407 from blyxxyz/test-unset-RUST_BACKTRACE
Set RUST_BACKTRACE=0 in feature tests
2025-02-26 21:53:32 +00:00
Jan Verbeek
eeff9c17d4 Set RUST_BACKTRACE=0 in feature tests
If RUST_BACKTRACE=1 was set outside the test runner,
e.g. `RUST_BACKTRACE=1 cargo test`, this propagated to the test binary
and changed error outputs.

Interestingly this only affected `nested_json_type_error`.

Resolves #406.
2025-02-26 11:08:50 +01:00
Mohamed Daahir
21e998e5b2 bump version to v0.24.0 v0.24.0 2025-02-18 08:15:49 +00:00
Mohamed Daahir
a3d0cfd130 Update Cargo.lock 2025-02-18 08:02:27 +00:00
Mohamed Daahir
0299c64332 update CHANGELOG.md and README.md 2025-02-18 08:02:02 +00:00
Mohamed Daahir
34ece99af9 tweak spacing in --compress help 2025-02-18 08:01:49 +00:00
Mohamed Daahir
4873dc9b7f
Merge pull request #403 from zuisong/compress-request-body
support compress request body
2025-02-12 08:26:06 +00:00
zuisong
670a5ba096
apply suggestion 2025-02-12 16:13:33 +08:00
zuisong
e9a386f460
apply suggestion 2025-02-06 09:41:20 +08:00
zuisong
d9026f1850
can not combine compress with multipart 2025-02-04 22:47:39 +08:00
zuisong
53e7bbd88a
update help doc 2025-02-04 22:10:12 +08:00
zuisong
abc8c03b10
move compress request body test cases to own file 2025-02-04 22:09:49 +08:00
zuisong
c4bbdba60e
update help doc 2025-01-23 10:51:53 +08:00
zuisong
1ec0267a18
apply suggestion 2025-01-23 09:19:13 +08:00
zuisong
2a1fba66f7
add more test 2025-01-22 22:23:50 +08:00
zuisong
70ad491c81
compress request body online test 2025-01-22 22:04:04 +08:00
zuisong
9b26a31415
support compress stream data 2025-01-22 21:42:04 +08:00
zuisong
f85194ac1e
support compress request body 2025-01-22 18:21:17 +08:00
Mohamed Daahir
f75d09216f
Merge pull request #402 from nc7s/reproducible-timestamp
Generate man page with reproducible timestamp
2025-01-20 20:09:48 +00:00
Blair Noctis
8d34d5cc74
Generate man page with reproducible timestamp 2025-01-20 14:00:11 +00:00
Mohamed Daahir
df9003e3da
Merge pull request #401 from otaconix/more-cookie-info-in-session
Remove vendored reqwest_cookie_store & store default paths for cookies without an explicit path attribute
2025-01-19 15:02:56 +00:00
Stefan Zwanenburg
9ae2e3bfd4 Save cookie default-path if no explicit path attribute is present in Set-Cookie
Note that this commit does not alter the storage format of sessions.
Perhaps requiring a cookie path at all times would be a good idea, but
I haven't done that here, because I don't want to break existing
sessions for users.

Fixes: #400
2025-01-19 13:25:08 +01:00
Stefan Zwanenburg
de82cb8f6d Remove vendored reqwest_cookie_store.
Fixes #399
2025-01-19 13:23:55 +01:00
Mohamed Daahir
1a1a0b5dc8
Merge pull request #397 from kranurag7/kr/upgrade-cookie_store
upgrade cookie_store to 0.21.1
2025-01-11 18:01:43 +00:00
kranurag7
bb82a77c0e use builder.into()
Signed-off-by: kranurag7 <81210977+kranurag7@users.noreply.github.com>

Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>
2025-01-11 23:16:11 +05:30
kranurag7
355dd04295 address review comments
Co-authored-by: Jan Verbeek <jan.verbeek@posteo.nl>
2025-01-11 23:13:41 +05:30
kranurag7
53f7eced0f upgrade cookie_store to 0.21.1
upgrading cookie_store to 0.21.1 via this commit because it was pulling
idna which contained a CVE.

Signed-off-by: kranurag7 <81210977+kranurag7@users.noreply.github.com>
2025-01-11 23:11:18 +05:30
Fotis Gimian
196ca1f162
Switch to generating completions at runtime (#393)
* Allow for completion and man page generation at runtime and support for Elvish and Nshull

* Refine runtime generation based on feedback provided
2025-01-06 14:24:36 +02:00
Mohamed Daahir
35dfe49761 update CHANGELOG.md 2025-01-02 13:52:22 +02:00
Mohamed Daahir
65898226ee bump version to v0.23.1 v0.23.1 2025-01-02 13:37:48 +02:00
Mohamed Daahir
4c3ab40d1f Update Cargo.lock 2025-01-02 13:33:02 +02:00
Mohamed Daahir
04fea201d7 update CHANGELOG.md 2025-01-02 13:32:41 +02:00