Commit Graph

262 Commits

Author SHA1 Message Date
Sergio Benitez 8e8fb4cae8 Allow ignored route path segments.
Co-authored-by: timokoesters <timo@koesters.xyz>
2020-10-30 00:06:39 -07:00
Sergio Benitez bbfe2ba5cc Point all docs and doc links to 'master' branch. 2020-10-21 04:54:24 -07:00
est31 b18cd6460e Add AVIF (image/avif) as a known media type. 2020-10-20 20:40:18 -07:00
Sergio Benitez 1fb061496d Revamp configuration.
This commit completely overhauls Rocket's configuration systems, basing
it on the new Figment library. It includes many breaking changes
pertaining to configuration. They are:

  * "Environments" are replaced by "profiles".
  * 'ROCKET_PROFILE' takes the place of 'ROCKET_ENV'.
  * Profile names are now arbitrary, but 'debug' and 'release' are given
    special treatment as default profiles for the debug and release
    compilation profiles.
  * A 'default' profile now sits along-side the meta 'global' profile.
  * The concept of "extras" is no longer present; users can extract any
    values they want from the configured 'Figment'.
  * The 'Poolable' trait takes an '&Config'.
  * The 'secrets' feature is disabled by default.
  * It is a hard error if 'secrets' is enabled under the 'release'
    profile and no 'secret_key' is configured.
  * 'ConfigBuilder' no longer exists: all fields of 'Config' are public
    with public constructors for each type.
  * 'keep_alive' is disabled with '0', not 'false' or 'off'.
  * Inlined error variants into the 'Error' structure.
  * 'LoggingLevel' is now 'LogLevel'.
  * Limits can now be specified in SI units: "1 MiB".

The summary of other changes are:

  * The default config file can be configured with 'ROCKET_CONFIG'.
  * HTTP/1 and HTTP/2 keep-alive configuration is restored.
  * 'ctrlc' is now a recognized config option.
  * 'serde' is now a core dependency.
  * TLS misconfiguration errors are improved.
  * Several example use '_' as the return type of '#[launch]' fns.
  * 'AdHoc::config()' was added for simple config extraction.
  * Added more documentation for using 'Limits'.
  * Launch information is no longer treated specially.
  * The configuration guide was rewritten.

Resolves #852.
Resolves #209.
Closes #1404.
Closes #652.
2020-10-20 19:21:56 -07:00
Sergio Benitez 5615767ca6 Add proper 'cfg' to 'get_private_pending()'. 2020-10-15 00:46:30 -07:00
Sergio Benitez 5cf249581f Add 'const' constructor for 'MediaType'. 2020-10-14 23:54:37 -07:00
Sergio Benitez 5d9035ddc1 Keep an op-log for sync 'CookieJar'.
In brief, this commit:

  * Updates to the latest upstream 'cookie', fixing a memory leak.
  * Make changes to 'CookieJar' observable only through 'pending()'.
  * Deprecates 'Client::new()' in favor of 'Client::tracked()'.
  * Makes 'dispatch()' on tracked 'Client's synchronize on cookies.
  * Makes 'Client::untracked()' actually untracked.

This commit updates to the latest 'cookie' which removes support for
'Sync' cookie jars. Instead of relying on 'cookie', this commit
implements an op-log based 'CookieJar' which internally keeps track of
changes. The API is such that changes are only observable through
specialized '_pending()' methods.
2020-10-14 21:37:16 -07:00
Sergio Benitez 092e03f720 Generate a proxy structure for better namespacing.
Prior to this commit, it was impossible to 'use' a route from a separate
namespace for use in a 'routes!' macro. Naturally, this was a common
source of confusion amongst users. This commit obviates this deficiency
by generating a "proxy" structure that can be imported and converted
into a 'Route'/'Catcher' or their static variants.

