Commit Graph

355 Commits

Author SHA1 Message Date
Sean McArthur
e234cbe669 Merge pull request #462 from hyperium/client-ergo
Client ergo
2015-04-21 16:22:22 -07:00
Jonathan Reem
76550fdb20 fix(http): Adjust httparse Request and Response lifetimes. 2015-04-18 20:33:58 -07:00
Jorge Israel Peña
c694b1385b fix(server): JoinHandle type parameter
The new beta adopts the new `JoinHandle` API which has a type parameter.
2015-04-17 14:31:54 -07:00
Sean McArthur
a2aefd9a56 feat(client): accept &String as Body in RequestBuilder
BREAKING CHANGE: This removes the trait `IntoBody`, and instead using
  `Into<Body>`, as it's more idiomatic. This will only have broken code
  that had custom implementations of `IntoBody`, and can be fixed by
  changing them to `Into<Body>`.
2015-04-16 10:25:12 -07:00
Sean McArthur
8bc179fb51 feat(client): accept &String for a Url in RequestBuilder
adds an IntoUrl implementation for &String
2015-04-16 10:10:42 -07:00
Sean McArthur
0fb92ee735 feat(debug): add Debug impls for StatusClass, Server, and Listening 2015-04-16 10:04:51 -07:00
Sean McArthur
4f09b002ff feat(log): clean up logging 2015-04-15 21:08:52 -07:00
Sean McArthur
d9187713b2 fix(server): handle keep-alive closing
Closes #437
2015-04-15 20:12:26 -07:00
Sean McArthur
68d4d63c2a fix(server): join on thread when Listening drops
Closes #447
2015-04-15 16:44:48 -07:00
Jonathan Reem
e864956734 fix(server): Use thread::spawn instead of thread::scoped. 2015-04-15 13:15:05 -07:00
Sean McArthur
55b37f0148 test(beta): enable testing on beta rustc 2015-04-15 11:59:23 -07:00
Brandon Sanderson
7b7f9c257d feat(net): make HttpStream implement Debug 2015-04-09 16:13:29 -07:00
Brandon Sanderson
2f606c88bd feat(http): Implement Debug for HttpReader/Writer.
Also derives it for Responses, since that's easy now.
2015-04-08 18:03:08 -07:00
Huon Wilson
ca2815effd fix(headers): Content-Encoding needs a hyphen. 2015-04-09 10:15:42 +10:00
Sean McArthur
564288e5c6 Merge pull request #428 from hyperium/client-box
feat(client): remove generic parameter for Connector
2015-04-07 18:26:27 -07:00
Sean McArthur
499a2c8610 Merge pull request #440 from pyfisch/refactorheaders5
refactor(headers): Use header!() for CORS headers.
2015-04-07 12:51:19 -07:00
Sean McArthur
56d72b4351 Merge pull request #439 from pyfisch/refactorheaders4
refactor(headers): Use header!() macro for Upgrade header field
2015-04-07 12:02:39 -07:00
Pyfisch
94f38950dd refactor(headers): Use header!() for CORS headers.
This is the last bunch of headers that should use the new macro. Moved them out of
their own folder so that the macro works. Changed them, so that they are more in
line with the other headers.

BREAKING CHANGE: `AccessControlAllowHeaders` and `AccessControlRequestHeaders` values
are case insensitive now. `AccessControlAllowOrigin` variants are now `Any` and
`Value` to match the other headers.
2015-04-07 11:54:01 +02:00
Pyfisch
831daafb8c style(headers): Remove commented out code in headers. 2015-04-07 11:08:42 +02:00
Pyfisch
f3508d9204 refactor(headers): Use header!() macro for Upgrade header field 2015-04-07 11:07:26 +02:00
Sean McArthur
ed1ccc6ad3 Merge pull request #420 from pyfisch/refactorheaders2
refactor(headers): Use header!() macro for `ETag` header
2015-04-06 13:39:22 -07:00
Pyfisch
38d297b16e refactor(headers): Use header!() macro for 3 headers with a "*" value
`If-Match`, `If-None-Match` and `Vary` headers are either a "*" value meaning that the header
matches every possible item or a list of items, one of them must be matched to fulfil the condition.

