Commit Graph

68 Commits

Author SHA1 Message Date
Sean McArthur
a62323cafe refactor(hyper): remove need for collections feature 2015-03-27 11:50:14 -07: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
Zach Pomerantz
376eaddb88 docs(hyper): Tag docs for reexports 2015-03-24 00:28:52 -07:00
Adrian Heine
1f0bc951c9 fix(rustup): adapt to current rustc
Closes #381.
2015-03-19 09:44:40 +01:00
Sean McArthur
4fd8a6a9dc fix(rustup): update to latest rustc 2015-03-16 12:01:38 -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
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
Sean McArthur
4f5b97fefc fix(rustup): Send changes 2015-02-21 15:05:51 -08:00
Renato Zannon
b47f936525 fix(rustup): update feature flags 2015-02-21 15:05:50 -08:00
Jonathan Reem
3528fb9b01 feat(server): Rewrite the accept loop into a custom thread pool.
This is a modified and specialized thread pool meant for
managing an acceptor in a multi-threaded way. A single handler
is provided which will be invoked on each stream.

Unlike the old thread pool, this returns a join guard which
will block until the acceptor closes, enabling friendly behavior
for the listening guard.

The task pool itself is also faster as it only pays for message passing
if sub-threads panic. In the optimistic case where there are few panics,
this saves using channels for any other communication.

This improves performance by around 15%, all the way to 105k req/sec
on my machine, which usually gets about 90k.

BREAKING_CHANGE: server::Listening::await is removed.
2015-02-14 13:54:57 -08:00
Sean McArthur
db83e0490b chore(rustup): fix std::env changes 2015-02-13 11:19:19 -08:00
Sean McArthur
2afa96c923 chore(rustup): add feature for path 2015-02-12 16:03:56 -08:00
Sean McArthur
d7fe8c307a refactor(headers): switch from MuCell to OptCell
It turns out, we don't need capabilities of MuCell (or even RefCell).
We don't to have sophisticated interior mutability. We don't ever lend
out references that may be mutated later. Instead, if there is no value
to lend, then we generate the value, require interior mutability to save
the value internally, and then we return a reference. We never ever
change a value once it's been generated. It can be changed, but only via
&mut self methods, where we can safely reason about mutability.

This means we don't need keep borrow checking code at runtime, which
helps performance. We also are able to reduce the amount of unsafe
transmutes. The internal API more safely constrains the usage of unsafe,
enforcing our invariants, instead of shotgunning unsafe usage with Refs
and promising we're doing it correctly.

On a machine with lower memory (1GB):

    Before:
    test bench_mock_hyper ... bench:    251772 ns/iter (+/- 128445)

    After:
    test bench_mock_hyper ... bench:    152603 ns/iter (+/- 25928)

On a machine with more memory, weaker CPU:

    Before:
    test bench_mock_hyper ... bench:    129398 ns/iter (+/- 51740)

    After:
    test bench_mock_hyper ... bench:    115935 ns/iter (+/- 28555)

Closes #252
2015-02-06 21:47:29 -08:00
Sean McArthur
3af8b687d4 fix(rustup): switch to unstable features 2015-01-31 12:15:44 -08:00
Christian Stefanescu
f606b6039d fix(rustup): update io import, Writer::write
Make it build with the latest rust-nightly (2015-01-27)

Renamed io import to old_io.
Renamed Writer::write to Writer::write_all
2015-01-28 11:58:45 -08:00
Sean McArthur
b002b6c3f0 fix(log): update to new logging levels 2015-01-27 09:08:01 -08:00
Jonathan Reem
1ebbdedd13 chore(warnings): Allow direct recursion for type enforcement. 2015-01-27 09:08:01 -08:00
Sean McArthur
9e3c94d764 fix(rustup): update to newest fmt trait names and slice syntax 2015-01-23 14:17:19 -08:00
Sean McArthur
f7124bb8e2 rustup: sweeping fixes for all the changes in 1.0-alpha
- Some switches to u64 instead of usize
- For now, allow(unstable)
- use associated types for all the Network stuff
2015-01-10 21:29:27 -08:00
cyderize
122e94c8a6 Update for latest rust
Tracks rust nightly.

7 tests fail -- still finding source
2015-01-10 18:37:10 +11:00
Robin Gloster
da0597510a macro syntax changes 2015-01-07 21:30:03 +01:00
Jonathan Reem
93fcd05b9d Miscellaneous fixes and test updates for all the other changes
- http::LINE_ENDING is now an &'static str
2015-01-06 01:15:47 +01:00
Jonathan Reem
f0fe878ec8 More Rust updates:
- Some stray deriving -> derive changes
- use::{mod} -> use::{self}
- fmt.write -> fmt.write_str

