Commit Graph

19 Commits

Author SHA1 Message Date
Sean McArthur
f36c6b255f feat(client): proper proxy and tunneling in Client
Closes #774
2016-05-02 12:33:49 -07:00
Sean McArthur
25010fc1fc feat(client): add Proxy support
This works by configuring proxy options on a `Client`, such as
`client.set_proxy("http", "127.0.0.1", "8018")`.

Closes #531
2016-04-25 15:49:57 -07:00
Simon Sapin
8fa7a98968 refactor(hyper): Update to rust-url 1.0
BREAKING CHANGE: The re-exported Url type has breaking changes.
2016-04-21 16:14:08 -07:00
Corey Farwell
4c7f6f0c1e style(all): Address suggestions made by rust-clippy 2015-12-23 08:59:45 -08:00
Sean McArthur
fec6e3e873 feat(all): add socket timeouts
Methods added to `Client` and `Server` to control read and write
timeouts of the underlying socket.

Keep-Alive is re-enabled by default on the server, with a default
timeout of 5 seconds.

BREAKING CHANGE: This adds 2 required methods to the `NetworkStream`
  trait, `set_read_timeout` and `set_write_timeout`. Any local
  implementations will need to add them.
2015-11-24 10:58:58 -08:00
Marko Lalic
be4e718145 fix(http): Add a stream enum that makes it impossible to lose a stream
This removes a number of possible panics...
2015-09-07 11:05:41 +02:00
Marko Lalic
a36e44af7d fix(http): Make sure not to lose the stream when CL is invalid
When the Content-Length header is invalid, the Http11Message ends up
dropping the stream before returning the error. This causes a panic when
the `close_connection` method of the message is used later. This commit
fixes this by saving the stream onto the message instance before
returning the error. A regression test is also included.
2015-09-05 01:12:03 +02:00
Sean McArthur
32e09a0429 fix(client): EofReader by nature means the connection is closed 2015-09-02 09:26:46 -07:00
Sean McArthur
75c7117020 fix(client): be resilient to invalid response bodies
When an Http11Message knows that the previous response should not
have included a body per RFC7230, and fails to parse the following
response, the bytes are shuffled along, checking for the start of the
next response.

Closes #640
2015-09-01 16:58:51 -07:00
Sean McArthur
5c7195ab4a fix(http): fix several cases in HttpReader
- reading 0 bytes when SizedReader.remaining is more than 0 returns
"early eof" error
- reading 0 bytes when ChunkedReader.remaining is more than 0 returns
"early eof" error
- if SizedReader.remaining is less than buf.len(), the buf is sliced to
the remaining size
2015-08-31 19:30:52 -07:00
Sean McArthur
ef15257b73 fix(client): fix panics when some errors occured inside HttpMessage
BREAKING CHANGE: This changes the signature of HttpWriter.end(),
  returning a `EndError` that is similar to std::io::IntoInnerError,
  allowing HttpMessage to retrieve the broken connections and not panic.

  The breaking change isn't exposed in any usage of the `Client` API,
  but for anyone using `HttpWriter` directly, since this was technically
  a public method, that change is breaking.
2015-08-27 15:47:51 -07:00
Sean McArthur
67c284a96a fix(client): improve keep-alive of bodyless Responses 2015-08-05 16:45:54 -07:00
Sean McArthur
31f117ea08 fix(client): improve HttpReader selection for client Responses
Closes #436
2015-08-05 16:42:48 -07:00
Sean McArthur
7d1f154cb7 feat(net): add socket timeouts to Server and Client
While these methods are marked unstable in libstd, this is behind a
feature flag, `timeouts`. The Client and Server both have
`set_read_timeout` and `set_write_timeout` methods, that will affect all
connections with that entity.

BREAKING CHANGE: Any custom implementation of NetworkStream must now
  implement `set_read_timeout` and `set_write_timeout`, so those will
  break. Most users who only use the provided streams should work with
  no changes needed.

Closes #315
2015-07-27 09:57:59 -07:00
Sean McArthur
9bf60b65a0 docs(http): document consts CR, LR, and LINE_ENDING 2015-07-08 10:31:31 -07:00
Pyfisch
db93ca0697 style(rustfmt): run rustfmt on hyper correct overlong lines 2015-06-29 20:22:22 +02:00
Sean McArthur
53bba6eb7f feat(ssl): redesign SSL usage
BREAKING CHANGE: Server::https was changed to allow any implementation
  of Ssl. Server in general was also changed. HttpConnector no longer
  uses SSL; using HttpsConnector instead.
2015-06-20 14:58:58 -07:00
Sean McArthur
64e47b4bbd feat(client): impl Sync for Client
Connector::connect already used &self, and so would require
synchronization to be handled per connector anyway. Adding Sync to the
Client allows users to setup config for a Client once, such as using a
single connection Pool, and then making requests across multiple
threads.

Closes #254

BREAKING CHANGE: Connectors and Protocols passed to the `Client` must
  now also have a `Sync` bounds, but this shouldn't break default usage.
2015-06-12 11:19:54 -07:00
Sean McArthur
71ac65da5b refactor(http): move h1 and h2 into http module 2015-06-02 12:24:56 -07:00