Commit Graph

824 Commits

Author SHA1 Message Date
Sergio Benitez c6192c1c0b Use mixed-site spans to avoid clippy 'uri!' error.
Closes #2630.
2023-10-29 18:27:17 -05:00
Sergio Benitez 923b61edf3 Update UI tests. 2023-10-26 20:25:33 -05:00
许杰友 Jieyou Xu (Joe) 5bdafc272d Use Span::mixed_site to avoid let unit warnings.
Closes #2568.
2023-10-26 20:01:45 -05:00
Ruben Schmidmeister dc9e1ac6a1 Set 'color-scheme' in default catcher HTML. 2023-10-26 20:01:06 -05:00
Sergio Benitez f38103da60 Update dependencies.
* notify: 5 -> 6
  * indexmap: 1 -> 2
  * cookie: 0.18.0-rc.0 -> 0.18
2023-10-26 20:01:06 -05:00
Sergio Benitez a20f9d8e89 Document that '&[u8]' is a form guard. 2023-10-26 20:01:06 -05:00
Sergio Benitez ed56056d0e Update 'cookie' to 0.18. 2023-10-26 20:01:06 -05:00
Sergio Benitez 09cbf2f371 Fix broken links between codegen and http crates.
Also resolves link warnings emitted by rustdoc.

Closes #2594
2023-10-26 20:01:06 -05:00
Sergio Benitez b5d14ff89a Update UI tests for latest rustc. 2023-10-26 19:56:08 -05:00
Sergio Benitez 79399bb1c0 Avoid using 'macro' items on stable.
This gets rid of the warning message on stable when building examples.
2023-10-26 19:56:08 -05:00
Sergio Benitez e7ef93be49 Remove use of 'private_in_public' lint.
The lint no longer exists. This gets rid of a compile-time warning for users.

Resolves #2608.
2023-10-26 19:56:08 -05:00
Sergio Benitez 20a8e2c914 Update UI tests for latest `rustc`. 2023-10-26 19:55:55 -05:00
Manuel Transfeld e581e3f98e Update 'sqlx' to '0.7'. 2023-10-26 19:55:46 -05:00
Sergio Benitez f5c7be24d6 Clarify when 'UriDisplay' can be derived.
Resolves #2595.
2023-10-26 19:54:40 -05:00
Sergio Benitez 546f3f1bd0 Fix 'get_pending()' docs, functionality.
The `get_pending()` method now properly decrypts private cookies that were
present in the jar originally.

Resolves #2591.
2023-10-26 19:54:28 -05:00
Sergio Benitez ed25534426 Update 'yansi' to 1.0.0-rc. 2023-10-26 19:53:24 -05:00
Sergio Benitez 74be8a90a1 Add support for 'diesel-async' to 'db_pools'. 2023-10-26 19:46:35 -05:00
Sergio Benitez 35c62ff74a Remove use of 'unsafe' in 'RawStr' doctests. 2023-10-26 19:46:07 -05:00
Sergio Benitez 40410e4365 Add 'mtls::Certificate::as_bytes()' method. 2023-10-26 19:45:44 -05:00
Sergio Benitez b89a0039a7 Update 'state' to 0.6. 2023-10-26 19:41:28 -05:00
Sergio Benitez 4b7d48967b Warn if a task is spawned in a sync '#[launch]'.
The warning is fairly conservative. Heuristics are used to determine if a call
to `tokio::spawn()` occurs in the `#[launch]` function.

Addresses #2547.
2023-10-26 19:23:12 -05:00
Sergio Benitez e2fb31b63e Document built-in data guards. 2023-10-26 19:22:48 -05:00
Sergio Benitez 6cb60db5f6 Only extract needed values in 'async_main'.
Previously, `async_main` would extract a full `Config`. This mean that values
like `address` were read and parsed even when they were unused. Should they
exist and be malformed, a configuration error would needlessly arise.

This commit fixes this by only extract values that are subsequently used.
2023-10-26 19:22:42 -05:00
Sergio Benitez 83638fcee2 Remove closure borrow in 'FromForm' derive.
The codegen for field validations previously included a closure that
could potentially partially borrow a 'Copy' field of the context
structure. To prevent this, 'let'-assign the field before the closure is
created, and use the assignment inside of the closure.
2023-10-26 19:22:36 -05:00
Sergio Benitez be496682c2 Add 'Error::pretty_print()'. 2023-05-05 18:21:17 -07:00
Sergio Benitez 07c23a4b2d Log config provenance in debug.
This helps identify configuration issues by printing the source of every
configuration value used by Rocket.
2023-05-05 18:21:17 -07:00
Sergio Benitez 817648cef5 Allow 'clippy::style' warnings in attr codegen.
Furthermore, properly forward 'deprecated' items in catcher codegen.
2023-05-05 18:21:17 -07:00
Sergio Benitez 4f5a83ba9c Fix missing port parsing in 'Authority'.
If a port part was missing, the 'Authority' parser previously set the
port to `0`. This is incorrect. As in RFC#3986 3.2.3:

