Commit Graph

68 Commits

Author SHA1 Message Date
Stanislav Panferov
6a8864cc27 Add more functions for client to work with cookies. Fixes #155. 2014-12-03 00:33:25 +03:00
Sean McArthur
fec030a21e rust upgrade 2014-12-02 13:12:04 -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
Sean McArthur
07cf414e17 fix(logging): adjust several logging messages
Closes #148
2014-11-28 18:03:37 -08:00
Sean McArthur
ed6faceec3 Merge pull request #154 from retep998/master
Update to latest Rust
2014-11-28 16:02:22 -08:00
Dawid Ciężarkiewicz
db72cb5187 Fix HeaderFormatter.
Issue #157
2014-11-28 03:49:40 -08:00
Peter Atashian
00a76cee03 Update to latest Rust
Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-11-28 02:22:21 -05:00
Sean McArthur
4263a01f1c convert to using Cow 2014-11-27 12:13:07 -08:00
Sean McArthur
febf7d16ef feat(headers): headers.iter() is more powerful
Previously, iter() returned (&str, HeaderView), which wasn't too useful
other than to write out to a stream. Checking for a certain header is
painful since header names are case-insensitive, but &str isn't. And
once found, you still couldn't do anything with a HeaderView other
format it.

Now, iter() returns a HeaderView, with methods is(), name(), and
value(). You can do `view.is::<ContentType>()` to check what header it
is. And you get the typed value out by calling
`view.value::<ContentType>()`, which will return an
`Option<ContentType>`, similar to `headers.get()`.

Headers also now implement Extend and FromIterator, so it's easier to
build new Headers objects by filtering out a few headers.

Because this changes .iter() to return HeaderView instead of a tuple,
this is a:

[breaking-change]
2014-11-24 22:25:06 -08:00
Till Hoeppner
8bb5f0420b Fix for ASCII_LOWER_MAP visibility and deprecation warnings 2014-11-24 21:19:46 +01:00
Austin Bonander
34203aa608 Fix compile error 2014-11-24 02:13:35 -08:00
Jonathan Reem
c79e6f0aa5 feat(headers): Added a HeaderFormatter for getting the HTTP representation of a header. 2014-11-23 22:30:26 -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
Jonathan Reem
368e46d3d9 Merge pull request #118 from hyperium/headers-clone
make Headers implement Clone
2014-11-21 05:16:38 -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
Jonathan Reem
dbfcd1ecfc (fix) Replace find_equiv with a lifetime transmute. 2014-11-19 14:52:49 -08: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
Sean McArthur
7e55506134 move other header parse utils to util module 2014-11-19 10:08:07 -08:00
Sean McArthur
14d3209a72 make Headers implement Clone 2014-11-17 11:19:07 -08:00
Jakob Gillich
125e1f7d63 std::from_str has been moved to std::str 2014-11-17 20:09:53 +01:00
Jakob Gillich
7de67e62f3 fix(time): The time crate has moved to out-of-tree.
This adds a dependency on the time crate found in rust-lang/time
and fixes a field rename from tm_gmtoff to tm_utcoff.

add time dependency

tm_gmtoff has been renamed to tm_utcoff
2014-11-13 13:47:20 -08:00
Sean McArthur
d5982378d1 Merge pull request #111 from reem/header-benchmarks
Add benchmarks for all implemented headers except set-cookie.
2014-11-10 16:44:42 -08:00
Jonathan Reem
d4312c8fe8 Add benchmarks for all implemented headers except set-cookie. 2014-11-10 16:32:30 -08:00
Jonathan Reem
18f5e89432 Add bench_header for benchmarking header implementations. 2014-11-10 16:32:09 -08:00
Sean McArthur
bb45ac509d some more logging 2014-11-10 16:10:52 -08:00
Sean McArthur
fcfb0505dd update to newest cookie-rs 2014-11-10 12:33:29 -08:00
Sean McArthur
33210641f7 use Vec::with_capacity(raw.len()) for Cookies 2014-11-10 12:32:11 -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
20f156c592 Build SetCookie from CookieJar 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
Stanislav Panferov
a85cc476e1 Basic Cookie and Set-Cookie (only parsing) headers implementation. 2014-11-10 12:31:33 -08:00
Sean McArthur
caab60e374 Merge pull request #94 from hyperium/authorization
Implemented a typed Authorization header
2014-11-08 20:55:08 -08:00
Hanno Braun
ab9c4f99b8 Make Connection usable
Connection's only field was private, making it impossible to construct a
Connection.
2014-11-08 22:51:28 +01:00
Jakob Gillich
02e72bb2be hash_map find has been renamed to get, remove returns an option 2014-11-07 17:45:48 +01:00
Sean McArthur
30534c27c9 dont convert Date to utc if already utc
Part of #98
2014-11-06 17:59:39 -08:00
Michael Hart
1acf567061 Update hash_map and fmt usages
Depends on https://github.com/carllerche/curl-rust/pull/24 and
https://github.com/chris-morgan/rust-http/pull/167
2014-11-04 12:34:35 -05:00
Jamie Turner
f88837f172 Add len() test with redundant header. 2014-11-03 21:08:55 -08:00
Jamie Turner
14687ad6d2 Re-add len() and clear() as inherent Headers methods. 2014-11-03 21:06:30 -08:00
Jamie Turner
bef7da153c Remove collections trait implementations.
Rust has removed them due to collections reform RFC:

RFC: https://github.com/rust-lang/rfcs/pull/235/files
Commit:
21ac985af4
2014-11-03 18:30:16 -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
3cd7d72b07 split NetworkStream::connect to NetworkConnector 2014-10-31 15:49:26 -07:00
Jonathan Reem
0652858dbf Update all common headers for the new Header trait split 2014-10-31 15:10:34 -07:00
Jonathan Reem
00bc001e59 Split Header into Header and HeaderFormat
Header contains all of the trait-object unsafe methods
including the name of the header and parsing. HeaderFormat
contains fmt_header, which is the only trait-object safe
method.
2014-10-31 15:09:42 -07:00
Sean McArthur
3dd61b4600 Merge pull request #59 from hyperium/upgrade
add bits to deal with Upgrade requests
2014-10-31 10:34:02 -07:00
Sean McArthur
0ab52c9009 add bits to deal with Upgrade requests 2014-10-27 20:36:57 -07:00
Sean McArthur
8cf8d5ac03 add Headers.set_raw, remove unsafe from .get_raw
Internal representation was changed from an enum back to a Struct again.
The raw representation *has* to stick around, even if parsed as a proper
typed header. The reason is that internally, hyper will access some
headers to know which parts of the http protocol to follow (such as if
the response has a length or is chunked). The raw value may still be
needed afterwards, such as for a DOM binding of
.getAllResponseHeaders().

Since the raw is kept around, the unsafety of get_raw is no longer true,
and so that is removed.

It's still more ergonomic to access the types, and safer as well, so
that is recommended when possible.
2014-10-27 17:58:21 -07:00
Sean McArthur
19045a2376 change Host header to have hostname and port 2014-10-22 18:29:49 -07:00
Gilman Tolle
5615ab276e Exposed the 'from_one_raw_str' function for use in defining new header structs. 2014-10-15 23:40:40 -07:00
Sean McArthur
2f755a5694 move rendering of headers to the Headers object 2014-10-13 14:32:48 -07:00