Commit Graph

465 Commits

Author SHA1 Message Date
Steven Fackler
66a5d113d4 Shutdown the stream along with connection (#304)
This will in particular send close notify alerts for TLS streams.
2018-08-09 10:36:30 -07:00
Sean McArthur
3b57049792 v0.1.12 2018-08-08 16:05:27 -07:00
Geoffry Song
e6c841c8ba Fix the initial send window size. (#301)
Closes #298.
2018-08-08 15:43:56 -07:00
Sean McArthur
12028cc418 fix panic when calling reserve_capacity after connection closes (#302) 2018-08-08 15:43:47 -07:00
Geoffry Song
d2aa9197f9 Fix the handling of incoming SETTINGS_INITIAL_WINDOW_SIZE. (#299) 2018-08-03 16:00:13 -07:00
Eliza Weisman
78ab6167c4 v0.1.11 2018-07-31 11:44:01 -07:00
Sean McArthur
c564273986 fix graceful shutdown to close once idle (#296) 2018-07-30 21:42:00 -07:00
Geoffry Song
fdfb873438 Prevent pending_open streams from being released. (#295)
* Prevent `pending_open` streams from being released.

This fixes a panic that would otherwise occur in some cases. A test
demonstrating said panic is included.

* Clear the pending_open queue together with everything else.
2018-07-23 15:41:54 -07:00
Eliza Weisman
f3806d5144 Add stream_id accessors to public API types (#292)
Problem:

Applications may want to access the underlying h2 stream ID for
diagnostics, etc. Stream IDs were not previously exposed in public APIs.

Solution:

Added a new public `share::StreamId` type, which has a more restricted 
API than the internal `frame::StreamId` type. The public API types 
`SendStream`, `RecvStream`, `ReleaseCapacity`, 
`client::ResponseFuture`, and `server::SendResponse` now all have 
`stream_id` methods which return the stream ID of the corresponding 
stream.

Closes #289.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-07-12 21:01:57 -07:00
Jake Goulding
41aae14c64 Do not distribute the fixtures in published crates (#290) 2018-06-20 17:09:33 -07:00
Carl Lerche
e78e7f152d Bump version to v0.1.10 (#287) 2018-06-18 12:01:35 -07:00
Carl Lerche
df69c0455a Fix spurrious test failure (#288)
There was a race condition in the test where the server connection
sometimes closed before the final client opereation. This triggered an
unwrap in the test.

This patch updates the test to ensuree that the mock server connection
stays open until the client test is complete.
2018-06-18 11:20:18 -07:00
Arvid E. Picciani
74a5e072fe Fix tight loop on aborted connection (#285)
When the underlying IO returns 0 on read, we must stop polling it since
it's closed. Otherwise we'll be stuck in a tight loop.

this fixes https://github.com/sfackler/rust-openssl/issues/949
2018-06-15 16:04:13 -07:00
Arvid E. Picciani
2b59803866 fix doc typo (#286) 2018-06-15 15:40:26 -07:00
Geoffry Song
23234fa14f Promote SendRequest::pending to an OpaqueStreamRef. (#281)
Because `self.pending` doesn't necessarily get cleaned up in a timely fashion -
rather, only when the user calls `poll_ready()` - it was possible for it to
refer to a stream that has already been closed. This would lead to a panic the
next time that `poll_ready()` was called.

Instead, use an `OpaqueStreamRef`, bumping the refcount.

A change to an existing test is included which demonstrates the issue.
2018-06-06 10:16:22 -07:00
Sean McArthur
1b9469ff75 v0.1.9 (#280) 2018-05-31 20:42:52 +02:00
Sean McArthur
3a4633d205 add SendResponse::poll_reset and SendStream::poll_reset to listen for reset streams (#279) 2018-05-30 22:57:43 +02:00
Carl Lerche
82addd6369 Bump version to v0.1.8 (#278) 2018-05-23 11:34:23 -07:00
johnklai1
6e63d7bae2 Wakeup waiting tasks when transitioning a stream from pending_open (#277) 2018-05-22 15:42:41 -07:00
Carl Lerche
a955a15091 Bump version to v0.1.7 (#276) 2018-05-14 10:35:22 -07:00
Carl Lerche
bb454e017c Enforce monotonic stream IDs for push promises (#275)
Previously, monotonic stream IDs (spec 5.1.1) for push promises were not
enforced. This was due to push promises going through an entirely
separate code path than normally initiated streams.

This patch unifies the code path for initializing streams via both
HEADERS and PUSH_PROMISE. This is done by first calling `recv.open` in
both cases.

Closes #272
2018-05-14 10:20:57 -07:00
Carl Lerche
173f9a67e7 Include fuzz testing setup (#274) 2018-05-10 14:48:02 -07:00
Geoffry Song
571bb14556 Be more lenient with streams in the pending_send queue. (#261)
The `is_peer_reset()` check doesn't quite cover all the cases where we call
`clear_queue`, such as when we call `recv_err`. Instead of trying to make the
check more precise, let's gracefully handle spurious entries in the queue.
2018-05-09 20:01:39 -07:00
Carl Lerche
cf62b783e0 Misc bug fixes related to stream state (#273)
This patch includes two new significant debug assertions:

* Assert stream counts are zero when the connection finalizes.
* Assert all stream state has been released when the connection is 
  dropped.

These two assertions were added in an effort to test the fix provided
by #261. In doing so, many related bugs have been discovered and fixed.
The details related to these bugs can be found in #273.
2018-05-09 15:03:21 -07:00
Carl Lerche
b4383b6a8c Add more stream state tests (#271) 2018-05-04 14:11:40 -07:00
Carl Lerche
8a9dfd14dc Move tests and support utilities to sub crates. (#268)
These crates will not be published to crates.io, but moving them allows
`tower-h2` to also depend on the test utilities.
2018-05-03 13:08:39 -07:00
Dirkjan Ochtman
51f6a12454 Fix links to handshake() documentation (#265) 2018-04-30 10:32:39 -07:00
Sean McArthur
e8fcd34476 change from deprecated Buf::put_*<E> to put_*_be (#267) 2018-04-27 14:35:28 -07:00
Sean McArthur
fadec67fdf prevent a leak of 'active streams' if client request has user error (#266) 2018-04-26 18:20:32 -07:00
Carl Lerche
279dd93354 Bump version to v0.1.6 (#264) 2018-04-24 20:47:17 -07:00
Geoffry Song
558e6b6e6c Avoid reclaiming frames for dead streams. (#262)
In `clear_queue` we drop all the queued frames for a stream, but this doesn't
take into account a buffered frame inside of the `FramedWrite`. This can lead
to a panic when `reclaim_frame` tries to recover a frame onto a stream that has
already been destroyed, or in general cause wrong behaviour.

Instead, let's keep track of what frame is currently in-flight; then, when we
`clear_queue` a stream with an in-flight data frame, mark the frame to be
dropped instead of reclaimed.
2018-04-24 16:52:24 -07:00
Geoffry Song
11f914150e Add some missing bounds checks. (#260) 2018-04-23 14:38:42 -07:00
Eliza Weisman
040f391479 Reset any queued stream on receipt of remote reset (#258)
Fixes #256.

This PR changes `state::recv_reset` so any closed stream with queued send is immediately reset (and thus, the queue is cleared) on receipt of a `RST_STREAM` frame from the remote. 

This fixes the panic encountered by the test @goffrie posted in #256, where the stream is scheduled to close, receives a `RST_STREAM` frame, and sets the buffered capacity to 0, but isn't removed from the send queue, so we hit an assertion (or wrap, if debug assertions are disabled) when subtracting a sent frame's size from the buffered size.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-04-16 16:17:29 -07:00
Oliver Gould
fabae35311 Bump version to v0.1.5 (#255) 2018-04-06 18:41:27 -07:00
Sean McArthur
dca336f8b2 send proper max stream ID in graceful goaway (#254) 2018-04-06 15:51:34 -07:00
Sean McArthur
60749db680 Bump version to v0.1.4 2018-04-05 13:13:26 -07:00
Sean McArthur
65f69a3062 add ability to synchronize in tests
- Adds `wait_for` that takes another future to signal the mock
  should continue.
- Adds `yield_once` to allow one chain of futures to yield to the
  other.
2018-03-29 13:51:30 -07:00
Sean McArthur
1c5d4ded50 Add Graceful Shutdown support
If graceful shutdown is initiated, a GOAWAY of the max stream ID - 1 is
sent, followed by a PING frame, to measure RTT. When the PING is ACKed,
the connection sends a new GOAWAY with the proper last processed stream
ID. From there, once all active streams have completely, the connection
will finally close.
2018-03-29 13:51:30 -07:00
Oliver Gould
01d81b46c2 Add initial_connection_window_size to Builders (#249)
There is currently no way to configure the initial target window size
for connections. The `Builder::initial_connection_window_size` utilities
make this configurable so that all new connections have this target
window size set.
2018-03-28 14:46:56 -07:00
Carl Lerche
430d28723f Bump version to v0.1.3 (#248) 2018-03-28 12:50:46 -07:00
Eliza Weisman
23090c9fed recv_reset resets closed streams with queued EOS frames (#247) 2018-03-27 21:20:16 -07:00
Carl Lerche
e61788a57f Accept HPACK literals greater than max size (#244)
The spec specifically allows accepting HPACK literals with indexing when
the HPACK literal is greater than the max table size. In this case, the
literal is not inserted in the table.

Fixes #243
2018-03-22 12:58:23 -07:00
Darren Tsung
4595b54cfa Add initial_max_send_streams() as builder option (#242) 2018-03-16 11:58:06 -07:00
Carl Lerche
0cb3e648e9 Bump version to v0.1.2 (#239) 2018-03-13 18:11:11 -07:00
Carl Lerche
5d4c89b1a9 Fix client doc test (#241)
The test is not supposed to actually run, but the `select` is not fast
enough on Travis.
2018-03-13 14:53:35 -07:00
Darren Tsung
f8baeb7211 Streams receiving peer reset clear pending send (#238)
Because streams that were being peer reset were not clearing pending
send frames / buffered_send_data, they were not being counted towards
the concurrency limit.
2018-03-13 12:47:57 -07:00
messense
267789da92 Update indexmap to 1.0 (#237) 2018-03-12 10:38:07 -07:00
Carl Lerche
70cf009305 Bump version to v0.1.1 (#236) 2018-03-08 10:06:40 -08:00
Carl Lerche
02841ebd77 Normalize HTTP request path. (#228)
The HTTP/2.0 specification requires that the path pseudo header is never
empty for requests unless the request uses the OPTIONS method.

This is currently not correctly enforced.

This patch provides a test and a fix.
2018-03-07 20:48:54 -08:00
Darren Tsung
bbed41974b Prevent pushing a stream into both pending_send + pending_open (#235)
Prevent pushing a stream into both pending_send + pending_open,
Clear out variables from buffered streams that get a reset, and
ignore them when traversing the pending_send queue if
they are is_reset(). Add asserts that a stream cannot be in
pending_open & pending_send at the same time.
2018-03-07 16:11:33 -08:00