Commit Graph

313 Commits

Author SHA1 Message Date
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
Matt McCoy
2983e8dea2 feat(headers): Implementing content-encoding header
Closes #391
2015-03-24 21:57:52 -04:00
Zach Pomerantz
376eaddb88 docs(hyper): Tag docs for reexports 2015-03-24 00:28:52 -07:00
Sean McArthur
996538e105 test(header): add tests for tm_from_str 2015-03-23 10:40:51 -07:00
Sebastian Thiel
f547080df5 fix(rustup): 1.0.0-nightly (e2fa53e59 2015-03-20)
* replace `char_at()` calls with itertor, as suggested by compiler
* fixed comparison in test
2015-03-21 17:02:13 +01:00
Sean McArthur
5d7be77e4a feat(server): use SocketAddrs instead of Ipv4Addrs 2015-03-20 17:32:51 -07:00
Sebastian Thiel
8181de253a fix(rustup): rustc 1.0.0-nightly (ea8b82e90)
This commit fixes `cargo build` and `cargo test`.

Method lookup on traits seems to have changed to force
`impl TraitName` expressions to be more specific. That means that
`method` will not be found anymore on an object of type `&Trait+Send`,
unless you provide an `impl Trait+Send`.

Now `NetworkStream` and `HeaderFormat` trait implementations
are done against `* + Send`, which helps the compiler to find the
respective `downcast*` method implementations once again.
2015-03-20 10:28:35 +01:00
Adrian Heine
1f0bc951c9 fix(rustup): adapt to current rustc
Closes #381.
2015-03-19 09:44:40 +01:00
Sean McArthur
0b7169432b feat(server): add Expect 100-continue support
Adds a new method to `Handler`, with a default implementation of always
responding with a `100 Continue` when sent an expectation.

Closes #369
2015-03-16 15:59:44 -07:00
Sean McArthur
fe8c6d9914 Merge pull request #376 from hyperium/rustup
fix(rustup): update to latest rustc
2015-03-16 14:37:39 -07:00
Sean McArthur
4fd8a6a9dc fix(rustup): update to latest rustc 2015-03-16 12:01:38 -07:00
Nathan Fuchs
99baaa1015 fix(headers): Fix overflow with empty cookies 2015-03-15 23:51:08 -04:00
Sean McArthur
d28bae3c91 refactor(client): remove explicit Send implementations from Request/Response 2015-03-13 19:54:34 -07:00
Sean McArthur
a2c6c4a25e Merge pull request #370 from hyperium/httparse
perf(http): changes http parsing to use httparse crate
2015-03-13 17:58:41 -07:00
Sean McArthur
b87bb20f0c perf(http): changes http parsing to use httparse crate
httparse is a http1 stateless push parser. This not only speeds up
parsing right now with sync io, but will also be useful for when we get
async io, since it's push based instead of pull.

BREAKING CHANGE: Several public functions and types in the `http` module
  have been removed. They have been replaced with 2 methods that handle
  all of the http1 parsing.
2015-03-13 16:56:13 -07:00
Camille TJHOA
602c1e27fd docs(client): fix #357 2015-03-04 13:48:09 +01:00
Simon Bernier St-Pierre
5a6e176f50 fix(header): Fix charset parsing bug. 2015-03-04 00:22:46 -05:00
Sean McArthur
fdc78f8f89 Merge pull request #358 from hyperium/reparsing
feat(headers): adds re-parsing ability when getting typed headers
2015-03-03 20:47:47 -08:00
Hugo Duncan
180d9a92d9 feat(headers): add enum for Charset
Make Charset more strongly typed.
2015-03-03 20:46:41 -08:00
Hugo Duncan
235089a103 feat(headers): add AcceptCharset header
Adds support for the Accept-Charset header.  Encodes the charset as a
string.
2015-03-03 20:38:02 -08:00
Sean McArthur
d68773c79f feat(headers): add q function to ease creating Quality values 2015-03-03 19:32:37 -08:00
Sean McArthur
df756871ed feat(headers): adds re-parsing ability when getting typed headers
BREAKING CHANGE: added requirement that all HeaderFormat implementations
  must also be fmt::Debug. This likely as easy as slapping
  #[derive(Debug)] on to any custom headers.
2015-03-03 18:51:29 -08:00
Sean McArthur
0fd6fcd7c7 feat(hyper): switch to std::io, std::net, and std::path.
All instances of `old_io` and `old_path` were switched to use the new
shiny `std::io`, `std::net`, and `std::path` modules. This means that
`Request` and `Response` implement `Read` and `Write` now.

