221 Commits

Author SHA1 Message Date
Sean McArthur
db8c109817 Client::poll_ready() returns an Error if next stream ID would overflow (#103)
Closes #102
2017-09-19 14:16:32 -07:00
Sean McArthur
0c8bd75224 check for StreamId overflow (#68) 2017-09-19 13:10:48 -07:00
Carl Lerche
e049dcb62b Rename Client::request -> send_request (#98)
All other fns have a send prefix.
2017-09-18 21:22:15 -07:00
Sean McArthur
a8a4cd2be1 add Client config to disable server push
- Adds `Client::builder().enable_push(false)` to disable push
- Client sends a GO_AWAY if receiving a push when it's disabled
2017-09-18 10:49:35 -07:00
Sean McArthur
c32015d48e add support for configuring max frame size
- Adds `max_frame_size` to client and server builders
- Pushes max_frame_size into Codec
- Detects when the Codec triggers an error from a frame too big
- Sends a GOAWAY when FRAME_SIZE_ERROR is encountered reading a frame
2017-09-14 17:03:43 -07:00
Carl Lerche
f84a1bdd1f Notify connection on connection window expansion (#86)
When capacity is released back to the connection and a connection level
window update needs to be sent out, the connection task needs to be
notified in order for the send to actually happen.
2017-09-14 13:50:52 -07:00
Sean McArthur
3ec0e85e56 add test when stream window overflows before conn window 2017-09-13 14:32:27 -07:00
Sean McArthur
e2cda1860b fix Body to return errors when there is recv error 2017-09-13 14:32:27 -07:00
Sean McArthur
ed472f109c add client::Builder to configure Clients 2017-09-13 14:32:27 -07:00
Sean McArthur
f7d14861e5 rustfmt: add trailing commas in match arms, set fn call to block stle (#85) 2017-09-12 19:29:06 -07:00
Oliver Gould
897bf84163 Use rustfmt to enforce consistent formatting
This change adds a .rustfmt.toml that includes ALL supported settings,
12 of which we have overridden to attempt to cater to our own
proclivities.

rustfmt is checked in the rust-nightly CI job.
2017-09-12 22:29:35 +00:00
Carl Lerche
93925e6d1f Limit send flow control bug to window_size (#78)
Senders could set the available capacity greater than the current
`window_size`.  This caused a panic when the sender attempted
to send more than the receiver could accept.
2017-09-12 10:48:11 -07:00
Eliza Weisman
11de86b34e Make Codec max frame length configurable (#57) 2017-09-11 12:56:40 -07:00
Sean McArthur
460afa41c8 Add connection window overflow test (#72) 2017-09-11 10:17:43 -07:00
Carl Lerche
5c0efcf8c4 Ref count stream state and release when final (#73)
Previously, stream state was never released so that long-lived connections
leaked memory.

Now, stream states are reference-counted and freed from the stream slab
when complete.  Locally reset streams are retained so that received frames
may be ignored.
2017-09-10 16:01:19 -07:00
Carl Lerche
daa54b9512 Rewrite a flow test 2017-09-08 13:42:14 -07:00
Oliver Gould
17bebe719a Increment stream window capacity when sending window update (#67) 2017-09-08 12:24:06 -07:00
Carl Lerche
c47717204c Flow control bug fix (#70)
The requested capacity was not decreased as data is written.
2017-09-08 12:15:46 -07:00
Sean McArthur
14f3f87da6 Merge pull request #66 from carllerche/flow-control-bugs
Fix some flow control bugs
2017-09-07 21:02:33 -07:00
Sean McArthur
b9e9fc64a7 Merge pull request #64 from seanmonstar/tests-ergo-frames
add ergonomics to testing with frames
2017-09-07 20:16:39 -07:00
Sean McArthur
018f00b8db update flow control tests to use frame builders 2017-09-07 17:06:09 -07:00
Sean McArthur
aef11623ac add recv_frame and send_frame extensions for Handle Futures 2017-09-07 17:05:43 -07:00
Sean McArthur
cc70ac1ef2 fix style to match crate 2017-09-07 17:05:07 -07:00
Carl Lerche
ae6bad6cef Fix some flow control bugs
When a stream is closed, connection level capacity should be released
back to the connection and then assigned to other streams waiting for
capacity.
2017-09-07 16:45:20 -07:00
Carl Lerche
9b42dafd24 Extract drive combinator to test support 2017-09-07 15:36:54 -07:00
Carl Lerche
38bbf30b2f Fix bug in prioritization (#63)
The stream buffered data counter was never decremented.
2017-09-07 14:12:21 -07:00
Sean McArthur
342d283cc5 add ergonomics to testing with frames 2017-09-07 13:09:57 -07:00
Sean McArthur
452e49dc3e aggregate WINDOW_UPDATE frames until change is over 50% available 2017-09-07 08:20:03 -07:00
Carl Lerche
cd76aca6d4 Add test infrastructure to work directly with frames (#56)
This adds a `Codec` based testing API. This is a bit less annoying than writing
at the raw H2 wire protocol level...
2017-09-06 14:18:37 -07:00
Carl Lerche
0cc611df35 Add Codec::set_max_send_frame_size 2017-09-05 14:01:32 -07:00
Carl Lerche
c2e6eb35d8 Track HTTP crate 2017-09-05 10:21:31 -07:00
Carl Lerche
b4fa5134f9 Data frame (#50)
* Rename DataFlag -> DataFlags
* Polish Data frame API
2017-09-05 10:00:05 -07:00
Carl Lerche
88d1de2da0 Expose Codec via an unstable flag (#49)
Exposes `Codec` using an unstable flag. This is useful for testing.
2017-09-03 16:17:05 -07:00
Carl Lerche
c122e97127 Refactor errors (#46)
This patch does a bunch of refactoring, mostly around error types, but it also
paves the way to allow `Codec` to be used standalone.

* `Codec` (and `FramedRead` / `FramedWrite`) is broken out into a codec module.
* An h2-codec crate is created that re-exports the frame and codec modules.
* New error types are introduced in the internals:
  * `RecvError` represents errors caused by trying to receive a frame.
  * `SendError` represents errors caused by trying to send a frame.
  * `UserError` is an enum of potential errors caused by invalid usage
    by the user of the lib.
  * `ProtoError` is either a `Reason` or an `io::Error`. However it doesn't
    specify connection or stream level.
  * `h2::Error` is an opaque error type and is the only error type exposed
    by the public API (used to be `ConnectionError`).

There are misc code changes to enable this as well. The biggest is a new "sink"
API for `Codec`. It provides buffer which queues up a frame followed by flush
which writes everything that is queued. This departs from the `Sink` trait in
order to provide more accurate error values. For example, buffer can never fail
(but it will panic if `poll_ready` is not called first).
2017-09-02 11:12:50 -07:00
Carl Lerche
11df3633a4 Fix build on nightly 2017-08-29 12:20:44 -04:00
Carl Lerche
11d5f95236 Wire in trailers (#34)
Add send and receive trailer support.
2017-08-25 10:20:47 -07:00
Carl Lerche
c0433e8831 Fix tests & bug introduced in previous commit 2017-08-24 16:48:01 -07:00
Carl Lerche
807d2b7317 Wire in recv flow control (#26) 2017-08-23 11:22:24 -07:00
Carl Lerche
a623ab68b5 New send flow control (#25)
Restructure send flow control such that sending data is always accepted by `Stream`. Data frames will be buffered until there is available window to send them. Producers can monitor the available window capacity to decide if data should be produced.
2017-08-21 13:52:58 -07:00
Carl Lerche
de96b2f410 Add another test 2017-08-16 12:43:48 -07:00
Carl Lerche
150c3160be Get large body writes working 2017-08-12 11:02:50 -07:00
Carl Lerche
570962353b Work on prioritization 2017-08-11 21:57:44 -07:00
Carl Lerche
8f2b69c280 Get server working again (mostly) 2017-08-09 10:36:03 -07:00
Carl Lerche
fa66323cec Akamai request kind of works 2017-08-08 09:47:29 -07:00
Carl Lerche
441a8416c6 Handle the remote returning a protocol error 2017-08-07 22:35:29 -07:00
Carl Lerche
71da8d121f Start hooking up sending data 2017-08-07 21:01:15 -07:00
Carl Lerche
6053ee059d Get receiving data working 2017-08-07 12:48:50 -07:00
Carl Lerche
d918215397 Fix test 2017-08-04 22:19:42 -07:00
Carl Lerche
90df6e3879 Try to clean up test 2017-08-04 20:54:49 -07:00
Carl Lerche
650b40fc90 Zomg something works 2017-08-04 17:29:37 -07:00