Commit Graph

107 Commits

Author SHA1 Message Date
Sean McArthur
f36c6b255f feat(client): proper proxy and tunneling in Client
Closes #774
2016-05-02 12:33:49 -07:00
Erick Tryzelaar
63608c49c0 fix(examples): "cargo test --features serde-serialization" 2015-08-31 21:49:27 -07:00
Sean McArthur
53bba6eb7f feat(ssl): redesign SSL usage
BREAKING CHANGE: Server::https was changed to allow any implementation
  of Ssl. Server in general was also changed. HttpConnector no longer
  uses SSL; using HttpsConnector instead.
2015-06-20 14:58:58 -07:00
Sean McArthur
64e47b4bbd feat(client): impl Sync for Client
Connector::connect already used &self, and so would require
synchronization to be handled per connector anyway. Adding Sync to the
Client allows users to setup config for a Client once, such as using a
single connection Pool, and then making requests across multiple
threads.

Closes #254

BREAKING CHANGE: Connectors and Protocols passed to the `Client` must
  now also have a `Sync` bounds, but this shouldn't break default usage.
2015-06-12 11:19:54 -07:00
Sean McArthur
71ac65da5b refactor(http): move h1 and h2 into http module 2015-06-02 12:24:56 -07:00
Marko Lalic
6504936023 docs(examples): add an example using an HTTP/2 client 2015-06-02 15:44:12 +02:00
Sean McArthur
c2938fb45f feat(header): add Connection::close() and ::keep_alive() constructors 2015-05-11 19:14: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
d5558b687d feat(server): add Response.send to write a sized body
Closes #446
2015-05-07 11:03:45 -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
Sean McArthur
a5ce9c59fa fix(header): make test_module of header! optional
Closes #490
2015-05-01 14:27:17 -07:00
Sean McArthur
5d7be77e4a feat(server): use SocketAddrs instead of Ipv4Addrs 2015-03-20 17:32:51 -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
a9887c87f2 test(examples): fix warnings in examples 2015-03-03 21:05:52 -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
Renato Zannon
039e984f68 fix(rustup): Remove uses of the obsolete &a[] syntax 2015-02-21 15:05:50 -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
Corey Farwell
00e46d7cda chore(examples): Stop using deprecated std::os::args in example
As per this compiler warning

"warning: use of deprecated item: use std::env::args() instead, #[warn(deprecated)] on by default"
2015-02-11 23:11:14 -05:00
Sean McArthur
05a3a6b70b fix(rustup): fix unused_feature warning in example server 2015-02-01 20:39:09 -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
Pyfisch
8d0e5bc302 refactor(headers): export all headers and utils directly under header
Currently headers are exported at many places. For example you can access
`Transfer-Encoding` header at `header`, `header::common` and
`header::common::transfer_encoding`. Per discussion on IRC with
@seanmonstar and @reem, all contents of headers will be exposed at `header`
directly. Parsing utilities will be exposed at `header::parsing`. Header
macros can now be used from other crates.

This breaks much code using headers. It should use everything it needs
directly from `header::`, encodings are exposed at `header::Encoding::`,
connection options are exposed at `header::ConnectionOption`.
2015-01-20 13:04:42 +01: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
Aaron Weiss
be6cc34caf Server programs no longer exit immediately. 2014-12-21 16:23:48 -05:00
Jonathan Reem
618f95e10a (fix) Update examples and benchmarks to remove rust-http. 2014-12-20 03:07:05 -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
fec030a21e rust upgrade 2014-12-02 13:12:04 -08:00
Sean McArthur
07cf414e17 fix(logging): adjust several logging messages
Closes #148
2014-11-28 18:03:37 -08: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
f3e1baea9f fix(http): is_valid_method expects &-ptr 2014-11-19 22:07:11 +01:00
Jakob Gillich
0020ad1e97 TaskPool updates 2014-11-17 20:10:16 +01:00
Sean McArthur
3c10a8a191 feat(server): change Incoming to iterator over Connections
A connection is returned from Incoming.next(), and can be passed to a
separate thread before any parsing happens. Call conn.open() to get a
Result<(Request, Response)>.

BREAKING CHANGE
2014-11-10 13:55:11 -08:00
Jonathan Reem
a69b5ae166 Add a simple threaded hello world example. 2014-11-07 15:52:28 -08:00
Jonathan Reem
60af7c4565 (fix) fail! to panic! 2014-10-30 01:08:46 -07:00
Michael Hart
262a1658cf Remove debug crate
This fixes errors with latest 0.13.0-nightly as crate has been removed:

`error: can't find crate for ‘debug’`
2014-10-18 18:39:03 -04:00
Sean McArthur
e6329af74e Slice was changed to AsSlice in libstd 2014-10-13 18:37:14 -07:00
Sean McArthur
2f755a5694 move rendering of headers to the Headers object 2014-10-13 14:32:48 -07:00
Jonathan Reem
4115c0e219 Moved WriteStatus, Fresh, and Streaming in to the net module. 2014-09-10 17:16:13 -07:00
Jonathan Reem
d5c6f33c34 Update the client API to statically track headers and move constructors
The client Request now uses the same system as a server Response to track
the write status of headers, and the API has been updated accordingly.

Additionally, the Request constructors have been moved onto the Request object
instead of being top-level hyper functions, as this better namespaces the
client and Server.
2014-09-10 17:04:49 -07:00
Jonathan Reem
cfd5cf3c68 Split Server::listen into two methods to hack around ICE related to default type params
Trying to default the type parameters leads to an ICE and strange type errors.
I think this is just due to the experimental state of default type params and
this change can be rolled back when they are fixed.
2014-09-10 12:48:43 -07:00
Jonathan Reem
76a58940d8 Use trait objects and dynamic dispatch to abstract over NetworkStream
Server and client benchmarks show that this makes very little difference
in performance and using dynamic dispatch here is significantly more ergonomic.

This also bounds NetworkStream with Send to prevent incorrect implementations.

Allows the implementation of mock streams for testing and flexibility.

Fixes #5
2014-09-09 17:05:59 -07:00
Sean McArthur
0285fc2acc Abstract out NetworkStream
This introduces a new Trait, NetworkStream, which abstracts over
the functionality provided by TcpStream so that it can be easily
mocked and extended in testing and hyper can be used for
other connection sources.
2014-09-09 14:55:14 -07:00
Jonathan Reem
622a18cd37 Fix concurrent server example for new Response representation. 2014-09-08 18:34:29 -07:00
Sean McArthur
e32845cefb Merge pull request #19 from reem/static-response-states
Statically track the status of a Response by using a Phantom Type
2014-09-08 18:27:13 -07:00