Commit Graph

21 Commits

Author SHA1 Message Date
Sergio Benitez 34321b418f New version: rocket_ws 0.1.1. 2024-05-22 20:38:53 -05:00
Sergio Benitez af13365302 New version: rocket 0.5.1. 2024-05-22 20:31:19 -05:00
Łukasz Wojniłowicz ae439fae54 Symlink license files in all crate directories.
Resolves #2760.
2024-05-22 13:41:37 -05:00
高奕GaoYi fd446a8ef4 Add 'WebSocket::accept_key()'. 2024-05-22 13:36:05 -05:00
Mathew Horner fa79610bcd Fix git repository URLs in contrib crates. 2024-01-17 21:53:12 -08:00
Sergio Benitez 9544715103 Update 'tungstenite' to '0.21'. 2024-01-17 21:53:12 -08:00
Sergio Benitez f2730fb509 Fix min dependency versions. Update MSRV to 1.64.
Also includes a work-around for a buggy `format_args!` macro found in
rustc 1.67 and 1.68.

Resolves #2670.
2024-01-17 21:42:08 -08:00
Sergio Benitez ab82064354 Update 'SergioBenitez/Rocket' to 'rwf2/Rocket'.
Resolves rwf2/rwf2#5.
2023-11-22 21:41:51 +01:00
Sergio Benitez 38ae8d6317 Update version numbers for 0.5.0. 2023-11-17 16:38:14 +01:00
Sergio Benitez c06a51bd37 Fix typos.
Co-authored-by: cui fliter <imcusg@gmail.com>
2023-11-17 16:38:14 +01:00
Sergio Benitez 3ee6e5c758 New version: 0.5.0-rc.4.
New contrib versions: 0.1.0-rc.4.
2023-11-17 16:38:14 +01:00
Sergio Benitez 186ec84f5b Improve forwarding status code precision.
Previously, the `NotFound` status code was used to signal many kinds of
recoverable, forwarding errors. This included validation errors, incorrect
Content-Type errors, and more.

This commit modifies the status code used to forward in these instances to more
precisely indicate the forwarding condition. In particular:

  * Parameter `FromParam` errors now forward as 422 (`UnprocessableEntity`).
  * Query paramater errors now forward as 422 (`UnprocessableEntity`).
  * Use of incorrect form content-type forwards as 413 (`UnsupportedMediaType`).
  * `WebSocket` guard now forwards as 400 (`BadRequest`).
  * `&Host`, `&Accept`, `&ContentType`, `IpAddr`, and `SocketAddr` all forward
    with a 500 (`InternalServerError`).

Additionally, the `IntoOutcome` trait was overhauled to support functionality
previously offered by methods on `Outcome`. The `Outcome::forward()` method now
requires a status code to use for the forwarding outcome.

Finally, logging of `Outcome`s now includes the relevant status code.

Resolves #2626.
2023-11-01 18:50:58 -05:00
Lev Kokotov 9eac525e7d Fix typo in 'rocket_ws' README. 2023-10-26 20:01:06 -05:00
Fenhl a32ea70835 Upgrade 'tokio-tungstenite' to 0.20. 2023-10-26 20:01:06 -05:00
BlackDex 36a5c82e8b Update 'tungstenite' to 0.19 in 'rocket-ws'. 2023-10-26 19:22:54 -05: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 07ea3df0c2 Fix links to 'Stream!' in 'ws' rustdocs. 2023-04-05 09:58:21 -07:00
Sergio Benitez db96f670b7 Fix contrib 'ws' README formatting. 2023-04-04 15:37:22 -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 d9f86d8647 Fully document the 'ws' contrib crate. 2023-04-03 16:09:45 -07:00
Sergio Benitez 7d895eb9f6 Add initial implementation of 'rocket_ws'.
This provides WebSocket support in Rocket's official 'contrib'.
2023-04-01 15:02:24 -07:00