Commit Graph

210 Commits

Author SHA1 Message Date
Sean McArthur
44cb57c9d9 tests: add explicit SendResponse::send_reset test 2021-09-30 11:26:28 -07:00
Anthony Ramine
465f0337f8 Refactor errors internals (#556)
h2::Error now knows whether protocol errors happened because the user
sent them, because it was received from the remote peer, or because
the library itself emitted an error because it detected a protocol
violation.

It also keeps track of whether it came from a RST_STREAM or GO_AWAY
frame, and in the case of the latter, it includes the additional
debug data if any.

Fixes #530
2021-09-28 09:04:35 -07:00
Anthony Ramine
61b4f8fc34 Support very large headers
This completely refactors how headers are hpack-encoded.

Instead of trying to be clever, constructing frames on the go
while hpack-encoding, we just make a blob of all the
hpack-encoded headers first, and then we split that blob
in as many frames as necessary.
2021-09-08 10:20:30 -07:00
Sean McArthur
ab6f148ee1 Fix potential hang if extensions contain same StreamRef
If a user stored a `StreamRef` to the same stream in the request or
response extensions, they would be dropped while the internal store lock
was held. That would lead to a deadlock, since dropping a stream ref
will try to take the store lock to clean up.

Clear extensions of Request and Response before locking store, prevent
this.

Fixes hyperium/hyper#2621
2021-08-20 14:44:08 -07:00
Anthony Ramine
13dd80be8d Remove useless mut 2021-04-29 09:18:12 -07:00
Anthony Ramine
10d17e5f62 Don't override empty path for CONNECT requests (#534) 2021-04-27 18:55:46 -07:00
DavidKorczynski
9c7f47af95 Initial oss-fuzz integration. (#529)
Signed-off-by: davkor <david@adalogics.com>
2021-04-16 14:58:07 -07:00
Anthony Ramine
a1f914f46f Skip 1xx frames in more states (#527)
#524

Co-authored-by: Kornel <kornel@cloudflare.com>
2021-03-24 08:03:12 -07:00
Josh Soref
bcaaaf6dd9 Spelling fixes in comments (#508) 2021-02-25 08:59:18 -08:00
Kornel
89d91b0a4f Ignore 1xx frames (#521)
Closes #515
2021-02-25 08:57:42 -08:00
Sean McArthur
b4976675fa Update to Tokio and Bytes 1.0 (#504) 2020-12-23 10:01:44 -08:00
Paolo Barbolini
5a92f256c0 Upgrade to bytes 0.6 (#497)
* Upgrade to bytes 0.6

* Update Cargo.toml

Co-authored-by: Eliza Weisman <eliza@buoyant.io>

* Update tests/h2-support/Cargo.toml

Co-authored-by: Eliza Weisman <eliza@buoyant.io>

Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-11-19 14:38:56 -08:00
João Oliveira
cbbdd305b1 update to tokio 0.3 (#491) 2020-10-23 10:45:09 -07:00
Yuchen Wu
0ba7d13ae5 Allow responses of HEAD requests to have empty DATA frames (#490) 2020-10-22 14:36:41 -07:00
eggyal
2b19acf132 Handle client-disabled server push (#486) 2020-09-17 17:25:31 -07:00
João Oliveira
a19323727b fix h2-fuzz testing, import futures with FuturesUnordered (#482) 2020-08-26 10:58:52 -07:00
Eliza Weisman
fc7f63f641 start adding tracing spans to internals (#478)
We've adopted `tracing` for diagnostics, but currently, it is just being
used as a drop-in replacement for the `log` crate. Ideally, we would
want to start emitting more structured diagnostics, using `tracing`'s
`Span`s and structured key-value fields.

A lot of the logging in `h2` is already written in a style that imitates
the formatting of structured key-value logs, but as textual log
messages. Migrating the logs to structured `tracing` events therefore is
pretty easy to do. I've also started adding spans, mostly in the read
path.

Finally, I've updated the tests to use `tracing` rather than
`env_logger`. The tracing setup happens in a macro, so that a span for
each test with the test's name can be generated and entered. This will
make the test output easier to read if multiple tests are run
concurrently with `--nocapture`.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2020-08-17 17:29:22 -07:00
David Barsky
d3b9f1e36a feat(lib): switch from log to tracing (#475) 2020-07-07 15:55:24 -07:00
Sean McArthur
d6fa8386c4 Fix test not checking should_recv_frames 2020-07-07 09:53:43 -07:00
Sean McArthur
e41a1f130c Respect SETTINGS_HEADER_TABLE_SIZE (#459) 2020-03-30 11:53:22 -07:00
Sean McArthur
d6dc63276f Fix receiving a GOAWAY frame from updating the max recv ID
Receiving a GOAWAY should update the max *send* ID, it shouldn't affect
the max recv.
2020-03-25 10:08:13 -07:00
Kornel Lesiński
5041a4d428 Test CONNECT is accepted 2020-03-09 11:21:40 -07:00
Kornel
9af48b08c7 Fix fuzz compilation error (#454) 2020-03-09 14:06:57 -04:00
Sean McArthur
c5880076d5 rustfmt some test cases 2020-01-29 15:55:28 -08:00
Sean McArthur
74d02933a5 Fix warnings about deprecated Error::description 2020-01-29 15:55:28 -08:00
Sean McArthur
881832cde9 Rename unstable-stream feature to stream (#433) 2019-12-03 10:38:50 -08:00
Sean McArthur
eab9c0b410 Update to http 0.2 (#432) 2019-12-02 16:22:26 -08:00
Sean McArthur
4398e169e8 Update to Tokio 0.2 (#428) 2019-11-27 14:53:57 -08:00
Sean McArthur
86e53054a6 Change ReserveCapacity to expanded FlowControl type (#423)
- Adds `FlowControl::available_capacity` method.
- Adds `FlowControl::used_capacity` method.
2019-10-08 11:28:15 -07:00
Sean McArthur
4c1d797712 Add ability to adjust INITIAL_WINDOW_SIZE setting on an existing connection (#421) 2019-10-07 15:29:23 -07:00
Sean McArthur
367206bfa1 Decode debug_data in GOAWAY frames 2019-10-04 12:45:22 -07:00
Lucio Franco
9c5bc03908 Update tokio alpha.6 2019-10-01 06:41:28 -07:00
Aaron Hill
b4c129c99d chore(dependencies): update tokio to 0.2.0-alpha.5 (#409) 2019-09-20 13:43:03 -07:00
Michael Beaumont
fac165e451 Add server support for push (#327)
Closes #291, closes #185
2019-09-16 11:30:58 -07:00
Sean McArthur
0527f5b72a Rename 'stream' feature to 'unstable-stream' 2019-09-12 12:44:44 -07:00
Sean McArthur
678c90eb0a Update futures and tokio alphas 2019-08-29 15:44:26 -07:00
Gurwinder Singh
85b1f669c0 chore: async_await is stable on nightly 2019-08-21 11:10:03 -07:00
Sean McArthur
b2af3d4b28 Change trailers() to return Result<Option> instead of Option<Result> 2019-08-20 17:32:06 -07:00
Sean McArthur
a1db5428db Make Stream impls part of optional 'stream' cargo feature (#397) 2019-08-20 16:01:03 -07:00
Gurwinder Singh
f46840f3fa chore: cargo fmt, clippy 2019-08-16 22:27:39 -07:00
Gurwinder Singh
b039ef25bc Make handshake an async fn; other cleanup 2019-08-16 18:47:47 -07:00
Gurwinder Singh
ad7ffa795f Updated as per review comments 2019-08-16 18:47:47 -07:00
Gurwinder Singh
517077c698 Update h2-fuzz to std-future 2019-08-16 18:47:47 -07:00
Gurwinder Singh
97a4c8049c Update h2-tests to std-future 2019-08-16 18:47:47 -07:00
Gurwinder Singh
529ef4cd40 Update h2-support to std-future 2019-08-16 18:47:47 -07:00
Jakub Beránek
db6b841e67 Update crate to Rust 2018 (#383) 2019-07-23 10:18:43 -07:00
Sean McArthur
ab52cf9b30 Send RST_STREAM of STREAM_CLOSED instead of GOAWAY if stream may have been forgotten 2019-06-28 12:48:42 -07:00
Sean McArthur
3e345ac7b6 tests: reduce boilerplate of sending GET requests
This adds a `SendRequestExt` trait to h2-support, with a `get` method
that does a lot of the repeated request building stuff many test cases
were doing.

As a first step, the cleans up stream_states tests to use it.
2019-06-26 16:11:19 -07:00
Sean McArthur
383593a01e allow servers to receive requests without an :authority header 2019-06-17 12:58:50 -07:00
Alex Touchet
e13645c091 Update repo URLs (#370) 2019-06-04 23:06:13 -07:00