This change is largely backwards compatible but can break existing code
when routes are named identically to other types in the namespace.
2020-10-12 22:11:44 -07:00
Sergio Benitez adbf1caab2 Migrate to upstream 'uncased'. 2020-09-11 01:13:55 -07:00
Sergio Benitez 52320020bc Use thread-safe 'CookieJar's.
The user-facing changes effected by this commit are:

  * The 'http::Cookies<'_>' guard is now '&http::CookieJar<'_>'.
  * The "one-at-a-time" jar restriction is no longer imposed.
  * 'CookieJar' retrieval methods return 'http::CookieCrumb'.
  * The 'private-cookies' feature is now called 'secrets'.
  * Docs flag private cookie methods with feature cfg.
  * Local, async request dispatching is never serialized.
  * 'Client::cookies()' returns the tracked 'CookieJar'.
  * 'LocalResponse::cookies()' returns a 'CookieJar'.
  * 'Response::cookies()' returns an 'impl Iterator'.
  * A path of '/' is set by default on all cookies.
  * 'SameSite=strict' is set by default on all cookies.
  * 'LocalRequest::cookies()' accepts any 'Cookie' iterator.
  * The 'Debug' impl for 'Request' prints the cookie jar.

Resolves #1332.
2020-08-16 02:19:45 -07:00
Sergio Benitez 45b4436ed3 Add default catchers: '#[catch(default)]'.
The bulk of the changes in this commit are for creating an
'ErrorHandler' trait that works like the 'Handler' trait, but for
errors. Furthermore, Rocket's default catcher now responds with a JSON
payload if the preferred 'Accept' media type is JSON.

This commit also fixes a bug in 'LocalRequest' where the internal
'Request' contained an correct 'URI'.
2020-07-30 01:55:41 -07:00
Sergio Benitez e531770989 Make URI modifications to 'Route' codegen-safe.
This commit aims to make it impossible to modify a 'Route' structure in
a way that violates expectations of a code-generated 'Route'. It removes
'Route::set_uri()' in favor of 'Route::map_base()', which allows for
safe modifications of the route's base.

In a similar vain, this commit also includes the following changes:

  * 'Route::path()' was added to safely retrieve the route's 'path'.
  * The base of a 'Route' is underlined during launch printing.
  * 'Origin::into_normalized()' replaces 'Origin::to_normalized()'.

Fixes #1262.
2020-07-29 16:38:24 -07:00
Necmettin Karakaya fde6eda915 Fix various typos throughout the codebase. 2020-07-22 12:56:01 -07:00
Sergio Benitez 67efe143c5 Improve diagnostics, especially on stable. 2020-07-21 15:31:42 -07:00
Sergio Benitez 95a4b442cc Update Pear to 0.2. 2020-07-21 15:11:07 -07:00
Jeb Rosen fb42bf9ee2 Upgrade 'tokio-rustls' to 0.14. 2020-07-21 10:54:07 -07:00
Jakub Wieczorek 6f1cefff10 Upgrade 'percent-encoding' to 2.
Co-authored-by: Jeb Rosen <jeb@jebrosen.com>
2020-07-21 10:54:07 -07:00
Sergio Benitez 62355b424f Remove use of stable 'proc_macro_hygiene' feature. 2020-07-11 10:48:08 -07:00
Sergio Benitez 824de061c3 Enable configurable 'ctrl-c' shutdown by default.
This removes the 'ctrl_c_shutdown' feature opting instead for a 'ctrlc'
configuration option. To avoid further merge conflicts with the master
branch, the option is currently read as an extra.

Co-authored-by: Jeb Rosen <jeb@jebrosen.com>
2020-07-11 09:24:30 -07:00
Sergio Benitez 3ced188f7d Use 'ref-cast' for safer transparent casting. 2020-07-11 09:24:30 -07:00
Sergio Benitez c0c6c79a7f Use 'async_trait' for 'Responder'.
Also:

  * Remove 'response::ResultFuture'.
  * Re-export 'tokio' and 'futures' from the crate root.
  * Make 'ResponseBuilder::sized_body()' and 'async fn'.
  * Remove the 'Future' implementation for 'ResponseBuilder'.
  * Add 'ResponseBuilder::finalize()' for finalizing the builder.
