Commit Graph

500 Commits

Author SHA1 Message Date
Marko Lalic
dccdf8d65a feat(client): implement Protocol trait for HTTP/1.1 2015-06-02 14:34:13 +02:00
Marko Lalic
3417303a4a feat(client): add Protocol trait 2015-06-02 14:34:13 +02:00
Marko Lalic
aa297f4532 refactor(client): use HttpMessage in Request and Response
BREAKING CHANGE: `hyper::client::request::Response` is no longer generic
over `NetworkStream` types. It no longer requires a generic type
parameter at all.
2015-06-02 14:34:13 +02:00
Marko Lalic
ecb713f849 feat(client): implement HttpMessage for HTTP/1.1 2015-06-02 14:34:13 +02:00
Marko Lalic
289fd02b55 feat(client): add HttpMessage trait 2015-06-02 14:34:13 +02:00
Sean McArthur
58094556f5 Merge pull request #552 from winding-lines/coverage
test(internal): increasing test coverage of internal/cell module
2015-06-01 09:56:40 -07:00
Marius Seritan
abbc4d6f7e test(internal): increasing test coverage of internal/cell module 2015-05-30 08:08:22 -07:00
Chandler Latour
020db5769d refactor(headers): expose RangeUnit in hyper::header
Allow RangeUnit to be used from user crates.
2015-05-28 16:49:25 -06:00
Sean McArthur
1e5d7d403b Merge pull request #549 from winding-lines/coverage
test(error): increasing test coverage of error module
2015-05-28 10:39:08 -07:00
Sean McArthur
0953b26060 Merge pull request #548 from winding-lines/connection-cov
test(connection): increasing test coverage of connection module
2015-05-28 10:36:15 -07:00
Stacey Ell
b1686d1b22 fix(buffer): check capacity before resizing
``cmp::min(cap * 4, MAX_BUFFER_SIZE) - cap'' can underflow when
cap > MAX_BUFFER_SIZE.  cap can exceed MAX_BUFFER_SIZE because
Vec::reserve aligns to powers of two.

Discovered by Matt Howard <themdhoward@gmail.com>
2015-05-27 08:48:19 -06:00
Marius Seritan
b24e1a5e6c test(error): increasing test coverage of error module 2 2015-05-26 20:31:24 -07:00
Marius Seritan
59d8e80e6c test(error): increasing test coverage of error module 2015-05-26 20:15:06 -07:00
Marius Seritan
c1a8e3bd02 test(connection): increasing test coverage of connection module 2015-05-25 09:31:58 -07:00
Marius Seritan
43e274cfce test(request): increasing test coverage of request module 2015-05-24 21:07:56 -07:00
Marius Seritan
795ee9f5e0 test(status): increasing test coverage of status module 2015-05-24 08:51:07 -07:00
Sean McArthur
69aa25fd0c Merge pull request #545 from hyperium/issue-543
fix(client): don't close stream until EOF
2015-05-23 17:22:38 -07:00
Sean McArthur
a5e6174efd fix(client): don't close stream until EOF
Closes #543
2015-05-23 15:11:44 -07:00
Sean McArthur
e64ce8c05e feat(http): add get_mut method to HttpReader 2015-05-23 15:11:37 -07:00
Pyfisch
5d669399b6 feat(headers): return hyper::Error instead of () from header components
This allows more precise errors in the future and makes it easier to use
the try!() macro in some cases.

BREAKING CHANGE: Error enum extended. Return type of header/shared/
types changed.
2015-05-20 18:24:52 +02:00
Sean McArthur
ca6cf2b294 Merge pull request #538 from hyperium/error-cov
test(error): increasing test coverage of error module
2015-05-18 22:28:27 -07:00
Sean McArthur
d7167e88c3 test(error): increasing test coverage of error module 2015-05-18 22:16:06 -07:00
Sean McArthur
c8086db266 Merge pull request #536 from hyperium/form-url-encoded
feat(header): add ContentType::form_url_encoded() constructor
2015-05-16 17:57:35 -07:00
Sean McArthur
2c99d4e906 feat(header): add ContentType::form_url_encoded() constructor 2015-05-16 15:08:42 -07:00
Marius Seritan
be041d915a feat(client): implement Default trait for client
Initial implementation of the default trait.
2015-05-15 22:35:42 -07:00
Sean McArthur
7d508d684f refactor(header): remove redundant closures 2015-05-13 10:40:54 -07:00
Sean McArthur
7e3858c962 perf(all): replace &str.to_string() with .to_owned() 2015-05-12 23:01:58 -07:00
Sean McArthur
72e274c52a refactor(header): add #[inline] to new header constructors 2015-05-12 18:23:55 -07:00
Sean McArthur
49b5b8fdfe feat(server): check Response headers for Connection: close in keep_alive loop
BREAKING CHANGE: Usage of Response.deconstruct() and construct() now use
  a &mut Headers, instead of the struct proper.