BREAKING CHANGE: `If-Match`, `If-None-Match` and `Vary` item variant name changed to `Items`
2015-04-06 20:41:41 +02:00
Pyfisch
4434ea6a7d refactor(headers): Use header!() macro for ETag header
Change `Etag` (only the `E` is capitalized) to `ETag` as it is written
in the relevant RFC.

BREAKING CHANGE: `Etag` header field is now `ETag` header field
2015-04-06 20:41:00 +02:00
Markus Kobler
660a362b68 chore(net): Upgrading to latest rust openssl 0.6.0 2015-04-06 16:18:52 +01:00
Sean McArthur
139a51f1c3 feat(client): remove generic parameter for Connector
Closes #379

BREAKING CHANGE: For people using the default HttpConnector and Client,
    everything should continue to just work. If the Client has been
    used with a generic parameter, it should be removed.

    However, there were some breaking changes to the internals of
    NetworkConnectors. Specifically, they no longer return a
    NetworkStream, but instead a Into<Box<NetworkStream + Send>>. All
    implementations of NetworkStream should continue to just work,
    however.

    Possible breakages could come from the stricter usage of Send
    throughout the Client API.
2015-04-03 18:36:13 -07:00
Jonathan Reem
8e0655637e fix(headers): Add CowStr as a temporary hack to build on beta.
We can revert this PR when rust-lang/rust#23995 lands, but it won't
land until after beta is cut.
2015-04-02 22:33:55 -07:00
Sean McArthur
0a1916dc64 refactor(auth): adjust Scheme::scheme function to not take a marker Option 2015-04-02 17:38:40 -07:00
Sean McArthur
5c2de29a81 chore(stability): remove core feature gate 2015-04-02 17:32:04 -07:00
Jonathan Reem
320d10d50d chore(all): Move downcasting to a stable implementation. 2015-04-02 13:30:41 -07:00
Sean McArthur
ccd4814e69 chore(stability): remove into_cow feature gate 2015-04-02 13:01:49 -07:00
Sean McArthur
0f5858f379 fix(rustup): update to rust beta 2015-04-02 12:56:20 -07:00
Sean McArthur
b4aeeb347c Merge pull request #419 from pyfisch/refactorheaders1
refactor(headers): Introduce header!() macro, improve documentation
2015-04-02 10:34:34 -07:00
Pyfisch
262c450f90 refactor(headers): Introduce header!() macro, improve documentation
The new macro handles single value headers, list headers, and list
headers with at least one item.
It creates the item for the header and contains its documentation. The
new macro allows handling
more header cases in the future, it will also be possible to include
tests inside the macro.

BREAKING CHANGE: Removed impl_header!() and impl_list_header!() macros,
use new header!() macro.
2015-04-02 19:07:53 +02:00
Andreas
841ff483cd docs(mainpage): fix typo 2015-04-01 16:52:49 +03:00
Sean McArthur
dd5ee43750 chore(features): remove feature gate 'alloc' 2015-03-31 18:46:02 -07:00
Sean McArthur
3d47f6fce8 Merge pull request #414 from hyperium/buf-init
fix(buffer): zero out new capacity when buffer grows
2015-03-31 17:07:50 -07:00
Sean McArthur
cfdabd70ec fix(buffer): zero out new capacity when buffer grows 2015-03-31 16:53:24 -07:00
Sean McArthur
ffa1e6235a Merge pull request #413 from pyfisch/httpdate
refactor(header): Implement `HttpDate`, a wrapper for dates
2015-03-31 13:53:09 -07:00
Pyfisch
6cf052bf0f refactor(header): Implement HttpDate, a wrapper for dates
Using `time::Tm` directly in HTTP header fields requires special handling to parse and format
the header values., this stops us from using the header macros. By wrapping `time::Time` in a
`HttpDate`, we can use the `FromStr` and `Display` traits of `HttpDate` like for most other values.

