Commit Graph

190 Commits

Author SHA1 Message Date
Sean McArthur
c33b9d4e16 refactor(proto): move more h1-specific pieces into h1 module 2018-01-25 14:40:09 -08:00
Sean McArthur
68377ede70 perf(http): utilize writev when possible
By using `AsyncWrite::write_buf`, we can avoid some copies in some
cases. This especially helps throughput for chunked encoding.
2018-01-25 14:02:11 -08:00
Sean McArthur
d22deb6572 feat(server): add Http::max_buf_size() option
The internal connection's read and write bufs will be restricted from
growing bigger than the configured `max_buf_size`.

Closes #1368
2018-01-23 16:09:28 -08:00
Sean McArthur
7cb72d2019 fix(server): send 400 responses on parse errors before closing connection 2018-01-23 15:31:26 -08:00
Sean McArthur
44c34ce9ad fix(server): error if Response code is 1xx
Returning a Response from a Service with a 1xx StatusCode is not
currently supported in hyper. It has always resulted in broken
semantics. This patch simply errors better.

- A Response with 1xx status is converted into a 500 response with no body.
- An error is returned from the `server::Connection` to alert about the
  bad response.
2018-01-23 13:02:56 -08:00
Sean McArthur
227742221f fix(client): error on unsupport 101 responses, ignore other 1xx codes 2018-01-23 11:33:24 -08:00
Sean McArthur
d8b1aa848c perf(conn): use AsyncRead::read_buf to try skipping zeroing of buffer 2018-01-22 17:45:02 -08:00
Sean McArthur
36e66a5054 fix(lib): properly handle HTTP/1.0 remotes
- Downgrades internal semantics to HTTP/1.0 if peer sends a message with
  1.0 version.
- If downgraded, chunked writers become EOF writers, with the connection
  closing once the writing is complete.
- When downgraded, if keep-alive was wanted, the `Connection: keep-alive`
  header is added.

Closes #1304
2018-01-22 10:08:27 -08:00
Sean McArthur
14e4c741dc fix(tokio-proto): return end-of-body frame correctly for tokio-proto
Closes #1414
2018-01-16 14:11:20 -08:00
Sean McArthur
7a48d0e8b4 fix(lib): properly handle body streaming errors 2018-01-11 13:58:16 -08:00
Sean McArthur
7888451408 refactor(proto): return Error::Incomplete instead of UnexpectedEof 2018-01-11 11:45:28 -08:00
Sean McArthur
7976023b59 fix(client): don't error on read before writing request 2018-01-09 17:46:29 -08:00
Sean McArthur
fa7f4377c1 fix(server): add remote_addr back to Request when using Http::bind
The `Request::remote_addr()` method has been deprecated.

Closes #1410
2018-01-08 10:04:01 -08:00
Sean McArthur
34f0dba6dc chore(log): update to log 0.4 2018-01-04 14:50:18 -08:00
Sean McArthur
6ade21aa7f feat(server): change default dispatcher
- Deprecates the `no_proto` configuration on `Server`. It is always
  enabled.
- Deprecates all pieces related to tokio-proto.
- Makes the tokio-proto crate optional, and the `server-proto` feature
  can be used to completely remove the dependency. It is enabled by
  default.
2017-12-28 19:15:57 -08:00
Sean McArthur
bfb0f84d37 fix(client): fix panic when request body is empty string 2017-12-26 13:07:39 -08:00
Sean McArthur
7d3abfbcf3 fix(conn): don't double shutdown in some cases 2017-12-15 13:46:30 -08:00
Sean McArthur
ef4008121e fix(client): close connections when Response Future or Body is dropped
Closes #1397
2017-12-14 13:57:31 -08:00
Sean McArthur
fe82cea96a chore(lib): remove debug logs on 0 sized reads 2017-12-13 16:34:55 -08:00
Sean McArthur
139dc7ab2b fix(client): properly close idle connections after timeout
Additionally fixes if there were idle connections when a `Client` is
dropped.

