Commit Graph

618 Commits

Author SHA1 Message Date
Sean McArthur
c616ac4611 v0.1.24 2019-06-17 14:37:12 -07:00
Eliza Weisman
0e9fbe4a90 Log protocol error causes at debug (#371)
Currently, there are many cases where `h2` will fail a connection or
stream with a PROTOCOL_ERROR, without recording why the protocol error
occurred. Since protocol errors may result from a bug in `h2` or from a
misbehaving peer, it is important to be able to debug the cause of
protocol errors.

This branch adds a log line to almost all cases where a protocol error
occurs. I've tried to make the new log lines consistent with the
existing logging, and in some cases, changed existing log lines to make
them internally consistent with other log lines in that module. All
receive-side errors that would send a reset are now logged at the debug
level, using a formatting based on the format used in `framed_read`.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2019-06-17 14:14:40 -07:00
Sean McArthur
383593a01e allow servers to receive requests without an :authority header 2019-06-17 12:58:50 -07:00
Alex Touchet
e13645c091 Update repo URLs (#370) 2019-06-04 23:06:13 -07:00
Sean McArthur
8974fcd9ff v0.1.23 2019-06-04 19:53:01 -07:00
Sean McArthur
611e1ca010 Clear recv buffer when stream refs are dropped 2019-06-04 19:09:30 -07:00
Sean McArthur
a5a2ee7f7a v0.1.22 2019-06-03 11:26:59 -07:00
Sean McArthur
cf5e53f0c3 Refactor proto::streams::store indices
- Removes incrementing counter, instead just using the StreamId as a
  slab ABA guard.
- Adjusts Ptr::deref to use Store::index, as before it was skipping to
  check the ABA guard.
- Rename fields and types to clarify it actually is an ABA guard.
- Improve panic message in case a dangling Ptr is accessed.
2019-05-31 17:12:01 -07:00
Sean McArthur
b8f1f0ccf1 Prevent trying to assign capacity to streams that were just reset 2019-05-31 14:56:16 -07:00
Igor Gnatenko
45c4e0336f chore: Update string to 0.2 (#363)
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2019-05-31 09:19:20 -07:00
Sean McArthur
ad5a40c682 v0.1.21 2019-05-30 10:49:40 -07:00
Sean McArthur
6ebad4bb41 increase write buffer size to 16kb 2019-05-29 17:19:55 -07:00
Sean McArthur
91819bf25e check for overly large header field in send_headers 2019-05-29 17:19:55 -07:00
Sean McArthur
e512b6ccb6 panic if stuck in a CONTINUATION frame write loop 2019-05-29 17:19:55 -07:00
Sean McArthur
90d346bad8 v0.1.20 2019-05-16 14:14:40 -07:00
Sean McArthur
4c2cd72ea9 fix DebugFlags lifetimes for older compilers 2019-05-16 13:52:54 -07:00
Sean McArthur
30f125dfc3 v0.1.19 2019-05-15 14:09:09 -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
Sean McArthur
44ff5e5c78 Add DebugFlags helper, improve format of HEADERS and SETTINGS frames 2019-05-13 13:14:07 -07:00
Sean McArthur
dddef4ccbe v0.1.18 2019-04-09 12:29:22 -07:00
Sean McArthur
a3e59eb7e2 Prevent server Connection from returning same error after calling abrupt shutdown (#352) 2019-04-03 11:41:56 -07:00
Sean McArthur
8e809c3e0c v0.1.17 2019-03-12 18:59:36 -07:00
Sean McArthur
492f4e7f11 Make 'pending reset' streams not count towards active streams 2019-03-12 17:17:02 -07:00
Sean McArthur
feff97905f Notify RecvStream tasks if SendStream sends a local reset 2019-03-12 17:17:02 -07:00
Sean McArthur
e3a73f726e Add user PING support (#346)
- Add `share::PingPong`, which can send `Ping`s, and poll for the `Pong`
  from the peer.
2019-02-18 15:59:11 -08:00
Sean McArthur
8a0b7ff64f Loosen bounds on Handshake struct (#343) 2019-02-07 13:03:53 -08:00
Sean McArthur
74f040f5bf v0.1.16 (#344) 2019-01-24 10:37:47 -08:00
Max
d6a8a70ba9 Fixed incorrect order of arguments in send_reset trace. (#341) 2019-01-24 10:10:51 -08:00
Eliza Weisman
4b81e528d5 Log more information when rejecting malformed pseudo-headers (#342)
Currently, when a `h2` server receives a HEADERS frame with malformed
pseudo-headers, it logs which pseudo-heade was malformed at the debug
level before sending a reset. This behaviour is correct. However, it can
be difficult to debug misbehaving clients, as the server's log message
doesn't include the *value* of the invalid pseudo-header, or indicate
*why* it was incorrect. 

This branch changes the log message to include both the value of the
malformed header and the error that caused it to be rejected. 

For example, here is the output from the test
`server::recv_invalid_authority`, before and after making this change.

Before:
```
...
DEBUG 2019-01-23T19:16:28Z: h2::server: malformed headers: malformed authority
...
```

After:
```
...
DEBUG 2019-01-23T19:15:37Z: h2::server: malformed headers: malformed authority ("not:a/good authority"): invalid uri character
...
```

Note that it was necessary to clone the value of each pseudo-header
before passing it to the `uri::{Scheme, Authority, Path}::from_shared`
constructors, so that the value could be logged if those functions
return errors. However, since the pseudo-headers are internally
represented using `Bytes`, this should just increase the reference count
rather than copy the string, so I thought this was acceptable. 

If even a ref-count bump has an undesirable performance overhead, we
could consider using
```rust
if log_enabled!(Level::Debug) {
    // ...
}
```
to only clone if the message will be logged, but this makes the code
somewhat significantly more complicated. Therefore, I decided to punt on
that unless requested by a reviewer.

See also linkerd/linkerd2#2133

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2019-01-23 11:44:32 -08:00
Carl Lerche
78c39d8e65 Bump version to v0.1.15 (#339) 2019-01-13 09:53:19 -08:00
Eliza Weisman
d6e1fbeed8 Fix race in stream ref count (#338)
Fixes #326
2019-01-11 22:41:35 -08:00
Sean McArthur
61adb3570e v0.1.14 2018-12-05 10:05:46 -08:00
Sean McArthur
c7d4182ffe Release closed streams capacity back to connection (#334)
Previously, any streams that were dropped or closed while not having
consumed the inflight received window capacity would simply leak that
capacity for the connection. This could easily happen if a `RecvStream`
were dropped before fully consuming the data, and therefore a user would
have no idea how much capacity to release in the first place. This
resulted in stalled connections that would never have capacity again.
2018-12-05 09:44:20 -08:00
Igor Gnatenko
545ff1e7dd exclude more CI files and bump webpki to released version (#331) 2018-11-29 21:55:08 -08:00
Carl Lerche
8387355e1b Avoid locking when printing (#333)
* Avoid locking when printing

It is not obvious that attempting to print the
value of a struct could cause a deadlock. To avoid
this, this patch does not lock the mutex when generating
a debug representation of the h2 struct.

* Use try_lock
2018-11-29 21:50:53 -08:00
Sean McArthur
e656c42353 fix inverted split for DATA frame padding (#330) 2018-11-05 10:20:09 -08:00
Sean McArthur
1a8015da4a Reduce noise in Debug for Frame (#329) 2018-11-01 13:26:55 -07:00
Geoffry Song
4321caf6b3 Augment the fuzzer to open multiple concurrent streams. (#328)
This is how I found #319 and #320.
2018-10-29 14:07:08 -07:00
Michael Beaumont
fc5efe73d6 Add OpaqueStreamRef constructor (#325)
Closes #318
2018-10-17 23:09:28 -07:00
Carl Lerche
80b4ec5073 Bump version to v0.1.13 (#324) 2018-10-16 14:41:23 -07:00
Michael Beaumont
6b23542a55 Add client support for server push (#314)
This patch exposes push promises to the client API.

Closes #252
2018-10-16 12:51:08 -07:00
Geoffry Song
6d8554a23c Reassign capacity from reset streams. (#320)
I believe this was an oversight - a stream that is reset can still have some
capacity assigned to it (e.g. if said capacity was assigned in the same poll as
the reset), which should be redistributed.
2018-10-16 12:14:42 -07:00
Robert Ying
b116605560 Check whether the send side is not idle, not the recv side (#313)
* Check whether the send side is not idle, not the recv side
* Ensure sure we're handling window updates for the right side
* Add failing test
2018-10-16 12:03:56 -07:00
Carl Lerche
a4ed6155ac Check minimal versions (#322) 2018-10-16 12:03:29 -07:00
Geoffry Song
ea8b8ac2fd Avoid prematurely unlinking streams in send_reset, in some cases. (#319)
Because `send_reset` called `recv_err`, which calls `reclaim_all_capacity`,
which eventually calls `transition(stream, ..)` -- all of which happens _before_
the RESET frame is enqueued -- it was possible for the stream to get unlinked
from the store (if there was any connection-level capacity to reassign). This
could then cause the stream to get "leaked" on drop/EOF since it would no longer
be iterated.

Fix this by delaying the call to `reclaim_all_capacity` _after_ enqueueing the
RESET frame.

A test demonstrating the issue is included.
2018-10-16 11:59:22 -07:00
Carl Lerche
9bbbe7ebd5 Disable length_delimited deprecation warning. (#321)
Until tokio-rs/tokio#680 is resolved, we should allow using deprecated
APIs in the codec module.
2018-10-16 08:21:23 -07:00
Eliza Weisman
00ca534c4a Update examples to use new Tokio (#316)
The old `tokio-core` crate is deprecated in favour of the `tokio` crate,
which also provides the new multithreaded Tokio runtime. Although `h2`
is generic over the runtime, the examples do depend on `tokio`. 

This branch update the example code to use the new `tokio` library
rather than `tokio-core`. It also updates the examples in `RustDoc`.

For the most part, this was pretty trivial --- simply replacing
`handle.spawn(...)` with `tokio::spawn(...)` and `core.run(...)` with
`tokio::run(...)`. There were a couple of cases where error and item
types from spawned futures had to be mapped to `(), ()`. Alternatively,
this could have been avoided by using the single-threaded runtime and
calling `block_on` instead to await the value of those futures, but I
thought it was better to reduce the amount of tokio-specific code in the
examples.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2018-09-25 14:33:49 -07:00
samamill
12e0d26945 Added functions to access io::Error in h2::Error (#311)
Fixes #310
2018-09-24 10:12:46 -07:00
Michael Beaumont
586106adf2 Fix push promise frame parsing (#309) 2018-09-17 14:55:37 -07:00