Commit Graph

58 Commits

Author SHA1 Message Date
Sean McArthur
4398e169e8 Update to Tokio 0.2 (#428) 2019-11-27 14:53:57 -08:00
Gurwinder Singh
f46840f3fa chore: cargo fmt, clippy 2019-08-16 22:27:39 -07:00
Gurwinder Singh
f4dec6efa4 chore: 2018 edition clean up (#386) 2019-07-25 10:30:52 -07:00
Jakub Beránek
db6b841e67 Update crate to Rust 2018 (#383) 2019-07-23 10:18:43 -07:00
Sean McArthur
91819bf25e check for overly large header field in send_headers 2019-05-29 17:19:55 -07:00
Sean McArthur
dabd58fd58 use newest hpack index when repeating a header name 2019-05-15 13:32:07 -07:00
Sean McArthur
fc2fb487ea record last index when starting to encode a CONTINUATION frame 2019-05-15 13:32:07 -07:00
Geoffry Song
11f914150e Add some missing bounds checks. (#260) 2018-04-23 14:38:42 -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
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
Luca Bruno
35e0125e82 hpack/decoder: add bound check to peek_u8 (#175)
This updates `peek_u8` in hpack decoder to internally perform bound
checking. This ensures it cannot access bytes out of range once
reaching the end of the buffer.
2017-11-28 21:05:27 -08:00
Sean McArthur
7ad29932f6 change huffman unimplemented to return Err in decode4 2017-10-06 09:59:03 -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
c2e6eb35d8 Track HTTP crate 2017-09-05 10:21:31 -07:00
Carl Lerche
14f35f1be6 Handle malformed HEADERS 2017-08-30 18:16:21 -04:00
Carl Lerche
9d45255c75 H2 headers must be lower case 2017-08-30 18:16:21 -04:00
Carl Lerche
b0e6867877 Fix warnings 2017-08-24 15:52:01 -07:00
Carl Lerche
c439232ed2 Handle more H2 details 2017-08-10 21:08:57 -07:00
Carl Lerche
0d61832bf3 Extra log output 2017-08-10 16:13:36 -07:00
Carl Lerche
fa66323cec Akamai request kind of works 2017-08-08 09:47:29 -07:00
Carl Lerche
e810b30999 Track http crate changes 2017-08-03 10:00:50 -07:00
Carl Lerche
a203365d79 Switch to string crate (#6) 2017-07-26 13:20:26 -07:00
Oliver Gould
fb4f0bc5af resets too 2017-07-17 08:18:38 +00:00
Oliver Gould
7f21954724 Implement ping_pong (#1)
* comments

* wip

* wip

* Sketch out pingpong and keepalive stack modules

PingPong responds to ping requests with acknowledgements.
KeepAlive issues ping requests on idle connections.

* remove keepalive for now

* commentary

* prettify ping_pong's poll

* test ping pong and passthrough

* add buffering test

* Use a fixed-size slice for ping payloads

* Improve pong dispatch

pong messages should be buffered until Stream::poll returns
Async::NotReady or Async::Ready(None) (i.e. such that it is not expected
to be polled again).  pong messages are now dispatched when no more data
may be polled or the Sink half is activated.

* revert name change

* touchup

* wip

* Simplify Stream::poll

Now PingPong only holds at most one pending pong and the stream will not
produce additional frames unti the ping has been sent.

Furthermore, we shouldn't have to call inner.poll_complete quite so
frequently.

* avoid Bytes::split_to

* only use buf internally to Ping::load
2017-06-30 13:58:14 -07:00
Carl Lerche
a7b92d5ec2 Restructure hpack tests 2017-06-29 23:11:35 -07:00
Carl Lerche
fee43a09c8 Fix warnings 2017-06-27 12:23:57 -07:00
Carl Lerche
7897b770e9 Get a request sent 2017-06-26 22:25:25 -07:00
Carl Lerche
a3950354aa Header frame decoding 2017-06-20 09:16:21 -07:00
Carl Lerche
29951da962 FramedWrite 2017-06-19 13:34:08 -07:00
Carl Lerche
327ca79550 More header encoding work 2017-06-19 11:53:03 -07:00
Carl Lerche
b4c3161d74 A bunch of work 2017-06-16 21:45:44 -07:00
Carl Lerche
f6fd6a6d6e Bunch of work 2017-06-16 16:37:51 -07:00
Carl Lerche
c12a9a86ae Don't allocate on each call to huffman decode 2017-06-13 14:39:39 -07:00
Carl Lerche
ab8eac6c05 Remove extra debug_assert 2017-06-13 13:55:05 -07:00
Carl Lerche
c7de880f6c More bug fixes 2017-06-13 13:46:45 -07:00
Carl Lerche
ef495d55dc More HPACK bug fixes 2017-06-12 10:39:40 -07:00
Carl Lerche
58ea9ada0f More bug fixes 2017-06-11 13:53:23 -07:00
Carl Lerche
73de7918de Remove commented out code 2017-06-09 12:07:56 -07:00
Carl Lerche
fa53d9556b Fuzz HPACK 2017-06-09 12:06:38 -07:00
Carl Lerche
42f19f3006 Get encoder & decoder working 2017-06-07 21:54:04 -07:00
Carl Lerche
7ffc574da8 Add another encoder test 2017-06-06 14:57:51 -07:00
Carl Lerche
a9e900a5e2 More HPACK encoder changes 2017-06-06 14:51:03 -07:00
Carl Lerche
5c30ef30ec More HPACK encoding work 2017-06-05 15:03:04 -07:00
Carl Lerche
a7da819e45 More encoding work 2017-06-02 14:33:09 -07:00
Carl Lerche
2f8095e71a WIP 2017-06-02 12:41:39 -07:00
Carl Lerche
e41349572a Add huffman encoding 2017-06-01 12:35:20 -07:00
Carl Lerche
d3e4e036e3 Add HPACK test cases 2017-05-31 14:44:58 -07:00
Carl Lerche
f45a4b4cd7 Get HPACK decoder working 2017-05-31 14:44:38 -07:00
Carl Lerche
b9da06a576 More work on HPACK decoding 2017-05-30 21:56:50 -07:00