139 Commits

Author SHA1 Message Date
Brian Smith
b6724f7d7a Upgrade to env_logger 0.5 & log 0.4; reduce related dependencies (#226)
Upgrade to env_logger 0.5 and log 0.4 so that projects that use those
versions don't have to build both those versions and the older ones
that h2 is currently using.

Don't enable the regex support in env_logger. Applications that want
the regex support can enable it themselves; this will happen
automatically when they add their env_logger dependency.

Disable the env_logger dependency in quickcheck.

The result of this is that there are fewer dependencies. For example,
regex and its dependencies are no longer required at all, as can be
seen by observing the changes to the Cargo.lock. That said,
env_logger 0.5 does add more dependencies itself; however it seems
applications are going to use env_logger 0.5 anyway so this is still
a net gain.

Submitted on behalf of Buoyant, Inc.

Signed-off-by: Brian Smith <brian@briansmith.org>
2018-02-23 20:25:42 -08:00
Carl Lerche
69bd8828ef Remove mock-io git dependency 2018-01-11 22:46:52 -08:00
Carl Lerche
f27056467c Track rustls / ring 2018-01-11 22:35:47 -08:00
Carl Lerche
983477ea50 Depend on string 0.1 2018-01-11 22:21:19 -08:00
Carl Lerche
54f300907f Update the Cargo.toml 2018-01-11 21:21:53 -08:00
Sean McArthur
aa23a9735d SETTINGS_MAX_HEADER_LIST_SIZE (#206)
This, uh, grew into something far bigger than expected, but it turns out, all of it was needed to eventually support this correctly.

- Adds configuration to client and server to set [SETTINGS_MAX_HEADER_LIST_SIZE](http://httpwg.org/specs/rfc7540.html#SETTINGS_MAX_HEADER_LIST_SIZE)
- If not set, a "sane default" of 16 MB is used (taken from golang's http2)
- Decoding header blocks now happens as they are received, instead of buffering up possibly forever until the last continuation frame is parsed.
- As each field is decoded, it's undecoded size is added to the total. Whenever a header block goes over the maximum size, the `frame` will be marked as such.
- Whenever a header block is deemed over max limit, decoding will still continue, but new fields will not be appended to `HeaderMap`. This is also can save wasted hashing.
- To protect against enormous string literals, such that they span multiple continuation frames, a check is made that the combined encoded bytes is less than the max allowed size. While technically not exactly what the spec suggests (counting decoded size instead), this should hopefully only happen when someone is indeed malicious. If found, a `GOAWAY` of `COMPRESSION_ERROR` is sent, and the connection shut down.
- After an oversize header block frame is finished decoding, the streams state machine will notice it is oversize, and handle that.
  - If the local peer is a server, a 431 response is sent, as suggested by the spec.
  - A `REFUSED_STREAM` reset is sent, since we cannot actually give the stream to the user.
- In order to be able to send both the 431 headers frame, and a reset frame afterwards, the scheduled `Canceled` machinery was made more general to a `Scheduled(Reason)` state instead.

Closes #18 
Closes #191
2018-01-05 09:23:48 -08:00
Sean McArthur
24a796da72 remove unused tokio-timer dependency (#170) 2017-10-27 13:11:06 -07:00
Oliver Gould
1c179f7bf2 Depend on http:0.1 (#141) 2017-10-07 12:34:46 -07:00
Carl Lerche
8911ee2a4b Remove h2-test-support crate (#119)
The h2-test-support caused the unstable flag to always be enabled.
2017-09-25 22:28:39 -07:00
Eliza Weisman
e4b8dde1d3 Split Travis build into stages (#62)
Adds code coverage checking.
2017-09-14 16:33:34 -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
c2e6eb35d8 Track HTTP crate 2017-09-05 10:21:31 -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
9d45255c75 H2 headers must be lower case 2017-08-30 18:16:21 -04:00
Brian Smith
63ba0073a4 Update TLS-related dependencies. (#41)
Use a temporary private fork of tokio-rustls that uses Rustls 0.12
until tokio-rustls 0.4 is released.

This upgrades, among other things, *ring* to 0.12, which will ensure
that it still builds in the Rust 1.20 release coming this week even if
backward-compatibility-breaking changes to rustc aren't fixed before
the release.
2017-08-29 13:23:38 -04:00
Brian Smith
2992594552 Switch Akamai example from rust-openssl to Rustls. (#24)
With this change, h2 can build and run without any manual configuration steps for -msvc targets. Previously manual installation of OpenSSL libraries was required.
2017-08-16 21:43:35 -07:00
Brian Smith
72f1d372af Fix build by upgrading tokio-io dependency to tokio-io 0.1.3. (#23)
tokio-io 0.1.3 has been published so the "replace" for tokio-io 0.1.2 is no longer useful and it breaks the build with some (but apparently not all) versions of Cargo.

Update the dependency to tokio-io 0.1.3 since that is the version that's what's been verified to work.
2017-08-16 21:40:53 -07:00
Carl Lerche
de96b2f410 Add another test 2017-08-16 12:43:48 -07:00
Carl Lerche
32d4c2d5a9 Many more changes 2017-08-11 12:00:22 -07:00
Carl Lerche
e810b30999 Track http crate changes 2017-08-03 10:00:50 -07:00
Carl Lerche
341e15769e Move to custom stream storage 2017-08-02 12:55:41 -07:00
Oliver Gould
bd3a07f9e7 Since ReadySink isn't public yet, expose Connection::is_ready(). (#7)
Also use http from master
2017-07-26 14:15:47 -07:00
Carl Lerche
a203365d79 Switch to string crate (#6) 2017-07-26 13:20:26 -07:00
Oliver Gould
f121f747ac tests pass 2017-07-22 21:16:53 +00:00
Oliver Gould
067ec846e1 wip 2017-07-22 19:50:17 +00:00
Carl Lerche
5982113c7a Get a server working 2017-07-06 14:55:35 -07:00
Carl Lerche
63ffea61f5 Start writing tests 2017-06-29 20:59:21 -07:00
Carl Lerche
076bf204e7 Point io-dump to the github repo 2017-06-29 10:11:26 -07:00
Carl Lerche
1842cb5dfc Use latest tokio-timer 2017-06-27 13:31:46 -07:00
Carl Lerche
fa21970656 Much work 2017-06-23 13:13:50 -07:00
Carl Lerche
29951da962 FramedWrite 2017-06-19 13:34:08 -07:00
Carl Lerche
fa53d9556b Fuzz HPACK 2017-06-09 12:06:38 -07:00
Carl Lerche
2f8095e71a WIP 2017-06-02 12:41:39 -07:00
Carl Lerche
d3e4e036e3 Add HPACK test cases 2017-05-31 14:44:58 -07:00
Carl Lerche
3c850c2a34 Finish hpack decoding 2017-05-30 15:41:31 -07:00
Carl Lerche
769f3f142f More work 2017-03-11 12:59:15 -08:00
Carl Lerche
e2871d92fa Work 2017-03-10 13:02:04 -08:00
Carl Lerche
1fe3a57338 Initial commit 2017-03-09 20:02:47 -08:00