Commit Graph

630 Commits

Author SHA1 Message Date
Sergio Benitez 2e54a1f74d Don't use &str where RawStr is now preferred. 2017-04-14 00:43:57 -07:00
Fabrice Desré da1f6264e4 Enable the "tls" feature in the hello_tls example. 2017-04-13 17:38:56 -07:00
Sergio Benitez a25a3c69c6 Cache parsed ContentType and Accept headers.
This is a breaking change. `Request::content_type` now returns a borrow
to `ContentType`. `FromRequest` for `ContentType` is no longer
implemented. Instead, `FromRequest` for `&ContentType` is implemented.
2017-04-13 02:44:47 -07:00
Sergio Benitez e50164115b Only emit TLS disabled error on misconfig. 2017-04-13 01:30:48 -07:00
Sergio Benitez 6f29696b4f Make TLS misconfig an error. Always print launch message. 2017-04-13 01:16:09 -07:00
Sergio Benitez 1516ca4fb6 Initial TLS support.
This commit introduces TLS support, provided by `rustls` and a fork of
`hyper-rustls`. TLS support is enabled via the `tls` feature and
activated when the `tls` configuration parameter is set. A new
`hello_tls` example illustrates its usage.

This commit also introduces more robust and complete configuration
settings via environment variables. In particular, quoted string,
array, and table (dictionaries) based configuration parameters can now
be set via environment variables.

Resolves #28.
2017-04-13 00:18:31 -07:00
Sergio Benitez cf47daa8e1 Return 404 on missing static file in todo example. 2017-04-12 02:58:45 -07:00
Sergio Benitez a2a0aab541 Depend on cookie >= 0.7.4 for ring bugfix. 2017-04-11 16:56:10 -07:00
Sergio Benitez 82ec8ee739 Use bash from env, not /usr/bin. 2017-04-06 22:04:32 -07:00
Sergio Benitez 982997dbad Add Rocket::routes() method to get all routes. Add some internal benchmarks. 2017-04-05 01:19:33 -07:00
Sergio Benitez 5259e3fd5c Disallow invalid form field names. 2017-04-04 17:00:48 -07:00
Sergio Benitez 7c19bf784d Allow form field renaming via #[form(field = "name")] attribute. 2017-04-03 19:06:30 -07:00
Sergio Benitez 351658801e Allow unreachable_code in generated route functions for new ! error types. 2017-04-03 16:46:13 -07:00
Sergio Benitez f5ec470a7d Use the `RawStr` type for raw parameter strings.
This is a breaking change.

The `&str` type no longer implements `FromParam`. The `&RawStr` type
should be used in its place.
2017-03-31 00:18:58 -07:00
Sergio Benitez cff9901940 Implement FromData for Vec<u8>. 2017-03-30 23:17:28 -07:00
Sergio Benitez 0c44e44641 Use the `RawStr` type for all form raw strings.
This is a breaking change.

This commit introduces `RawStr` to forms. In particular, after this
commit, the `&str` type no longer implements `FromFormValue`, and so it
cannot be used as a field in forms. Instad, the `&RawStr` can be used.

The `FormItems` iterator now returns an `(&RawStr, &RawStr)` pair.
2017-03-30 23:06:53 -07:00
Sergio Benitez f57d984e2e New version: 0.2.4. 2017-03-30 19:56:12 -07:00
Sergio Benitez f7bc1ce24f Update codegen for latest nightly. 2017-03-30 19:56:12 -07:00
Sergio Benitez 10306c3b7e Clarify segment handling for '..'. 2017-03-30 18:15:36 -07:00
Sergio Benitez df19ef74db Add RawStr::url_decode. 2017-03-30 18:15:15 -07:00
Sergio Benitez 709acf18a4 Initial implementation of RawStr. 2017-03-30 17:56:24 -07:00
Sergio Benitez b49c89af7a Rename UncasedAscii and UncasedAsciiRef to Uncased and UncasedStr. 2017-03-30 15:38:51 -07:00
Sergio Benitez 301257623c Update diesel and rusqlite example dependencies. 2017-03-30 02:02:09 -07:00
Sergio Benitez dd3c03a83a Use sudo: required to get a VM with higher specs on Travis. 2017-03-30 02:01:49 -07:00
Sergio Benitez d4b9360f57 Remove the '...' in the launch message. 2017-03-30 00:14:45 -07:00
Ryan Leckey ff3193a22a Fix spelling in Method docs: ff -> if. 2017-03-29 23:50:12 -07:00
Sergio Benitez 2e78afbc93 Don't use a cache for Travis to prevent memory exhaustion. 2017-03-29 23:36:54 -07:00
Sergio Benitez cb21fbf6af Small typo: parse -> parsed. 2017-03-29 21:06:15 -07:00
Sergio Benitez 8f997a2a39 Rewrite some markdown for commonmark. 2017-03-29 19:05:49 -07:00
Sergio Benitez 7d48944080 Handle specificity based preferences in Accept. Allow 3 decimals in q parameter. 2017-03-29 18:18:30 -07:00
Sergio Benitez b102a6a497 Implement FromRequest for Accept. 2017-03-29 04:21:18 -07:00
Sergio Benitez c58ca894b7 Initial implementation of content negotiation via `Accept`.
This is a breaking change.