Only fixes with the no-proto dispatcher, as changing internals for the
tokio-proto dispatcher would be much harder, and it will replace it very
soon.

Closes #1397
2017-12-13 16:29:25 -08:00
Sean McArthur
15fdd53d4c fix(client): detect valid eof after reading a body
If a connection closes immediately after reading the end of the body,
the next call to `conn.poll()` should not error, but just indicate
that the connection is done.

Closes #1396
2017-12-08 17:29:46 -08:00
Sean McArthur
7b5931122a feat(log): improve quality of debug level logs 2017-12-08 14:49:51 -08:00
Sean McArthur
95e0164e8f fix(client): return error instead of unmatched response when idle 2017-12-06 16:06:13 -08:00
Sean McArthur
8f938d97e7 fix(conn): handle when pre-emptive flushing closes the write state
Closes #1391
2017-12-06 14:50:13 -08:00
Steven Fackler
eb9590e3da feat(server): Allow keep alive to be turned off for a connection (#1390)
Closes #1365
2017-12-04 10:14:20 -08:00
Sean McArthur
cecef9d402 fix(client): remove idle connections when read eof is found 2017-11-28 17:13:54 -08:00
Sean McArthur
9f21241002 fix(client): always wait on reads for pooled connections 2017-11-28 16:17:20 -08:00
Steven Fackler
60d0eaf891 fix(server): allow TLS shutdown before dropping connections with no_proto
This is important for TLS connections in particular

Closes #1380
2017-11-28 15:34:30 -08:00
Sean McArthur
121b5eef19 fix(lib): fix no_proto dispatcher to flush queue before polling more body 2017-11-14 15:13:11 -08:00
Sean McArthur
8bf7964875 fix(server): GET requests with no body have None instead of Empty
Closes #1373
2017-11-14 11:52:29 -08:00
Sean McArthur
b60d4cda3d chore(server): setup ServerProto pieces to be deprecated
- Adds a `server-proto` feature that is added to default features.
- If `server-proto` feature is not enabled, pieces that will eventually
  be deprecated and optional will be tagged deprecated, but with a note
  about the missing `server-proto` feature.
2017-11-09 15:45:13 -08:00
Sean McArthur
b1765dd168 fix(client): drop in-use connections when they finish if Client is dropped 2017-10-30 15:20:56 -07:00
Sean McArthur
7c4b814e6b fix(client): don't read extra bytes on idle connections 2017-10-27 11:28:20 -07:00
Sean McArthur
f7532b71d1 feat(lib): add support to disable tokio-proto internals
For now, this adds `client::Config::no_proto`, `server::Http::no_proto`,
and `server::Server::no_proto` to skip tokio-proto implementations, and
use an internal dispatch system instead.

`Http::no_proto` is similar to `Http::bind_connection`, but returns a
`Connection` that is a `Future` to drive HTTP with the provided service.
Any errors prior to parsing a request, and after delivering a response
(but before flush the response body) will be returned from this future.

See #1342 for more.
2017-10-27 00:02:07 -07:00
Julian Tescher
5700ad79a3 docs(changelog,header,proto,client): Fix small typos 2017-10-21 20:07:56 -07:00
nabijaczleweli
d48ab9601b docs(headers): fix >-quote formatting
'>'s as non-first characters are just '>'s (rustfmt probably broke the
line)
2017-10-15 15:00:49 +02:00
Sean McArthur
6b4635fd13 fix(server): fix experimental pipeline flushing 2017-10-02 18:20:05 -07:00
Aaron Riekenberg
e8d6173734 fix(http): avoid infinite recursion when Body::from is called with Cow::Owned. (#1343)
When cow is a Cow::Owned, cow.to_owned() returns a Cow::Owned, which leads to infinite recursion.
Extract the owned or borrowed values from the cow to ensure progress is made in either case.
2017-10-01 09:49:36 -07:00
Sean McArthur
9c80fdbb9e refactor(lib): rename http_types to http 2017-09-29 18:12:55 -07:00
Sean McArthur
5027435791 refactor(lib): rename internal http module to proto 2017-09-28 18:28:44 -07:00