2020-07-11 09:24:29 -07:00
Sergio Benitez 431b963774 Use 'async_trait' for 'FromRequest'.
Removes 'FromRequestAsync'.
2020-07-11 09:24:29 -07:00
Michael Howell c9d0af09d6 Use 'AsyncSeek' for sized bodies in 'Response's.
In order to avoid making 'ResponseBuilder::sized_body' an asynchronous
function, the seeking is deferred until finalization. 'finalize()' is
replaced with '.await', and 'ResponseBuilder::ok()' is an 'async fn'.
2020-07-11 09:24:29 -07:00
Jeb Rosen 571e2ac845 Revert incoming request URI and header parsing to more closely match 0.4. 2020-07-11 09:24:29 -07:00
Paolo Barbolini 003bf77c29 Upgrade to tokio 0.2.0.
* Update 'tokio', 'tokio-rustls', and 'hyper'.
* Remove unused dependencies on some `futures-*` crates.
* Rework 'spawn_on', which is now 'serve'.
* Simplify Ctrl-C handling.
2020-07-11 09:24:29 -07:00
Jeb Rosen ea06878581 Update 'hyper', 'futures-*-preview', and 'tokio-*' dependencies.
Use I/O traits and types from 'tokio-io' as much as possible.

A few adapters only exist in futures-io-preview and use
futures-tokio-compat as a bridge for now.
2020-07-11 09:24:29 -07:00
Jeb Rosen d1815e527f Update 'hyper', 'tokio', and 'tokio-rustls'.
* hyper -> 0.13.0-alpha.2
* tokio -> 0.2.0-alpha.5
* tokio-rustls -> 0.12.0-alpha.3
2020-07-11 09:24:28 -07:00
Jeb Rosen 523c6099fb Replace use of 'hyper::AddrIncoming' with a Listener API and implement TLS.
Types can now implement the new 'Listener' trait, which means they can
report the address they are listening on and asynchronously accept
connections. 'Connection's are read/write streams that can additionally
report the remote address.

Listener is implemented for 'tokio_net::tcp::TcpListener' and for
the new 'rocket_http::tls::TlsListener' based on 'tokio-rustls'.

The new private function 'Rocket::listen_on()' now does the main setup
for launch and is generic over a Listener. In the future, a more refined
version of the API can be exposed so that applications can implement
their own listeners.
2020-07-11 09:24:28 -07:00
Jacob Pratt 1f90a9b6d1 Update hyper to '=0.13.0-alpha.1'. 2020-07-11 09:24:28 -07:00
Jeb Rosen 047b1620f9 Update pinned hyper and tokio versions. 2020-07-11 09:24:28 -07:00
Jacob Pratt e44c5896b8 Remove stabilized 'async_await' feature gate and update the minimum nightly version. 2020-07-11 09:24:28 -07:00
Jeb Rosen af95129590 Use futures 0.3-compatible hyper and tokio and the tokio runtime instead
of futures-rs executor.

Despite this change, using body_bytes_wait on (for example) a File will
still fail due to tokio-rs/tokio#1356.
2020-07-11 09:24:28 -07:00
Jeb Rosen 633e495a6b Update many doc tests in 'core' for async. 2020-07-11 09:24:28 -07:00
Jeb Rosen 5d439bafc0 Convert core to async and add support for async routes.
Minimum rustc bump required for rust-lang/rust#61775
2020-07-11 09:24:28 -07:00
Marc Schreiber 96b4142156 Upgrade to hyper 0.12.
* Use hyper's 'MakeService' implementation with futures API.
  * Use tokio runtime to serve HTTP backend.
