Commit Graph

68 Commits

Author SHA1 Message Date
Sean McArthur
a5ce9c59fa fix(header): make test_module of header! optional
Closes #490
2015-05-01 14:27:17 -07:00
Sebastian Thiel
2bc5a779bd fix(header): exporting test_header! macro
That way, third-parties can keep using the `header!` macro, which
now requires the `test_header!` macro as well.

Considering the `header!` macro is exported and part of the public
API, it was not desired to prevent it's usage in any way.
2015-04-30 11:05:21 +02:00
Pyfisch
14f46035b7 docs(headers): Update documentation of all remaining headers that use macros 2015-04-28 20:31:30 +02:00
Pyfisch
308880b455 feat(headers): Implement Content-Language header field
Closes #475
2015-04-27 21:50:57 +02:00
Pyfisch
a27e6812b9 test(headers): Add tests for single value headers. 2015-04-26 19:16:44 +02:00
Pyfisch
6d34448043 test(headers): Test if formatting gives back the same header 2015-04-26 15:49:34 +02:00
Pyfisch
76a4a01348 test(headers): Add tests for possibly empty list headers. 2015-04-26 14:32:10 +02:00
Pyfisch
18f717fcf1 test(headers): Add tests for headers with "*" value 2015-04-26 14:06:46 +02:00
Pyfisch
efd6c96a3c test(headers): Allow tests inside list header macros, add tests.
Adds test cases from the relevant RFCs for a few headers.
See also: #468, do we want the test cases rendered as examples in the docs?
2015-04-26 12:56:09 +02:00
Sean McArthur
55b37f0148 test(beta): enable testing on beta rustc 2015-04-15 11:59:23 -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
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
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
Matt McCoy
2983e8dea2 feat(headers): Implementing content-encoding header
Closes #391
2015-03-24 21:57:52 -04: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
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
Renato Zannon
039e984f68 fix(rustup): Remove uses of the obsolete &a[] syntax 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
Hugo Duncan
20a585e30b feat(headers): add AcceptLanguage header
Adds header support for Accept-Language, using a struct for the primary
and sub components of the language.
2015-02-14 18:24:52 -05:00
Hugo Duncan
5df06d4465 feat(headers): add IfMatch header
Add support for the If-Match http header.
2015-02-14 11:59:31 -08:00
Fernando Mendez
318b067a06 feat(headers): Add If-None-Match header field
Add the HTTP/1.1 `If-None-Match` header field makes the request method conditional
on a recipient cache or origin server either not having any current
representation of the target resource, when the field-value is "*",
or having a selected representation with an entity-tag that does not
match any of those listed in the field-value.

Closes #238
2015-02-07 16:52:12 -04:00
Hugo Duncan
b5543b6752 feat(headers): add IfUnmodifiedSince header
This adds support for the If-Unmodified-Since header, and is a trivially
edited version of IfModifiedSince.
2015-02-06 18:42:52 -05:00
Sean McArthur
e5417b834b Merge pull request #271 from pyfisch/cookie
refactor(headers): Rename `Cookies` header to `Cookie`
2015-01-26 10:35:34 -08:00
Pyfisch
92f43cf873 refactor(headers): Rename Cookies header to Cookie
`Cookie` is the actual name of the header and since all other header structs
use the exact camel-cased version of their name using a different name here
is very inconvienient and confusing. You will encounter weird errors if you
try to use `Cookie` as the header. For this reason rename `Cookies` as
discussed on IRC with @seanmonstar and @reem and use `CookiePair` for real
cookies.

BREAKING CHANGE: Change header `Cookie` to `Cookie`
2015-01-26 17:10:36 +01:00
Pyfisch
767c95d2b9 feat(headers): Add Pragma header field
Add the HTTP/1.0 `Pragma` header field used to prevent older Caches, that
do not understand the `Cache-Control` header field from caching the ressource.

Closes #237
2015-01-24 15:09:59 +01: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
8215889eda refactor(headers): remove marker from header_name method
It is no longer required, as we can use `<H as Header>::header_name()`.

BREAKING CHANGE: Implementations of Header will need to adjust the
    header_name method. It no longer takes any arguments.
2015-01-22 15:20:38 -08:00
Jason N
e43c35c1ca fix(headers): make Schemes, Basic, Protocol public
Expose Authorization header Scheme trait and Basic authorization
Expose the Upgrade header Protocol
2015-01-22 14:26:51 +11:00
ProtectedMode
115f56adf9 refactor(headers): make CacheDirective public 2015-01-21 21:43:38 +00: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
7a5813b4b2 Merge pull request #235 from kstep/referer-header
Add `Referer` header definition
2015-01-19 15:45:18 -08:00
Pyfisch
dfa5e69d7c refactor(headers): add header macros and add two example uses
Add `impl_header!` and `impl_list_header!` macros. Rewrite `Accept-Encoding`
and `Server` header implementations to use the new macros.
2015-01-15 19:26:33 +01:00
Konstantin Stepanov
df857aa3f8 add referer header definition 2015-01-11 02:19:29 +03:00
cyderize
122e94c8a6 Update for latest rust
Tracks rust nightly.

7 tests fail -- still finding source
2015-01-10 18:37:10 +11:00
Pyfisch
c228a5506a Worked on Access-Control-* header family. 2015-01-06 22:04:35 +01:00
Pyfisch
0f781efd7b Merge branch 'master' into accesscontrol 2015-01-06 20:37:23 +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
Pyfisch
60ada12b3c Added AccessControl* family of headers.
Fixes #169
2015-01-04 12:04:32 +01:00
Pyfisch
76126fc6c7 feat(headers): adds Accept
Moved utils to shared/. Added quality_value.
2015-01-03 11:06:38 -08:00
Jonathan Reem
90925f05ee (fix) Add semicolons at macro invocation sites. 2014-12-20 02:38:03 -08:00
Rohan Prinja
258e739ef8 add vary header, first draft 2014-12-12 19:12:55 +05:30
Rohan Prinja
4bae6b7e0e add allow header 2014-12-11 00:18:32 +05:30
Sean McArthur
514f96e9eb Merge pull request #180 from wenderen/etag-header
add etag header
2014-12-07 23:48:10 -08:00
Rohan Prinja
c4efa80fb5 add etag header 2014-12-08 13:08:53 +05:30
Corey Richardson
6d91693a41 Add missing reexport 2014-12-07 18:51:50 -05:00
Corey Richardson
e2d387d118 header: add If-Modified-Since support 2014-12-07 18:48:05 -05:00