> URI producers and normalizers should omit the port component and its
  ":" delimiter if port is empty [..]

This commit fixes the parser's behavior to align with the RFC.
2023-05-05 18:21:17 -07:00
Sergio Benitez 19e78eae3a Remove unnecessary 'mut' in 'uri!' impl. 2023-05-05 18:21:17 -07:00
Sergio Benitez 284852db19 Mark '.exe', '.iso', '.dmg' as known extensions.
'EXE' is IANA registered, and the registered media type is used here for
the '.exe' extension.

The '.iso' and '.dmg' extensions do not appear to correspond to any IANA
registered media type, but they have a de facto media type of
"application/octet-stream", and that media type is used by this commit.

Closes #2530.
2023-05-05 18:21:17 -07:00
Sergio Benitez 403604c402 Tidy custom forward status changes, update docs. 2023-05-05 18:21:17 -07:00
Benedikt Weber 1f06bb0b73 Allow status customization in 'Forward' outcomes.
Prior to this commit, all forward outcomes resulted in a 404. This
commit changes request and data guards so that they are able to provide
a `Status` on `Forward` outcomes. The router uses this status, if the
final outcome is to forward, to identify the catcher to invoke.

The net effect is that guards can now customize the status code of a
forward and thus the error catcher invoked if the final outcome of a
request is to forward.

Resolves #1560.
2023-05-05 18:21:17 -07:00
Sergio Benitez e66db09a6c Emit warning when 'String' is used as a parameter.
The warning is only emitted when Rocket is compiled in debug.
2023-05-05 18:21:14 -07:00
Sergio Benitez a82508b403 Set 'Secure' cookie flag by default under TLS.
If TLS is enabled and active, Rocket will now set the `Secure` cookie
attribute by default.

Resolves #2425.
2023-04-05 13:15:24 -07:00
Sergio Benitez 89534129de Add 'TempFile::open()' to stream its data.
Resolves #2296.
2023-04-05 12:45:48 -07:00
Sergio Benitez 80b7755317 Properly forward 'deprecated' items in codegen.
Resolves #2262.
2023-04-05 11:15:49 -07:00
Sergio Benitez c48ce64a77 Standardize 'response::status' responders.
This commit modifies all of the non-empty responders in the
`response::status` module so that they look like `Status<R>(pub R)`.
Prior to this commit, some responders looked like this, while others
contained an `Option<R>`.

Resolves #2351.
2023-04-05 10:51:05 -07:00
Sergio Benitez 03433c10ea Allow specifying 'Status' in custom form errors.
Resolves #1694.
2023-04-05 09:56:49 -07:00
Sergio Benitez c3520fb4a1 Pin I/O handlers. Allow 'FnOnce' in 'ws' handlers.
This modifies the 'IoHandler::io()' method so that it takes a
'Pin<Box<Self>>', allowing handlers to move internally and assume that
the data is pinned.

The change is then used in the 'ws' contrib crate to allow 'FnOnce'
handlers instead of 'FnMut'. The net effect is that streams, such as
those crated by 'Stream!', are now allowed to move internally.
2023-04-04 15:33:46 -07:00
Sergio Benitez 5e7a75e1a5 Use 'parking_lot' 'Mutex' in fairing's 'Once'. 2023-04-04 15:11:09 -07:00
Sergio Benitez 887558be60 Emit warnings when data limits are reached.
Aid in debugging incorrectly configured data limits.
2023-04-03 13:27:33 -07:00
Sergio Benitez fbb0ace529 Update 'rustls' to 0.21, 'tokio-rustls' to 0.24. 2023-03-31 12:08:45 -07:00
Sergio Benitez aa6ad7030a Allow setting mTLS certificates on local 'Client'.
This allows testing with client certificates.

Co-authored-by: Brett Buford <blbuford@gmail.com>
2023-03-31 11:13:40 -07:00
Sergio Benitez 64a7bfb37c Fix header lookups for connection upgrades. 2023-03-30 16:08:14 -07:00
Sergio Benitez 2a63b1a41f Downgrade I/O stream closing to warning.
Since active I/O streams will be closed by graceful shutdown, an error,
as was previously emitted, was necessarily alarmist. This reduces the
severity of the log message to a warning.
2023-03-30 12:46:34 -07:00
Sergio Benitez d97c83d7e0 Finalize support for external connection upgrades. 2023-03-29 17:06:08 -07:00
Mai-Lapyst 19e7e82fd6 Initial connection upgrade API implementation. 2023-03-29 17:06:04 -07:00
Sergio Benitez 372e9671eb Clarify 'Responder' async I/O usage in docs.
Resolves #2286.
2023-03-26 19:32:49 -07:00
Sergio Benitez a474fde85b Implement 'De(Serialize)' for 'Status'.
Resolves #2366.
2023-03-26 19:18:04 -07:00
Sergio Benitez 0d8cb1457f Recognize the '.mjs' extension as JavaScript.
Resolves #2479.
2023-03-25 08:58:43 -07:00