2020-07-11 09:24:03 -07:00
gcarq 86d0bdddb2 Replace manual ASCII checks with 'std::char' calls. 2020-06-22 05:07:14 -07:00
Sergio Benitez 55d2b2bfb6 Properly mock 'Key::try_generate()'. 2020-06-07 04:02:35 -07:00
Sergio Benitez ea9865ec42 Allow multiple versions of 'rustls' and 'ring'.
Co-authored-by: TotalKrill <kristoffer.odmark90@gmail.com>
2020-06-04 18:59:11 -07:00
Sergio Benitez 3c47fa895a Enable minimal set of 'cookie' features. 2020-06-04 18:54:23 -07:00
Sergio Benitez 3f20e4ac93 Use proper SPDX license expression in 'Cargo.toml'. 2020-06-03 23:02:05 -07:00
Jeb Rosen 097fbd7df0 Fix some broken links in API documentation. 2020-05-31 11:32:14 -07:00
Yusuke Kominami a21221aeb6 Replace deprecated 'OffsetDateTime::now' with 'OffsetDateTime::now_utc'.
Update 'time' dependency accordingly.
2020-05-30 11:13:40 -07:00
Sergio Benitez ee5988fe5c Update 'cookie' to '0.14'. 2020-05-30 01:49:32 -07:00
Sergio Benitez 578038619f Add 'Origin::map_path()' method. 2020-05-29 17:49:37 -07:00
Sergio Benitez 06e146e7d1 Update 'time' to 0.2 in 'contrib'. 2020-03-25 14:39:55 -07:00
Sergio Benitez 53353df633 Fix more broken links. 2020-03-09 02:03:38 -07:00
Sergio Benitez d0bfd8a3bb Update 'cookie' to 0.13.2. 2020-01-29 14:17:01 -08:00
Sergio Benitez f35e3c4aca Set cookies even on error responses.
Fixes #1213.
2020-01-23 21:10:04 -08:00
Sergio Benitez 7c1b8dc9ad Update 'cookie' to 0.13, 'rustls' to 0.16. 2020-01-21 16:10:04 -08:00
Paolo Barbolini cd5f96ae15 Update 'uuid', 'unicode-xid', and 'base64' dependencies. 2019-11-30 09:33:14 -08:00
Matt Brubeck 8bf6aa2068 Update 'smallvec' to '1.0'. 2019-11-16 13:02:50 -08:00
Jacob Pratt 4e6a7ddd5f Remove use of the 'crate_visibility_modifier' feature.
Most items with 'crate' visibility become 'pub(crate)'.
Items are made 'pub' instead when they would remain private.
2019-09-21 09:16:04 -07:00
Jacob Pratt bed93133b8 Abide by formatting in 'Debug' implementations. 2019-09-18 19:06:08 -07:00
Sergio Benitez b7e688cefa Remove use of deprecated 'IndexMap::remove()'.
Use 'IndexMap::swap_remove()' in its place.
2019-09-09 16:51:51 -07:00
Sergio Benitez 99a864008c Remove use of specialization in http. 2019-09-09 16:45:03 -07:00
Sergio Benitez 6ed4c098f1 Stop exporting 'mime' and relevant conversions. 2019-09-09 16:42:44 -07:00
Jacob Pratt 2dd09f90be Remove unused 'doc_cfg' feature. 2019-08-06 14:01:35 -07:00
Jeb Rosen 3e4f8453ce Remove use of the 'decl_macro' feature.
Also removes one internal use in the 'typed-uris' codegen test.
2019-07-19 11:39:56 -07:00
Jacob Pratt 34a741a26e Remove use of '!' type in favor of 'Infallible'.
This removes the use of and dependence on the 'never_type' feature.
2019-07-09 15:10:51 -07:00
Sergio Benitez 7f2c9f426c Fix tests for Windows. 2019-07-06 00:59:01 -07:00
Jeb Rosen 90e37beb2f Migrate http to Rust 2018. 2019-06-25 13:43:53 -04:00
Brenden Matthews ba6aa2f05e Bump cookie, rustls, and hyper-sync-rustls dependencies. 2019-05-14 22:25:55 -07:00
Sergio Benitez 1caf87eb21 Move to 0.5.0-dev on master. 2019-05-13 16:18:48 -07:00
Jacob Pratt 9b219ddc01 Remove stabilized feature gates.
* try_from
* transpose_result
2019-04-12 18:48:51 -07:00
Sergio Benitez f0c6c9b26f Use explicit associated type in 'IntoOwned' impl. 2019-02-06 19:37:39 -08:00
Sergio Benitez ca5623c641 Type encoding to fix encoding issues once and for all.
Fixes #849.
2018-12-12 17:38:36 -08:00
Sergio Benitez 5056705884 Improve query string routing and typed URI docs. 2018-12-07 12:09:15 -08:00
Sergio Benitez b88a2d7d05 Add notes about enabling features to contrib docs. 2018-12-07 09:07:27 -08:00
Sergio Benitez a4dcb0cf4c New version: 0.4.0. 2018-12-06 09:19:11 -08:00
Sergio Benitez d7933dd6fd Implement ignorable 'uri!' expressions.
Closes #840.
2018-12-06 08:43:24 -08:00
Sergio Benitez 90a6749313 New version: 0.4.0-rc.2. 2018-11-30 21:00:18 -08:00
Sergio Benitez b7db74144f Parameterize 'UriDisplay' with 'Path' or 'Query'.
This commit introduces the sealed `UriPart` marker trait as well as the
implementing `Path` and `Query` marker types, allowing for parts of a
URI to be distinguished at the type level. Consequently, `UriDisplay`
has been parameterized with `P: UriPart`, creating `UriDisplay<Path>`
and `UriDisplay<Query>`. The effect of this change is improved type
safely for URI rendering as well as the ability to omit rendering values
in query parts via `Option` and `Result`.