This does not catch the last case of fmt.write_str in the
Show impl of a Header Item. This will need to be changed
separately.
2015-01-05 22:50:10 +01:00
Jonathan Reem
7f3a33f903 #[deriving] -> #[derive] 2015-01-03 20:31:48 +01:00
Sean McArthur
451074b0a6 rust upgrade 2014-12-29 17:42:48 -08:00
Lorenzo Villani
358b3c3a38 Typo: wrapped -> wrapper 2014-12-26 23:21:41 +01:00
Sean McArthur
691c70a380 update str::from_utf8 2014-12-23 12:55:53 -08:00
Jonathan Reem
90925f05ee (fix) Add semicolons at macro invocation sites. 2014-12-20 02:38:03 -08:00
Sean McArthur
8c83a3358e feat(client): add a new Client struct with super powers
- Includes ergonomic traits like IntoUrl and IntoBody, allowing easy
usage.
- Client can have a RedirectPolicy.
- Client can have a SslVerifier.

Updated benchmarks for client. (Disabled rust-http client bench since it
hangs.)
2014-12-14 11:56:39 -08:00
Sean McArthur
0bba6e80ee rust upgrade 2014-12-12 12:24:54 -08:00
Sean McArthur
debebe8fbe rustup 2014-12-06 10:52:00 -08:00
Sean McArthur
e19330326d Merge pull request #161 from hyperium/mucell
refactor(headers): changed from rwlock to mucell underneath
2014-12-02 21:20:52 -08:00
Sean McArthur
d71d6549f7 refactor(headers): changed from rwlock to mucell underneath 2014-11-29 22:06:48 -08:00
Sean McArthur
8071cfa8bf feat(headers): header ergonomics
- Reexports all common::* as header::*
- Most headers implement Deref where it makes sense.

Closes #156
2014-11-29 13:55:50 -08:00
Chris Morgan
8e2255430c Drop the unnecessary dependency on typeable.
See also https://github.com/reem/rust-typeable/issues/3.
2014-11-22 17:20:44 +11:00
Sean McArthur
3cd9b10bcb feat(server): keep-alive!
Internals have been shuffled around such that Request and Reponse are
now given only a mutable reference to the stream, instead of being
allowed to consume it. This allows the server to re-use the streams if
keep-alive is true.

A task pool is used, and the number of the threads can currently be
adjusted by using the `listen_threads()` method on Server.

[breaking-change]
2014-11-20 21:40:55 -08:00
Jakob Gillich
35b7ec132e refactor(status): replace glob with namespaced variants 2014-11-19 22:07:04 +01:00
Kyle Dewey
d7e8b8b117 Now using use along with enums, as per https://github.com/rust-lang/rust/pull/18973. 2014-11-19 22:03:41 +01:00
Tim Kuehn
5605ade5dc impl Error and FromError for HttpError; replace instances of try_io! with try! 2014-11-10 22:59:18 -08:00
Jonathan Reem
928f63c368 Removes intertwining, since it is slow and showing up in profiles
Intertwining was a nice feature, but it slows down hyper significantly,
so it is being removed.

There is some fallout from this, mainly that Incoming has had its type
parameter changed to `<A = HttpAcceptor>` and Handler receiving one
bounded with `A: NetworkAcceptor`.

[breaking-change]

Fixes #112
2014-11-10 17:26:55 -08:00
Sean McArthur
d51657a831 log fixes 2014-11-10 16:28:56 -08:00
Sean McArthur
bb45ac509d some more logging 2014-11-10 16:10:52 -08:00
Sean McArthur
5c224289ec adjustments to Cookie and SetCookie 2014-11-10 12:32:11 -08:00
Stanislav Panferov
a3fc51611f Add cookie_rs as default feature and implement conditional compilation. 2014-11-10 12:31:33 -08:00
Stanislav Panferov
0a624b10e0 Add cookie-rs and use cookie::Cookie in Cookie header. 2014-11-10 12:31:33 -08:00
Gilman Tolle
91a8e03e7a Implemented a typed Authorization header
An Authorization header contains a Scheme. If you have no real scheme,
you can use String as your scheme (Authorization<String>).

This includes the `Basic` scheme built-in.
2014-10-31 18:51:23 -07:00
Sean McArthur
f117ebe367 fix missing_docs lint name 2014-10-31 15:49:53 -07:00
Sean McArthur
0ab52c9009 add bits to deal with Upgrade requests 2014-10-27 20:36:57 -07:00
Sean McArthur
61e18141be fix client requests dropping the query string. fixes #75 2014-10-13 10:16:45 -07:00