Because of the changes to `TcpListener`, this also takes the opportunity
to correct the method usage of `Server`. As with other
languages/frameworks, the server is first created with a handler, and
then a host/port is passed to a `listen` method. This reverses what
`Server` used to do.

Closes #347

BREAKING CHANGE: Check the docs. Everything was touched.
2015-03-03 14:32:03 -08:00
Pyfisch
8f6ce453de refactor(headers): Use u16 based newtype for quality value
Using floating point numbers is problematic because comparison is inexact.
They also take more space than integral numbers in this case.

Add `FromPrimitve`, `ToPrimitive` and `Default` traits to quality newtype.

Closes: #330

BREAKING_CHANGE: Replace f32 quality values in quality items with a
Quality(u16) newtype. Valid values are from 0 to 1000.
2015-02-28 19:44:34 +01:00
Robin Gloster
1b6e6a040f fix(rustup): str.split and associated type changes 2015-02-27 13:33:21 +01:00
filsmick (Yohaï Berreby)
4f576780c2 feat(headers): add remove_raw method and corresponding test
It was previously impossible to remove a header set by set_raw()

Closes #326
2015-02-22 16:16:39 +01:00
Sean McArthur
4f5b97fefc fix(rustup): Send changes 2015-02-21 15:05:51 -08:00
Renato Zannon
98b8c4b137 fix(rustup): CowString is gone 2015-02-21 15:05:51 -08:00
Renato Zannon
598d8f93e4 fix(rustup): Extend now takes an IntoIterator 2015-02-21 15:05:51 -08:00
Renato Zannon
1904c4561f fix(rustup): Add PhantomData markers to phantom type users
Necessary since [RFC 738](https://github.com/rust-lang/rfcs/blob/master/text/0738-variance.md).
2015-02-21 15:05:50 -08:00
Renato Zannon
039e984f68 fix(rustup): Remove uses of the obsolete &a[] syntax 2015-02-21 15:05:50 -08:00
Renato Zannon
234fcdc3a2 fix(rustup): Fix signature of IntoCow 2015-02-21 15:05:50 -08:00
Renato Zannon
b0a72d80d0 feat(server): make AcceptorPool::accept() block and allow non'-static data
Change AcceptorPool to not spawn detached threads anymore. This,
together with the recent `Send` changes, allows the `work` closure to
close over non-`'static` data.

This doesn't change the high-level `Server` interface, because that
would make it's `listen` a blocking call (it's currently non-blocking)
- which would be a breaking change.
2015-02-21 15:05:50 -08:00
Renato Zannon
b47f936525 fix(rustup): update feature flags 2015-02-21 15:05:50 -08:00
Renato Zannon
fc2076cd53 fix(rustup): use module-level thread functions 2015-02-21 15:05:50 -08:00
Renato Zannon
f4a66b38cb fix(rustup): update lifetime bounds
Send no longer implies 'static; update needed lifetime bounds.
2015-02-21 15:05:50 -08:00
Renato Zannon
e246c3ace8 fix(headers): use $crate when referring to hyper modules on macros
This adds a $crate variable missed by de1be6726

Closes #323
2015-02-19 19:23:11 -02:00
Sean McArthur
e8529b3b98 Merge pull request #321 from pyfisch/refactorheaders
refactor(headers): Use macros for headers where possible
2015-02-17 08:46:03 -08:00
Pyfisch
de1be67262 refactor(headers): Use macros for headers where possible 2015-02-17 12:14:04 +01:00
Jonathan Reem
51bf1122dd Merge pull request #319 from pyfisch/partialordqualityitem
feat(headers): Implement PartialOrd for QualityItem
2015-02-15 14:30:43 -08:00
Pyfisch
2859d7ef4e feat(headers): Implement PartialOrd for QualityItem
PartialOrd is useful to sort Collections of QualityItems by quality.
So you can find the preferred match easier.

Closes #314
2015-02-15 18:01:03 +01:00
Sean McArthur
f8776f4c24 Merge pull request #312 from reem/acceptor-pool
feat(server): Rewrite the accept loop into a custom thread pool.
2015-02-14 17:49:25 -08:00
Sean McArthur
27b4573db1 Merge pull request #299 from hugoduncan/feature/add-accept-language
feat(headers): add AcceptLanguage header
2015-02-14 16:09:36 -08:00