1712 Commits

Author SHA1 Message Date
Mohamed Daahir
0d7d652ca8
Merge pull request #396 from zuisong/ruzstd
Security update: upgrade to ruzstd v0.7.3
2025-01-02 10:40:32 +02:00
zuisong
8e7722f462
upgrade to ruzstd v0.7.3
Security update
RUSTSEC-2024-0400: ruzstd uninit and out-of-bounds memory reads
KillingSpark/zstd-rs#75
2025-01-02 11:21:47 +08:00
Mohamed Daahir
0d9d68f02f
Merge pull request #394 from blyxxyz/warn-range-continue
Warn on combination of `--continue` and `Range:` header
2024-12-30 16:59:41 +02:00
Jan Verbeek
6b70b77c0a Warn on combination of --continue and Range: header 2024-12-30 14:45:22 +01:00
Jan Verbeek
6c2981c4c5 Move --download test cases to own file 2024-12-19 06:36:49 +01:00
Mohamed Daahir
0116e8218e
Merge pull request #390 from blyxxyz/log-dependencies
Enable logging in `rustls` and `tracing`-using dependencies
2024-12-01 20:33:03 +00:00
Jan Verbeek
e947ca79b3 Print errors regardless of logging filters
Before:
```console
$ RUST_LOG=foobar xh ssh://example.org
[no output]
```
After:
```console
$ RUST_LOG=foobar xh ssh://example.org
xh: error: builder error for url (ssh://example.org)

Caused by:
    URL scheme is not allowed
```

Reusing the `log` formatter for this was cute but ultimately
confusing.
2024-11-30 17:51:01 +01:00
Jan Verbeek
2b98447fac Enable logging in rustls and tracing-using dependencies
Enable `rustls`'s `logging` feature to start emitting logs.

Enable the `tracing` crate's `log` feature to hook up the dependencies
that log via that crate.

`hyper` can use `tracing` but it's currently unstable and locked
behind `RUSTFLAGS='--cfg hyper_unstable_tracing'` so we shouldn't use
it yet.

This partially addresses #389.

```console
$ RUST_LOG=trace/ALPN xh https://example.org
[0.495665s DEBUG rustls::client::hs] ALPN protocol is Some(b"h2")
[0.499526s TRACE hyper_util::client::legacy::client] ALPN negotiated h2, updating pool
HTTP/2.0 200 OK
[...]
$ RUST_LOG=rustls xh https://example.org
[0.288085s DEBUG rustls::client::hs] No cached session for DnsName("example.org")
[0.288657s DEBUG rustls::client::hs] Not resuming any session
[0.288767s TRACE rustls::client::hs] Sending ClientHello Message {
    version: TLSv1_0,
    payload: Handshake {
[...]
[0.698465s DEBUG rustls::client::hs] Using ciphersuite TLS13_AES_256_GCM_SHA384
[0.698508s DEBUG rustls::client::tls13] Not resuming
[0.698530s TRACE rustls::client::client_conn] EarlyData rejected
[0.699267s DEBUG rustls::client::tls13] TLS1.3 encrypted extensions: [Protocols([ProtocolName(6832)])]
[0.699342s DEBUG rustls::client::hs] ALPN protocol is Some(b"h2")
[0.699578s TRACE rustls::client::tls13] Server cert is
CertificateChain([CertificateDer(0x3082076e3082[...]
```

`native-tls` barely has any logging so we don't get much useful info
from there yet.
2024-11-30 17:51:01 +01:00
Mohamed Daahir
05fd88c89c
Merge pull request #388 from blyxxyz/fix-clippy-1.83
Fix `clippy::needless_lifetimes`
2024-11-29 22:19:18 +00:00
Jan Verbeek
42167ad59e Fix clippy::needless_lifetimes
This lint is new in Rust 1.83.
2024-11-28 19:19:44 +01:00
Mohamed Daahir
ef4429dd03 box TypeError to fix result_large_err clippy warning 2024-10-19 18:58:10 +01:00
Mohamed Daahir
0fb0a13ecb bump version to v0.23.0 v0.23.0 2024-10-12 22:22:45 +01:00
Mohamed Daahir
56176b3ba1 Update Cargo.lock 2024-10-12 22:04:56 +01:00
Mohamed Daahir
8022ce969f update CHANGELOG.md 2024-10-12 22:02:52 +01:00
Mohamed Daahir
5efc8bf1a3 update README.md 2024-10-12 21:31:06 +01:00
Mohamed Daahir
51c4c9b7bc update docs for quiet option 2024-10-12 21:30:56 +01:00
Mohamed Daahir
cca9ad0800
Merge pull request #377 from blyxxyz/smart-header-decode
Decode headers as latin1/UTF-8, show real reason phrase
2024-09-30 22:07:42 +01:00
Jan Verbeek
0bfa484903 Use mod.rs for formatting module 2024-09-30 22:34:23 +02:00
Jan Verbeek
65ca2f0848 Merge remote-tracking branch 'origin/master' into smart-header-decode 2024-09-30 21:46:49 +02:00
Mohamed Daahir
17f85f2fb6
Merge pull request #382 from gak/patch-1
Add Hermit as an installation method in README
2024-09-25 21:51:57 +01:00
Mohamed Daahir
abeba1a495
Merge pull request #383 from blyxxyz/fix-clippy-240925
Fix clippy::byte_char_slices lint
2024-09-25 21:16:00 +01:00
Jan Verbeek
c8a1f655ce Fix clippy::byte_char_slices lint 2024-09-25 18:48:41 +02:00
gak
b154bf13f4
Add Hermit as an installation method in README 2024-09-25 15:20:39 +10:00
Mohamed Daahir
89e5428618 Merge branch 'hotfix/v0.22.0-re-fix-download-path-escape' 2024-07-08 23:30:41 +01:00
Mohamed Daahir
c0f46a4999 bump version to v0.22.2 v0.22.2 2024-07-08 23:16:09 +01:00
Mohamed Daahir
b8f8843bec replace macos-latest with macos-13
`macos-latest` is now an alias for `macos-14` which runs on apple silicon
2024-07-08 23:14:38 +01:00
Mohamed Daahir
dd27ddb4ac bump version to v0.22.1 v0.22.1 2024-07-08 22:57:29 +01:00
Mohamed Daahir
70653ce9a3 temporarily disable dead_code warning 2024-07-08 22:57:29 +01:00
Mohamed Daahir
c2591d5c1d
Merge pull request #379 from blyxxyz/re-fix-download-path-escape
Prevent directory traversal in server-supplied filenames
2024-07-08 22:44:42 +01:00
Jan Verbeek
841f9c2e21 Prevent directory traversal in server-supplied filenames
If the `Content-Disposition` header includes directory
separators (e.g. `/`) then we now only take the base
filename. Including the directories is a vulnerability.

