Commit Graph

1231 Commits

Author SHA1 Message Date
Joe Wilm
27cab3766d fix(client): Evict idle connections when full
In the scenario where a request is started on the `Client`, the client
has a full slab, and sockets for a *different* domain are idling in
keep-alive, the new request would previously cause the client to panic!.

This patch adds a `spawn_error` handler which attempts to evict an idle
connection to make space for the new request. If space cannot be made,
the error handler is run (passed `Error::Full`) and the `Handler` is
dropped.

This is a breaking change because of the new variant of `Error`.

Some inefficient use of `Vec` in the client was replaced with `VecDeque`
to support push/pop from either end.
2016-09-21 17:52:38 -07:00
Sean McArthur
8c6e6f51ab Merge pull request #910 from smithsps/feat-warning-header
feat(headers): add Warning header
2016-09-06 15:59:52 -07:00
Simon Smith
69894d1994 feat(headers): add Warning header
Implements Warning header from RFC7234
Closes #883
2016-09-05 14:35:48 -04:00
Ahmed Charles
8b3c120684 feat(server): add path() and query() to Request
Closes #896 
Closes #897

BREAKING CHANGE: `RequestUri::AbsolutePath` variant is changed to a struct variant. Consider using `req.path()` or `req.query()` to get the relevant slice.
2016-08-29 13:45:38 -07:00
Sean McArthur
a228486a85 Merge pull request #905 from YetAnotherMinion/enh-update_num_cpus_version
refactor(version): bump version of num_cpus to 1.0
2016-08-27 19:43:22 -07:00
YetAnotherMinion
c8b48c7efd refactor(version): bump version of num_cpus to 1.0 2016-08-27 14:03:24 -04:00
Markus Unterwaditzer
9375addba0 feat(headers): Headers::remove returns the Header
Closes #891

BREAKING CHANGE: `Headers.remove()` used to return a `bool`,
  it now returns `Option<H>`. To determine if a a header exists,
  switch to `Headers.has()`.
