Commit Graph

588 Commits

Author SHA1 Message Date
Anthony Ramine
5c72713e2a Remove panic (fixes #395) (#541)
I don't even understand why that should panic, what's wrong with values
greater than 0x0fff_ffff? If we truly wish to avoid very large dynamic
tables, we should do so when we get the large SETTINGS_HEADER_TABLE_SIZE
value, not when encoding it.
2021-05-06 06:26:01 -07:00
boxdot
04570652b7 Do not use Instant::now when zero reset streams are configured. (#537)
This allows to use `h2` on wasm platforms which lack an
`Instant::now` implementation by setting the number of streams to
0 with: `h2::client::Builder::max_concurrent_reset_streams`.
2021-05-05 09:28:45 -07:00
Anthony Ramine
361de985a0 Enable all features on docs.rs (fixes #437) 2021-05-05 08:09:59 -07:00
Jason Hinch
50d6297d23 Replace unsafe code by ByteStr (fixes #440) 2021-05-04 20:00:30 -07:00
Anthony Ramine
a6b414458f v0.3.3 2021-04-29 09:18:12 -07:00
Justin Mayhew
2ccf8dd280 Fix calculation in FlowControl documentation 2021-04-29 09:18:12 -07:00
Anthony Ramine
0a738e6588 Document RecvStream::poll_data
I need it in another polling function.
2021-04-29 09:18:12 -07:00
Anthony Ramine
869e7162c4 Remove obsolete note in the docs
The Stream implementationa also wants you to take care of
managing capacity yourself.
2021-04-29 09:18:12 -07:00
Anthony Ramine
c3bc09550e Remove commented-out code 2021-04-29 09:18:12 -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
Sean McArthur
35699e721a Fix fuzzing of client sending to not fail on user errors (#533) 2021-04-22 14:54:26 -07:00
DavidKorczynski
9c7f47af95 Initial oss-fuzz integration. (#529)
Signed-off-by: davkor <david@adalogics.com>
2021-04-16 14:58:07 -07:00
Sean McArthur
2c53d60098 v0.3.2 2021-03-24 17:34:52 -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
Sean McArthur
7a5b574d8e v0.3.1 2021-02-26 12:36:26 -08:00
Yuchen Wu
11229702a0 Return an error instead of panicking when stuck in a CONTINUATION loop
It is not rare a large header can trigger such a CONTINUATION loop.
While the stream cannot recover from this issue, returning an error
instead of panicking makes the impact radius under better control.
2021-02-26 10:08:17 -08:00
Josh Soref
bcaaaf6dd9 Spelling fixes in comments (#508) 2021-02-25 08:59:18 -08:00
Eliza Weisman
c1b411fc14 add Connection::max_concurrent_recv_streams (#516)
This commit adds accessors to `client::Connection` and
`server::Connection` that return the current value of the
`SETTINGS_MAX_CONCURRENT_STREAMS` limit that has been sent by this peer
and acknowledged by the remote.

This is analogous to the `max_concurrent_send_streams` methods added in
PR #513. These accessors may be somewhat less useful than the ones for
the values negotiated by the remote, since users who care about this
limit are probably setting the builder parameter. However, it seems
worth having for completeness sake --- and it might be useful for
determining whether or not a configured concurrency limit has been acked
yet...

Part of #512
2021-02-25 08:58:19 -08:00
Kornel
89d91b0a4f Ignore 1xx frames (#521)
Closes #515
2021-02-25 08:57:42 -08:00
Markus Westerlind
30ca832790 Make some functions less-generic to reduce binary bloat (#503)
* refactor: Extract FramedWrite::buffer to a less generic function

Should cut out another 23 KiB (since I see it duplicated)

* refactor: Extract some duplicated code to a function

* refactor: Extract part of flush into a less generic function

* refactor: Extract a less generic part of connection

* refactor: Factor out a less generic part of Connection::poll2

* refactor: Extract a non-generic part of handshake2

* refactor: Don't duplicate Streams code on Peer (-3.5%)

The `P: Peer` parameter is rarely used and there is already a mechanism
for using it dynamically.

* refactor: Make recv_frame less generic (-2.3%)

* Move out part of Connection::poll

* refactor: Extract parts of Connection

* refactor: Extract a non-generic part of reclaim_frame

* comments
2021-02-18 11:17:49 -08:00
Kornel
6357e3256a de-generify FramedRead::decode_frame (#509)
* de-generify FramedRead::decode_frame

* Rename arg to decode_frame

Co-authored-by: Dan Burkert <dan@danburkert.com>
2021-02-16 12:21:29 -08:00
Anthony Ramine
fe938cb81c Fix the macro param name in set_pseudo (fixes #472) (#520) 2021-02-16 11:35:34 -08:00
Kestrer
fb78fe9606 Explicitly enable the std feature of indexmap (#519)
* Explicitly enable the `std` feature of indexmap

This crate depends on it anyway, and by explicitly turning it on we
avoid unreliable platform target detection that causes build failures on
some platforms.

* Bump indexmap to 1.5.2

This allows use of the `std` feature.

Co-authored-by: Taiki Endo <te316e89@gmail.com>

Co-authored-by: Taiki Endo <te316e89@gmail.com>
2021-02-15 15:03:35 -08:00
nickelc
9049e468c8 Remove the obsolent tracing-future dependency (#517) 2021-02-09 05:50:11 -08:00
nickelc
2b05c13298 Re-enable the akamai example (#518) 2021-02-09 05:49:12 -08:00
Eliza Weisman
978c71270a add Connection::max_concurrent_send_streams (#513)
This PR adds accessors to `client::Connection` and `server::Connection`
that return the send stream concurrency limit on that connection, as
negotiated by the remote peer. This is part of issue #512.

I think we probably ought to expose similar accessors for other
settings, but I thought it was better to add each one in a separate,
focused PR.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2021-02-05 09:58:10 -08:00
Eliza Weisman
2c8c847cd5 Replace deprecated compare_and_swap with compare_exchange (#514)
The `compare_and_swap` method on atomics is now deprecated in favor
of `compare_exchange`.

Since the author of #510 closed that PR, this is just #510 with rustfmt run.

I also removed an unnecessary trailing semicolon that the latest rust
compiler now complains about.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>

Co-authored-by: Kornel <kornel@cloudflare.com>
2021-02-05 09:27:27 -08:00
Sean McArthur
eec547d0dd v0.3.0 2020-12-23 10:19:09 -08:00
Sean McArthur
b4976675fa Update to Tokio and Bytes 1.0 (#504) 2020-12-23 10:01:44 -08:00
Sean McArthur
dc3079ab89 Remove log feature from tracing dependency (#501) 2020-11-25 16:25:36 -08:00
Eliza Weisman
73bf6a61ad re-enable vectored writes (#500)
Tokio's AsyncWrite trait once again has support for vectored writes in
Tokio 0.3.4 (see tokio-rs/tokio#3149.

This branch re-enables vectored writes in h2.

This change doesn't make all that big of a performance improvement in
Hyper's HTTP/2 benchmarks, but they use a BytesMut as the buffer.
With a buffer that turns into more IO vectors in bytes_vectored, there
might be a more noticeable performance improvement.

I spent a bit trying to refactor the flush logic to coalesce into fewer
writev calls with more buffers, but the current implementation seems
like about the best we're going to get without a bigger refactor. It's
basically the same as what h2 did previously, so it's probably fine.
2020-11-23 16:35:48 -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
Sean McArthur
676a068fd4 Prepare for 0.3.x changes 2020-10-23 08:29:04 -07:00
Sean McArthur
3bb01aafae v0.2.7 2020-10-23 08:14:51 -07:00
Yuchen Wu
0ba7d13ae5 Allow responses of HEAD requests to have empty DATA frames (#490) 2020-10-22 14:36:41 -07:00
Sean McArthur
cb2c7ac72b Fix h2psec CI script, since debug output of socket addresses changed (#493) 2020-10-22 14:35:30 -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
Michael Beaumont
d3c2bba18b Increment Stream.refs when sending a push promise 2020-08-17 15:54:47 -07:00
Michael Beaumont
6d80bd454e Fix handling Streams.refs in next_incoming
`Streams.inner.ref` doesn't need to be incremented if we don't
return an `OpaqueStreamRef`.

This prevented the bug in `send_push_promise` from appearing
in the tests.
2020-08-17 15:54:47 -07:00
Sean McArthur
e3a358d696 v0.2.6 2020-07-13 16:56:04 -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
cssivision
ceae69b468 Update Readme (#468) 2020-05-21 06:56:35 -07:00
Han Xu
96570bb564 fix documentation for server::Connection 2020-05-14 11:16:29 -07:00
Sean McArthur
ecb31135cb v0.2.5 2020-05-06 13:19:56 -07:00
Sean McArthur
c460c6e581 Change store debug_assert to only run in tests 2020-05-06 12:55:19 -07:00