This commit changes the meaning of the `format` route attribute when
used on non-payload carrying requests (GET, HEAD, CONNECT, TRACE, and
OPTIONS) so that it matches against the preferred media type in the
`Accept` header of the request. The preferred media type is computed
according to the HTTP 1.1 RFC, barring a few specificty rules to come.
2017-03-29 04:08:53 -07:00
Sergio Benitez fb29b37f30 Reorganize extra request state. Add 'accept' and 'accept_first' methods to Request. 2017-03-28 03:10:18 -07:00
Sergio Benitez 1fb1cdfc58 Use MediaType instead of ContentType for Route format. 2017-03-28 00:12:59 -07:00
Sergio Benitez 9160483554 A route with unspecified query parameters accepts any.
This is a breaking change. It modifies collisions with respect to query
parameters as well as the default ranking of routes.

A route that does not specify query parameters will now match against
requests with _and without_ query parameters, assuming all other
elements of the route match as well. A route that _does_ specify query
parameters will only match requests with query parameters; this remains
true.

To accommodate this change in the most natural manner possible, the
default rankings of routes have changed as illustrated below:

  |-------------+-------+----------+---------------|
  | static path | query | new rank | previous rank |
  |-------------+-------+----------+---------------|
  | yes         | yes   | -4       | 0             |
  | yes         | no    | -3       | 0             |
  | no          | yes   | -2       | 1             |
  | no          | no    | -1       | 1             |
  |-------------+-------+----------+---------------|

In other words, the most specific routes, with preference for paths over
queries, are ranked highest (lower number).
2017-03-27 03:52:26 -07:00
Sergio Benitez c09644b270 Add the Accept ContentType structure. 2017-03-27 01:53:45 -07:00
Sergio Benitez 13359d4f50 Reformulate ContentType as a wrapper around MediaType. 2017-03-23 22:41:42 -07:00
Sergio Benitez 605e8fdc0e Update Tera to 0.8. 2017-03-23 15:28:49 -07:00
Sergio Benitez d2c49e02c3 Fix 'Response::join' docs. 2017-03-23 03:56:02 -07:00
Sergio Benitez e006f3f83e Spruce up MediaType docs. Use new Pear features in MediaType parser. 2017-03-23 03:28:53 -07:00
Sergio Benitez 09550b6e7c New version: 0.2.3. 2017-03-22 19:47:52 -07:00
Sergio Benitez bf67a32cd9 Update minimum rustc version for codegen. 2017-03-22 18:57:46 -07:00
Sergio Benitez 22062d1bbe Remove spurious new line. 2017-03-22 18:57:14 -07:00
Sergio Benitez ae201b1577 Remove pub_restricted feature: it's stable! 2017-03-21 20:34:01 -07:00
Sergio Benitez 7076ae3c1d Move parsing tests to parse module. 2017-03-21 20:30:56 -07:00
Sergio Benitez d09b4138d9 Implement the (currently unused) MediaType struct. 2017-03-21 02:04:07 -07:00
Sergio Benitez 7808ad1649 Update codegen for latest nightly. 2017-03-20 13:55:40 -07:00
Sergio Benitez ec92046d3a Clarify that rocket::launch doesn't return on success. 2017-03-16 00:51:28 -07:00
Sergio Benitez 65da988962 Return a `LaunchError` from `launch` when launching fails.
This is a (minor) breaking change. If `rocket.launch()` is the last expression
in a function, the return type will change from `()` to `LaunchError`. A simple
workaround that preserves the previous functionality is to simply add a
semicolon after `launch()`: `rocket.launch();`.

resolves #34
2017-03-15 22:10:09 -07:00
Sergio Benitez da157a061d Don't use hyper directly in request tests. 2017-03-15 20:30:07 -07:00