2016-08-23 16:46:07 -04:00
Sean McArthur
74136de960 Merge pull request #889 from aidanhs/aphs-not-v1-warning
Note on pre 1.0
2016-08-11 15:45:01 -07:00
Aidan Hobson Sayers
d53e033704 docs(version): note on pre 1.0 stability 2016-08-11 22:42:28 +01:00
Sean McArthur
0ce83dfbb3 Merge pull request #878 from nox/serde
Update serde to 0.8
2016-08-07 10:29:22 -07:00
Sean McArthur
c497dfcc93 Merge pull request #879 from nox/cookie
Update cookie to 0.3
2016-08-07 10:29:08 -07:00
Sean McArthur
f51b799023 Merge pull request #884 from hyperium/perf
A couple performance boosts
2016-08-06 10:58:36 -07:00
Sean McArthur
a3a815c09c perf(http): reduce server loops when headers and body are ready 2016-08-06 00:11:45 -07:00
Sean McArthur
523b890a19 fix(server): support HTTP/1.1 pipelining 2016-08-06 00:10:46 -07:00
Sean McArthur
12dac9bdba perf(http): encoder headers with a faster fmt::Write 2016-08-06 00:09:00 -07:00
Anthony Ramine
dc03ca188a chore(version): Update cookie to 0.3 2016-08-02 09:54:40 +02:00
Anthony Ramine
de921d08fe chore(version): Update serde to 0.8 2016-08-02 09:39:10 +02:00
Sean McArthur
9456738ee1 Merge pull request #877 from jongiddy/guide-save-receiver
Fix guide example to save receiver for later use by response handler.
2016-07-31 23:54:12 -07:00
Jonathan Giddy
ea1dccff59 docs(guide): fix guide example to save receiver for later use by response handler 2016-07-31 17:24:51 +01:00
Sean McArthur
81e7bf4155 refactor(http): call on_error for more error cases 2016-07-29 14:25:12 -07:00
Joonas Koivunen
13c5bf66c3 feat(headers): add Content-Location header
Closes #870
2016-07-28 09:59:33 -07:00
Sean McArthur
1b4a2b7e6f Merge pull request #876 from leodasvacas/conn-refactor
Dedup code in connection state update.
2016-07-27 16:49:44 -07:00
leonardo.yvens
211b408b92 style(http): Rustfmt State.update 2016-07-27 10:46:04 -03:00
leonardo.yvens
9f249bbee8 refactor(http): Dedup code in connection state update. 2016-07-27 10:45:57 -03:00
leonardo.yvens
c6eea3761b refactor(http): Remove new_state and use nested match for http1 in connection state update. 2016-07-27 10:45:51 -03:00
Sean McArthur
e5841365dd Merge pull request #874 from hyperium/guide
docs(guide): adjust styles of the guides
2016-07-26 09:45:51 -07:00
Sean McArthur
81e6e98d80 docs(guide): adjust styles of the guides 2016-07-26 08:55:08 -07:00
Sean McArthur
6f0921ed94 Merge pull request #873 from hyperium/guide
docs(guide): add meat to the Server Guide
2016-07-26 00:27:51 -07:00
Sean McArthur
12c69b5dd0 docs(guide): add meat to the Server Guide
Closes #806
2016-07-25 20:23:44 -07:00
Sean McArthur
50ccdaa7e7 feat(header): introduce header::Raw (#869)
The Raw type repesents the raw bytes of a header-value.

Having a special type allows a couple of benefits:

- The exact representation has become private, allowing "uglier"
internals. Specifically, since the common case is for a header to only
have 1 line of bytes, an enum is used to skip allocating a Vec for only
1 line. Additionally, a Cow<'static, [u8]> is used, so static bytes
don't require a copy. Finally, since we can use static bytes, when
parsing, we can compare the incoming bytes against a couple of the most
common header-values, and possibly remove another copy.

- As its own type, the `Headers.set_raw` method can be generic over
`Into<Raw>`, which allows for more ergnomic method calls.

BREAKING CHANGE: `Header::parse_header` now receives `&Raw`, instead of
  a `&[Vec<u8>]`. `Raw` provides several methods to ease using it, but
  may require some changes to existing code.
2016-07-23 12:54:16 -07:00
Ed Barnard
d67dbc6028 feat(server): Server::new can take one or more listeners
Closes #859
2016-07-18 15:32:38 -07:00
Sean McArthur
a22ae26cec docs(guide): fix css pathing 2016-07-15 17:53:51 -07:00
Sean McArthur
181e806a18 docs(guide): add styling to guides 2016-07-15 16:34:19 -07:00
Sean McArthur
2433780419 Merge pull request #865 from hyperium/gen-guide
docs(guide): copy over html files, not markdown files
2016-07-15 15:23:11 -07:00
Sean McArthur
c81cd4b0d5 docs(guide): copy over html files, not markdown files 2016-07-15 14:41:04 -07:00
Michael
e1542a609f feat(headers): add last-event-id header
Add a Last-Event-ID header to properly work with Server-Sent Events

Addresses # 723
2016-07-14 20:38:46 -07:00
Sean McArthur
e2264530e7 Merge pull request #864 from hyperium/less-deps
refactor(header): internalize traitobject and typeable
2016-07-14 20:36:43 -07:00
Sean McArthur
6fb143ce96 Merge pull request #863 from hyperium/guide-server
docs(guide): build and test markdown files in doc directory
2016-07-14 20:36:33 -07:00
Sean McArthur
d3719c3966 Merge pull request #860 from hyperium/idle-timeout
Idle timeouts for Server and Client
2016-07-14 20:36:24 -07:00
Sean McArthur
976218badc feat(client): add keep_alive_timeout to Client 2016-07-14 19:55:55 -07:00
Sean McArthur
29b65f6bdd docs(guide): build and test markdown files in doc directory 2016-07-14 19:25:49 -07:00
Sean McArthur
3e66377979 refactor(header): internalize traitobject and typeable 2016-07-14 17:27:59 -07:00
Sean McArthur
02cb96ac2d feat(server): add idle_timeout to Server
Closes #790
2016-07-14 17:23:13 -07:00
Sean McArthur
8de8b74a8f Merge pull request #858 from hyperium/ergo
Move some exports around, add try_read/try_write
2016-07-14 11:21:36 -07:00
Sean McArthur
85894bc123 feat(http): add Decoder.try_read and Encoder.try_write 2016-07-14 10:01:57 -07:00
Sean McArthur
40745c5671 refactor(lib): moved LanguageTag export to header
BREAKING CHANGE: LanguageTag used to be at the crate root, but it is now
  in the `hyper::header` module.
2016-07-14 09:59:47 -07:00
Sean McArthur
6d54a4dfdc Merge pull request #857 from hyperium/client-timeout-panic
fix(client): handle when DNS resolves after a timeout triggers
2016-07-13 17:19:45 -07:00
Michael
01843f8822 feat(headers): add origin header
Add an Origin header so users may properly send CORS requests

Closes #651
2016-07-13 14:50:52 -07:00
Sean McArthur
006f66f34a fix(client): handle when DNS resolves after a timeout triggers
Closes #848
2016-07-13 14:48:11 -07:00
Sean McArthur
220d09fc3a Merge pull request #856 from hyperium/keep-alive
feat(client): implement connection pooling for Client
2016-07-08 11:16:48 -07:00