Commit Graph

23 Commits

Author SHA1 Message Date
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
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
807d2b7317 Wire in recv flow control (#26) 2017-08-23 11:22:24 -07:00
Carl Lerche
150c3160be Get large body writes working 2017-08-12 11:02:50 -07:00
Carl Lerche
441a8416c6 Handle the remote returning a protocol error 2017-08-07 22:35:29 -07:00
Carl Lerche
7a804601c5 A lot of structural work 2017-08-03 11:40:50 -07:00
Carl Lerche
0f13836504 More test cleanup 2017-07-26 13:08:00 -07:00
Carl Lerche
5dbeb0703b Start breaking out test files 2017-07-26 12:03:35 -07:00
Oliver Gould
82ba0dde71 update comments 2017-07-23 18:01:02 +00:00
Oliver Gould
4f723fffce clarify stream state management -- pattern matching ftw 2017-07-23 15:51:39 +00:00
Oliver Gould
f121f747ac tests pass 2017-07-22 21:16:53 +00:00
Oliver Gould
7951def04d fixup tests 2017-07-22 20:23:14 +00:00
Oliver Gould
067ec846e1 wip 2017-07-22 19:50:17 +00:00
Oliver Gould
d5d47b08ca testing, debugging, making things private 2017-07-22 18:30:32 +00:00
Oliver Gould
c1f9ff8fd8 wip: problems with Frame::len() 2017-07-17 01:07:21 +00:00
Carl Lerche
c061777663 Add large body test 2017-07-12 14:42:08 -07:00
Carl Lerche
36a1c6f045 More tests 2017-07-11 20:50:41 -07:00
Carl Lerche
fab9fa8ed2 More tests 2017-07-11 14:28:40 -07:00
Carl Lerche
4e0e01aa5c More tests 2017-07-11 14:01:25 -07:00
Carl Lerche
981af88838 Get data frames working 2017-07-08 22:23:44 -07:00
Carl Lerche
f6b6d0c7e8 Start state transition verification + refactors 2017-07-07 10:33:04 -07:00
Carl Lerche
63ffea61f5 Start writing tests 2017-06-29 20:59:21 -07:00