Originally fixed in 028cbb0165af54123a4829162a6a00f46e8dce74 but then
broken again in 330d3f2ed4e1af82ef89fefce2e6e84a8ac66330. This time I
added a regression test.
2024-07-08 07:46:55 +02:00
Jan Verbeek
00bc6f2238 Decode headers as latin1/UTF-8, show real reason phrase
External changes:

- We now print the actual reason phrase sent by the server instead
  of guessing it from the status code. That is, if servers reply with
  "200 Wonderful" instead of "200 OK" then we show that. This is
  especially useful for status codes that xh doesn't recognize.

- Header values are now decoded as latin1, with the UTF-8 decoding
  also shown if applicable.

- A new FAQ file with an entry that explains header value encoding.
  Header output now hyperlinks to this entry when relevant and if
  supported by the terminal.

Under the hood we now color headers manually. It's still hooked up to
the `.tmTheme` files but not to the `.sublime-syntax` file. This lets
us highlight the latin1 header values differently. In the future we
could use the same approach to optimize JSON highlighting.

I'm unsure about the position of the hyperlink. Currently it's the
text "UTF-8" in `<latin1 value> (UTF-8: <utf-8 value>)`. But that
means it's only shown if the value can be decoded as UTF-8. An
alternative is to turn the latin1 value itself into a hyperlink, but
that's confusing if the value itself is already a URL (which is a
common case for the `Location` header).

I also don't feel that our text is quite distinct enough from the
header value in the default `ansi` theme. Though the hyperlink does
help to set it apart.
2024-07-04 21:34:52 +02:00
Mohamed Daahir
2c7eaf9037
Merge pull request #376 from zuisong/zstd
update ruzstd to 0.7.0
2024-06-30 16:03:38 +01:00
zuisong
4248428745
update ruzstd to 0.7.0 2024-06-28 14:46:40 +08:00
Mohamed Daahir
81ce1e5054
Merge pull request #371 from blyxxyz/logging
Add `--debug` option for logging and backtraces
2024-06-22 23:00:50 +01:00
Jan Verbeek
f847104b36 Warn for invalid redirect 2024-06-22 18:38:07 +02:00
Jan Verbeek
33e40527b7 Merge remote-tracking branch 'origin/master' into logging 2024-06-22 18:07:58 +02:00
Mohamed Daahir
1b0f019adb
Merge pull request #375 from zuisong/utf8-hader-value
decode header value with utf-8
2024-06-22 16:08:24 +01:00
Jan Verbeek
9bb6dc2c9e Log Debug representation of error object 2024-06-22 14:46:01 +02:00
zuisong
6c80a49353
apply suggestion 2024-06-22 09:40:30 +08:00
zuisong
3f24597737
decode CONTENT_DISPOSITION header value with utf-8
download file support unicode file name
2024-06-22 00:14:27 +08:00
zuisong
cb44ff5e8a
add test case 2024-06-21 23:32:54 +08:00
zuisong
697422a58c
apply suggestion 2024-06-21 22:54:41 +08:00
zuisong
dec58124c7
decode header value with utf-8 2024-06-21 17:47:37 +08:00
zuisong
d8e80be88f
improve code style 2024-06-21 17:47:37 +08:00
Jan Verbeek
bf612bf8af Print status warning when not printing response headers, not when quiet 2024-06-21 09:22:15 +02:00
Jan Verbeek
10c309f88f Add test for ignored ;filename= tag 2024-06-20 23:14:18 +02:00
Jan Verbeek
9e0dfee4da Merge remote-tracking branch 'origin/master' into logging 2024-06-20 23:06:18 +02:00
Jan Verbeek
1f3aeb05bd Print HTTP status warnings in case of single --quiet
Resolves #179.
2024-06-20 22:54:59 +02:00
Jan Verbeek
d380228f87 Move logging-related tests to own file 2024-06-20 22:54:52 +02:00
Jan Verbeek
3cd7087e34 Make -qq (double --quiet) suppress warnings 2024-06-20 22:54:47 +02:00