BREAKING_CHANGE: All code using one of the `Date`, `Expires`, `If-Modified-Since`,
`If-Unmodified-Since`, `Last-Modified` header fields needs to wrap `time::Tm`
with `HttpDate`. Removed `FromStr` trait of `Date`, `If-Modified-Sice` and `If-Unmodified-Sice`,
implementing the trait here is inconsistent with other headers.
2015-03-31 17:29:31 +02:00
Sean McArthur
6b2e731123 Merge pull request #410 from hyperium/buf-speed
perf(buffer): pull in std::io::BufReader improvements
2015-03-30 18:07:27 -07:00
Sean McArthur
163ffd6f70 perf(buffer): pull in std::io::BufReader improvements
The results of benches/client.rs are below.

Before:

    running 1 test
    test bench_mock_hyper ... bench:    321609 ns/iter (+/- 18127)

After:

    running 1 test
    test bench_mock_hyper ... bench:    239319 ns/iter (+/- 29938)
2015-03-30 18:01:17 -07:00
Pyfisch
9c21f7f953 feat(entitytag): Add EntityTag comparison, make EntityTag safe to use
Adds strong and weak comparison to EntityTag as described in the RFC,
add tests for this. Make EntityTag safe to use by hiding the tag field,
this prevents users from inserting malicious values for the tag. Invalid
values can screw up header formatting and may allow to insert headers.
Introduce EntityTag::new(), .tag() and .set_tag() methods. Fix Display
trait for EntityTag. DQUOTES were missing. Remove custom formatting in ETag
header. Improve docs.

BREAKING_CHANGE: EntityTag.tag is private, use EntityTag.tag() and
EntityTag.set_tag("foobar") to access it.
2015-03-30 21:36:55 +02:00
Sean McArthur
04e3b56515 fix(buffer): get_buf to not return consumed part of buffer
Closes #406
2015-03-29 21:20:09 -07:00
Florian Hartwig
c9f2c841ff fix(rustup): get rid of slice pattern, add Reflect bounds
* remove slice pattern
* add `Reflect` trait bounds where necessary
2015-03-29 19:28:32 +02:00
Sean McArthur
6c31ea84e1 Merge pull request #401 from hyperium/packets
fix(http): read more before triggering TooLargeError
2015-03-28 11:37:43 -07:00
Jonathan Reem
dbee6af8df refactor(hyper): Remove the box_syntax feature gate. 2015-03-27 13:37:30 -07:00
Sean McArthur
a62323cafe refactor(hyper): remove need for collections feature 2015-03-27 11:50:14 -07:00
Sean McArthur
cb59f609c6 fix(http): read more before triggering TooLargeError
This includes a custom BufReader, since the one in libstd doesn't allow
reading additional data into the buffer without consuming it. This is
required because some connections may send shorter packets, and so we
need to perform multiple reads. After each read, the contents of the
buffer are passed to httparse to see if have a valid message. If so, the
proper amount of bytes are consumed. The additional bytes are left in
the buffer since they are the beginning of the body.

The buffer in this BufReader also grows in size, compared to the libstd
which is sized once. This is because we start with a smaller buffer,
since the majority of messages will be able to include their head in a
packet or 2. Therefore, it's a wasteful performance hit to allocate the
maximum size for every message. However, some headers can be quite big,
and to allow for many of them to be set, we include a maximum size. Once
we've hit the maximum buffer size, and still haven't determined the end
of the headers, a HttpTooLargeError will be returned.

Closes #389
2015-03-27 10:52:07 -07:00
Kevin Butler
eee7a85d3c fix(rustup): static bounds required on Type definition, trivial_casts 2015-03-26 17:02:20 +00:00
Florian Hartwig
3e456f00f9 fix(rustup): rustc 1.0.0-nightly (123a754cb 2015-03-24)
* fix `extern crate` declaration for rustc-serialize
* enable `into_cow` feature
* replace as_slice() calls by as_ref and enable `convert` feature
* use `core` feature in doc tests
2015-03-25 20:55:42 +01:00