The `UriDisplay` derive was replaced by `UriDisplayQuery` and
`UriDisplayPath` which derive implementations for `UriDisplay<Path>`
and `UriDisplay<Query>`, respectively.

This commit also works around a rustdoc visibility issue by creating a
hidden `http::private` module.

Finally, this commit also removes the now vestigial use of the
`rustc_private` feature in codegen.

Fixes #827.
2018-11-27 10:01:47 -06:00
Alva Snædís 4dea9eed36 Mention that u128, i128 implement UriDisplay. 2018-11-11 21:51:42 -08:00
Sergio Benitez 4224419e63 Reduce 'cfg' usage for 'private-cookies' feature. 2018-11-08 23:56:15 -08:00
Linus Unnebäck 53758c6dd7 Introduce the 'private-cookies' feature. 2018-11-08 23:38:18 -08:00
Alex Bowers 32e2ff4d6b Add ZIP (application/zip) as a known media type. 2018-11-08 20:47:26 -08:00
Sergio Benitez a2ada84986 Move 'UriDisplay' note to top of 'FromUriParam' docs. 2018-11-05 15:02:11 -08:00
Sergio Benitez 5762208bba Percent-encode characters: '[', ']', '\', '^', '|'.
Fixes #808.
2018-11-02 00:10:01 -07:00
Sergio Benitez 4dbd87a36f New version: 0.4.0-rc.1. 2018-10-31 14:35:30 -07:00
Sergio Benitez 7b2b6aba81 Use published version of 'pear'. 2018-10-28 20:17:44 -07:00
Sergio Benitez 3f2e724b23 Update rustls to 0.14. 2018-10-27 18:14:17 -07:00
Sergio Benitez 556206e8b3 Version all URLs to 'rocket.rs'. 2018-10-26 21:20:12 -07:00
Sergio Benitez 3798cd3e65 Document and test 'UriDisplay', its derive, and 'Formatter'. 2018-10-25 02:53:04 -07:00
Divyahans Gupta 34421f13f3 Allow nested values in 'UriDisplay'. 2018-10-24 21:57:53 -07:00
Sergio Benitez 26db5ecb4e Fix normalization and Windows issues. 2018-10-24 00:01:56 -07:00
Sergio Benitez ea158d4344 Individually document proc bang macros and derives. 2018-10-15 15:27:47 -07:00
Sergio Benitez 05eee14d90 Update pear to latest revision. 2018-10-14 23:49:02 -07:00
Sergio Benitez 28f2a33abd Use inter/intra-crate links in all documentation. 2018-10-09 04:31:09 -07:00
Sergio Benitez 2839aca8ce Update features for latest nightly. 2018-10-09 04:31:09 -07:00
Sergio Benitez 360b0e80b0 Port all codegen tests to codegen_next. 2018-10-09 04:31:08 -07:00
Sergio Benitez b9bf1ee37d Fix typed URI generation for query reform. 2018-10-09 04:31:08 -07:00
Sergio Benitez 61f107f550 Reimplement route attribute as a proc-macro.
This commits also implement the query reform from #608. It also consists
of many, many breaking changes. Among them are:

  * Query parts in route paths use new query reform syntax.
  * Routing for queries is now lenient.
    - Default ranking has changed to reflect query reform.
  * Format routing matching has been fixed.
    - Routes with formats matching "accept" will always collide.
    - Routes with formats matching "content-type" require requests to
      have an equivalent content-type header to match.
    - Requests with imprecise content-types are treated as not having a
      content-type.
  * Generated routes and catchers respect visibility modifiers.
  * Raw getter methods from request were renamed and retooled.
    - In particular, the index parameter is based on segments in the
      route path, not dynamic parameters.
  * The method-based attributes no longer accept a keyed 'path'.
  * The 'rocket_codegen' crate is gone and will no longer be public.
  * The 'FormItems' iterator emits values of type 'FormItem'.
    - The internal form items' string can no longer be retrieved.
  * In general, routes are more strictly validated.
  * Logging from codegen now funnels through logging infrastructure.
  * Routing has been optimized by caching routing metadata.