2015-05-12 17:47:55 -07:00
Sean McArthur
871f37a560 Merge pull request #522 from hyperium/header-convenient-constructors
Header convenient constructors
2015-05-11 20:22:18 -07:00
Sean McArthur
b6114ecd2e feat(header): add ContentType::json(), plaintext(), html(), jpeg(), and png() constructors 2015-05-11 19:14:43 -07:00
Sean McArthur
c2938fb45f feat(header): add Connection::close() and ::keep_alive() constructors 2015-05-11 19:14:43 -07:00
Sean McArthur
62d96adc6b refactor(header): change name of deref! to __hyper__deref!
The header is largely for internal use, however, it must be exported
because the header! macro uses it. As deref! is also a particularly
general name, this renames it to __hyper__deref! to prevent name
clashes.

BREAKING CHANGE: If you use deref! from the header module, you'll need
  to switch to using __hyper__deref!.
2015-05-11 19:00:38 -07:00
Sean McArthur
f64fb10bc8 feat(header): export __hyper__tm! macro so test modules work with header! 2015-05-11 19:00:27 -07:00
Sean McArthur
a6dd9c8476 refactor(lib): macro_use the mime! macro 2015-05-11 18:48:00 -07:00
Sean McArthur
085d7b0752 fix(mock): adjust ChannelMockConnector connect method to compile 2015-05-10 00:40:21 -07:00
Sean McArthur
1b318724a5 feat(net): remove mut requirement for NetworkConnector.connect()
BREAKING CHANGE: Any custom Connectors will need to change to &self in
  the connect method. Any Connectors that needed the mutablity need to
  figure out a synchronization strategy.

  Request::with_connector() takes a &NetworkConnector instead of &mut.
  Any uses of with_connector will need to change to passing &C.
2015-05-09 23:14:23 -07:00
Sean McArthur
7bc4e83ec2 Merge pull request #518 from mlalic/fix-client-ssl-verifier
fix(client): keep the underlying connector when setting an SSL verifier
2015-05-09 22:46:43 -07:00
Sean McArthur
390b9fa134 Merge pull request #520 from hyperium/conn-close
fix(client): dont call close() inside Request
2015-05-09 22:44:43 -07:00
Sean McArthur
3334fca278 fix(client): dont call close() inside Request
Only call close() in the Response, which should already return a
responding `Connection: close`.

Closes #519
2015-05-09 22:20:13 -07:00
Sean McArthur
a3637d5f73 refactor(all): adjust some logging 2015-05-09 22:18:05 -07:00
Marko Lalic
f4556d554f fix(client): keep the underlying connector when setting an SSL verifier
The client no longer drops the old `Connector` instance, along with its
entire context (such as the settings and pooled connections in the case
of a `Pool` connector); rather, it passes the SSL verifier on to the
`Connector` so that it uses it for any future connections that it needs
to establish.

A regression test is included.

Closes #495
2015-05-09 20:10:51 +02:00
Marko Lalic
a5d632b6ea feat(net): add set_ssl_verifier method to NetworkConnector trait
The commit includes an implementation of the new trait method for all
existing trait impls.

BREAKING CHANGE: Adding a new required method to a public trait is a
breaking change.
2015-05-09 20:10:51 +02:00
Sean McArthur
59f1b71fb3 Merge pull request #512 from hyperium/osx-shutdown
fix(net): ignore NotConnected error in NetworkStream.close
2015-05-07 13:13:41 -07:00
Sean McArthur
6be60052c6 fix(net): ignore NotConnected error in NetworkStream.close
On OSX, calling shutdown a second time will return a NotConnected error.
This commit will just ignore it, since we can agree that if a stream is
"not connected", it is in fact "closed".

Closes #508
2015-05-07 13:06:35 -07:00
Sean McArthur
d5558b687d feat(server): add Response.send to write a sized body
Closes #446
2015-05-07 11:03:45 -07:00
Sean McArthur
d294ea501d Merge pull request #511 from hyperium/drop-res
feat(server): dropping a Response will write out to the underlying stream
2015-05-06 15:16:46 -07:00
Sean McArthur
a9dcc59cd9 feat(server): dropping a Response will write out to the underlying stream 2015-05-06 15:12:38 -07:00
Pyfisch
ff346f147f refactor(hyper): add tests and refactor to increase coverage 2015-05-06 19:39:54 +02:00
Sean McArthur
972b3a388a feat(error): add Ssl variant to hyper::Error
The errors from openssl were previously boxed into a
Box<std::error::Error>, which lost some specifics and made it difficult
to match against. To solve this, an `Ssl` variant is added to the
`Error` enum of hyper, and is returned when openssl returns specific
errors.

Closes #483

BREAKING CHANGE: Adds a variant to `hyper::Error`, which may break any
exhaustive matches.
2015-05-05 18:25:19 -07:00