Commit Graph

500 Commits

Author SHA1 Message Date
Tshepang Lekhonkhobe
7ddea2791c docs(misc): fix typos caught by codespell 2015-05-06 02:34:07 +02:00
Sean McArthur
9ba074d150 refactor(error): remove redundant parts of error names
The old names followed the old style of including the module name and
"Error" in each variant. The new style is to refer to an error from its
owning module, and variants are now scoped to their enum, so there's no
need to include the enum name in the variant name.

BREAKING CHANGE: The terms `Http` and `Error` have been removed from the Error
  type and its variants. `HttpError` should now be accessed as `hyper::Error`,
  and variants like `HttpIoError` should be accessed as `Error::Io`.
2015-05-05 11:53:09 -07:00
Marko Lalic
c29af72972 feat(method): implement AsRef<str> for Method
This lets us obtain the string representation of the method in a
convenient and efficient manner.
2015-05-04 18:13:31 -07:00
Sean McArthur
a1e59fc6f9 Merge pull request #502 from pyfisch/accesscontrolalloworigin
feat(headers): Allow `null` value in Access-Control-Allow-Origin
2015-05-04 11:13:43 -07:00
Sean McArthur
c238890fa6 Merge pull request #503 from pyfisch/nice2
refactor(headers): Improve docs, fix nits, make formatting faster
2015-05-04 11:11:08 -07:00
Sean McArthur
33146bdbc2 Merge pull request #499 from pyfisch/upgradeprotocol
feat(headers): Parse Upgrade header protocols further
2015-05-04 10:28:55 -07:00
Pyfisch
db4d89189a style(headers): Break lines with over 100 characters 2015-05-03 15:45:11 +02:00
Pyfisch
66d54d03e7 refactor(headers): Improve docs, fix nits, make formatting faster
src/header/parsing.rs now uses unsafe get_unchecked() again, I don't
know why it was removed.
2015-05-03 13:56:32 +02:00
Pyfisch
5e3417145c feat(headers): Allow null value in Access-Control-Allow-Origin
The spec says the header can be either a `*`, `null` or an URL.
Improve docs of header.

BREAKING CHANGE: Add variant to Access-Control-Allow-Origin enum
2015-05-03 11:24:23 +02:00
Pyfisch
f47d11b97b feat(headers): Parse Upgrade header protocols further
Parses protocols into a name and a value part matching the RFC.
An enum contains all registered or known protocols, but contains
an extension variant.

Closes #480

BREAKING CHANGE: Upgrade header Protocol changed.
2015-05-03 10:02:48 +02:00
Sean McArthur
b916a7b18c Merge pull request #501 from pyfisch/from
feat(headers): Add From header field
2015-05-02 13:47:35 -07:00
Sean McArthur
ec13f982fe Merge pull request #500 from pyfisch/acceptranges
feat(headers): Add Accept-Ranges header field
2015-05-02 13:45:56 -07:00
Pyfisch
ce9c4af1e0 feat(headers): Add From header field 2015-05-02 21:18:17 +02:00
Pyfisch
2dbe3f9b9a feat(headers): Add Accept-Ranges header field 2015-05-02 21:11:50 +02:00
Sean McArthur
117fe927ca Merge pull request #493 from pyfisch/nice
refactor(hyper): Fix a few nits
2015-05-02 09:47:07 -07:00
Pyfisch
a6974c99d3 refactor(headers): Fail to parse single value header values
A single value header value can't be "", so `from_one_raw_str()` now
returns `None` on empty values. This makes custom checks in headers
obsolete.

BREAKING CHANGE: `from_one_raw_str()` returns `None` on empty values.
2015-05-02 16:40:53 +02:00
Sean McArthur
8cdb9d5d3b fix(http): keep raw reason phrase in RawStatus
Closes #497
2015-05-01 15:08:48 -07:00
Sean McArthur
6d7ae81e36 Merge pull request #492 from hyperium/header-macro-example
fix(header): make test_module of header! optional
2015-05-01 14:27:55 -07:00
Sean McArthur
a5ce9c59fa fix(header): make test_module of header! optional
Closes #490
2015-05-01 14:27:17 -07:00
Pyfisch
6b59bd28b7 refactor(hyper): Fix a few nits 2015-05-01 11:58:15 +02:00
Sean McArthur
1426a4ce34 Merge pull request #491 from pyfisch/ifrangeheader
feat(headers): Add If-Range header
2015-04-30 15:05:52 -07:00
Pyfisch
a39735f1d3 feat(headers): Add If-Range header
Closes #388
2015-04-30 20:30:47 +02: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
Sean McArthur
1e72a8ab3a feat(client): add a Connection Pool
This adds a connection pool to the Client that is used by default. It
accepts any other NetworkConnector, and simply acts as a
NetworkConnector itself. Other Pools can exist by simply providing a
custom NetworkConnector. This Pool is only used by default if you also
use the default connector, which is `HttpConnector`. If you wish to use
the Pool with a custom connector, you'll need to create the Pool with
your custom connector, and then pass that pool to the
Client::with_connector.