Resolves #93.
Resolves #608.
Resolves #693.
Resolves #476.
2018-10-09 04:18:04 -07:00
Sergio Benitez 3eb873d89d Tidy 'uri!' proc-macro. Improve error reporting. 2018-10-04 02:00:04 -07:00
Sergio Benitez 1a3fd1d237 Add known media types and extensions.
Adds the following to the list of known media types:

  * audio/webm (WEBA)
  * image/tiff (TIFF)
  * audio/aac (AAC)
  * text/calendar (Calendar)
  * video/mpeg (MPEG)
  * application/x-tar (TAR)
  * application/gzip (GZIP)
  * video/quicktime (MOV)
  * video/mp4 (MP4)

Also adds the following to the list of known extensions:

  * .weba (WEBA)
  * .ogv (OGG)
  * .mp4 (MP4)
  * .mpeg4 (MP4)
  * .aac (AAC)
  * .ics (Calendar)
  * .bin (Binary)
  * .mpg (MPEG)
  * .mpeg (MPEG)
  * .tar (TAR)
  * .gz (GZIP)
  * .tif (TIFF)
  * .tiff (TIFF)
  * .mov (MOV)
2018-09-18 18:25:39 -07:00
Sergio Benitez 112e700836 Reimplement 'catch' attribute as a proc-macro. 2018-09-16 01:32:40 -07:00
jeb cfdb2a404b Add Icon (image/x-icon) as a known media type. 2018-09-11 15:16:06 -07:00
Tal 8172f748b3 Implement 'Clone' for all URI types. 2018-09-03 19:42:34 -07:00
jeb 1da506ea5d Remove use of the 'const_fn' feature. 2018-09-03 19:41:31 -07:00
Sergio Benitez fd6d577158 Remove 'use_extern_macros' feature: stabilized. 2018-08-18 17:06:28 -07:00
Sergio Benitez 7b4747ff1c Fix 'Segments::into_path_buf()' docstring. 2018-08-17 11:14:45 -07:00
Sergio Benitez b642e94a2c Reduce or consolidate git-based dependencies. 2018-08-15 19:44:35 -07:00
Sergio Benitez 651c202060 Move 'SegmentError' into 'uri' module. 2018-08-13 02:14:16 -07:00
Sergio Benitez fe59a7fe38 Use better types for 'Error' associated types. 2018-08-10 04:42:30 -07:00
Sergio Benitez 56c6a96f6a Overhaul URI types.
This is fairly large commit with several entangled logical changes.