This also adds a method to `NetworkStream`, `close`, which can be used
to know when the Stream should be put down, because a server requested
that the connection close instead of be kept alive.

Closes #363
Closes #41
2015-04-29 12:58:28 -07:00
Pyfisch
14f46035b7 docs(headers): Update documentation of all remaining headers that use macros 2015-04-28 20:31:30 +02:00
Pyfisch
5a8cd31025 docs(headers): Add more docs to conditional headers 2015-04-28 17:38:46 +02:00
Pyfisch
e993f4b544 refactor(headers): Add tests and docs to CORS headers 2015-04-28 09:39:25 +02:00
Pyfisch
f9d75e4dd3 docs(headers): Add examples to Accept* headers 2015-04-28 09:19:35 +02:00
Pyfisch
093a29bab7 fix(headers): Do not parse empty values in list headers.
In empty list header values ``, or list header values with empty items `foo, , bar`,
the empty value is parsed, if the parser does not reject empty values an item is added
to the resulting header. There can't be empty values. Added a test for it in AcceptEncoding.
2015-04-28 08:57:35 +02:00
Pyfisch
621ef521f6 fix(headers): Fix formatting of 0 qualites and formatting of empty list header fields. 2015-04-28 08:46:26 +02:00
Pyfisch
308880b455 feat(headers): Implement Content-Language header field
Closes #475
2015-04-27 21:50:57 +02:00
Sean McArthur
f7f0361626 Merge pull request #479 from mikedilger/ssl_context
Ssl context
2015-04-27 11:17:08 -07:00
Mike Dilger
3a1a24270d feat(server): allow consumer to supply an SslContext
Closes #471
2015-04-27 08:22:10 +12:00
Mike Dilger
fef04d282f refactor(server): make with_listener a free function
Allow a Server to operate without requiring the entire Server struct
to move into the with_listener function (instead only the handler
function needs to move). This, allows other members to not move, or
move separately, which will be needed for the next commit.  See #471
2015-04-27 08:19:31 +12:00
Mike Dilger
1a076d1bc7 feat(net): add https_using_context for user-supplied SslContext 2015-04-27 08:18:11 +12: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
60d92c296a feat(client): remove Clone requirement for NetworkStream in Client 2015-04-23 09:27:41 -07:00
Sean McArthur
e814680b55 Merge pull request #473 from hyperium/docup
Docup
2015-04-22 15:45:09 -07:00
Sean McArthur
48a010ffd7 docs(client): add improved usage examples 2015-04-22 12:28:19 -07:00
Sean McArthur
f9ea2dd594 docs(server): add basic usage example 2015-04-22 12:27:50 -07:00
Sean McArthur
8198f41ec0 docs(lib): add links to main modules 2015-04-22 12:27:33 -07:00
Sean McArthur
e234cbe669 Merge pull request #462 from hyperium/client-ergo
Client ergo
2015-04-21 16:22:22 -07:00
Jonathan Reem
76550fdb20 fix(http): Adjust httparse Request and Response lifetimes. 2015-04-18 20:33:58 -07:00
Jorge Israel Peña
c694b1385b fix(server): JoinHandle type parameter
The new beta adopts the new `JoinHandle` API which has a type parameter.
2015-04-17 14:31:54 -07:00
Sean McArthur
a2aefd9a56 feat(client): accept &String as Body in RequestBuilder
BREAKING CHANGE: This removes the trait `IntoBody`, and instead using
  `Into<Body>`, as it's more idiomatic. This will only have broken code
  that had custom implementations of `IntoBody`, and can be fixed by
  changing them to `Into<Body>`.
2015-04-16 10:25:12 -07:00
Sean McArthur
8bc179fb51 feat(client): accept &String for a Url in RequestBuilder
adds an IntoUrl implementation for &String
2015-04-16 10:10:42 -07:00