The primary change in this commit is to completely overhaul how URI
handling in Rocket works. Prior to this commit, the `Uri` type acted as
an origin API. Its parser was minimal and lenient, allowing URIs that
were invalid according to RFC 7230. By contrast, the new `Uri` type
brings with it a strict RFC 7230 compliant parser. The `Uri` type now
represents any kind of valid URI, not simply `Origin` types. Three new
URI types were introduced:

  * `Origin` - represents valid origin URIs
  * `Absolute` - represents valid absolute URIs
  * `Authority` - represents valid authority URIs

The `Origin` type replaces `Uri` in many cases:

  * As fields and method inputs of `Route`
  * The `&Uri` request guard is now `&Origin`
  * The `uri!` macro produces an `Origin` instead of a `Uri`

The strict nature of URI parsing cascaded into the following changes:

  * Several `Route` methods now `panic!` on invalid URIs
  * The `Rocket::mount()` method is (correctly) stricter with URIs
  * The `Redirect` constructors take a `TryInto<Uri>` type
  * Dispatching of a `LocalRequest` correctly validates URIs

Overall, URIs are now properly and uniformly handled throughout Rocket's
codebase, resulting in a more reliable and correct system.

In addition to these URI changes, the following changes are also part of
this commit:

  * The `LocalRequest::cloned_dispatch()` method was removed in favor of
    chaining `.clone().dispatch()`.
  * The entire Rocket codebase uses `crate` instead of `pub(crate)` as a
    visibility modifier.
  * Rocket uses the `crate_visibility_modifier` and `try_from` features.

A note on unsafety: this commit introduces many uses of `unsafe` in the
URI parser. All of these uses are a result of unsafely transforming byte
slices (`&[u8]` or similar) into strings (`&str`). The parser ensures
that these casts are safe, but of course, we must label their use
`unsafe`. The parser was written to be as generic and efficient as
possible and thus can parse directly from byte sources. Rocket, however,
does not make use of this fact and so would be able to remove all uses
of `unsafe` by parsing from an existing `&str`. This should be
considered in the future.

Fixes #443.
Resolves #263.
2018-07-29 00:17:33 -07:00
Sean Stangl a7cc5542ab Fix various clippy warnings in core and codegen. 2018-07-25 15:28:35 -07:00
Sergio Benitez e25a82b14b Update dependencies for ring 0.13. 2018-07-22 21:59:40 -07:00
jeb 0c80217289 Fix various spelling and grammar issues in core and contrib. 2018-07-20 22:14:58 -06:00
Sergio Benitez 19d8569cdb Update core, codegen for 2018-07-16 nightly. 2018-07-17 14:06:32 -07:00
Sergio Benitez 18a91c938e Reexport 'cookie::SameSite' from the http module. 2018-07-10 17:09:24 -07:00
Imron Alston a383d49ab0 Add FLAC (audio/flac) as a known media type. 2018-06-28 19:42:59 -07:00
Sergio Benitez 64bbed1422 Improve documentation on unsafe usage.
All uses of `unsafe` are now thoroughly documented with arguments and
informal proofs of correctness as well as conditions that must hold for
these arguments to pass.

This commit also reduces the number of `unsafe` uses by 7, bringing the
count to ~10 non-test uses of `unsafe`.
2018-06-20 14:02:12 +02:00
Sergio Benitez df7111143e Split the 'http' module into its own 'rocket_http' crate. 2018-06-07 15:34:47 +02:00