Skip to content

Commit 756e34a

Browse files
committed
Merge branch 'master' into route-tracing
2 parents 7b6ea9a + 26a3f00 commit 756e34a

File tree

263 files changed

+9023
-3568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+9023
-3568
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ blank_issues_enabled: true
22
contact_links:
33
- name: Question
44
url: https://github.com/SergioBenitez/Rocket/discussions
5-
about: Please ask questions or raise indefinite concerns on Dicussions
5+
about: Please ask questions or raise indefinite concerns on Discussions

.github/workflows/ci.yml

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ on: [push, pull_request]
55
env:
66
CARGO_TERM_COLOR: always
77

8-
98
jobs:
109
test:
1110
name: "${{ matrix.platform.name }} ${{ matrix.test.name }} (${{ matrix.platform.toolchain }})"
11+
runs-on: ${{ matrix.platform.distro }}
1212

1313
strategy:
1414
fail-fast: false
1515
matrix:
16+
fallible: [false]
1617
platform:
1718
- { name: Linux, distro: ubuntu-latest, toolchain: stable }
1819
- { name: Windows, distro: windows-latest, toolchain: stable }
@@ -27,12 +28,34 @@ jobs:
2728
test: { name: Core, flag: "--core" }
2829
- platform: { name: Linux, distro: ubuntu-latest, toolchain: stable }
2930
test: { name: Release, flag: "--release" }
30-
31-
runs-on: ${{ matrix.platform.distro }}
31+
- platform: { name: Linux, distro: ubuntu-latest, toolchain: stable }
32+
test: { name: UI, flag: "--ui" }
33+
fallible: true
34+
- platform: { name: Linux, distro: ubuntu-latest, toolchain: nightly }
35+
test: { name: UI, flag: "--ui" }
36+
fallible: true
37+
- platform: { name: Windows }
38+
working-directory: "C:\\a\\${{ github.event.repository.name }}\\${{ github.event.repository.name }}"
3239

3340
steps:
3441
- name: Checkout Sources
35-
uses: actions/checkout@v2
42+
uses: actions/checkout@v3
43+
44+
- name: Free Disk Space (Linux)
45+
if: matrix.platform.name == 'Linux'
46+
run: |
47+
echo "Freeing up disk space on Linux CI"
48+
df -h
49+
sudo rm -rf /usr/share/dotnet/
50+
sudo rm -rf /opt/ghc
51+
sudo rm -rf /usr/local/share/boost
52+
sudo rm -rf /usr/local/graalvm/
53+
sudo rm -rf /usr/local/.ghcup/
54+
sudo rm -rf /usr/local/share/powershell
55+
sudo rm -rf /usr/local/share/chromium
56+
sudo rm -rf /usr/local/lib/android
57+
sudo rm -rf /usr/local/lib/node_modules
58+
df -h
3659
3760
- name: Install Native Dependencies (macOS)
3861
if: matrix.platform.name == 'macOS'
@@ -60,24 +83,35 @@ jobs:
6083
sudo apt-get install -y libmysqlclient-dev libpq-dev libsqlite3-dev
6184
6285
- name: Install Rust
63-
uses: actions-rs/toolchain@v1
86+
uses: dtolnay/rust-toolchain@master
87+
id: toolchain
6488
with:
65-
profile: minimal
6689
toolchain: ${{ matrix.platform.toolchain }}
67-
override: true
90+
components: rust-src
6891

6992
- name: Cache Example Workspace
7093
if: matrix.test.name == 'Examples'
71-
uses: Swatinem/rust-cache@v1
94+
uses: Swatinem/rust-cache@v2
7295
with:
73-
working-directory: "examples"
96+
workspaces: examples
97+
key: ${{ matrix.test.name }}-${{ steps.toolchain.outputs.cachekey }}
7498

7599
- name: Cache Root Workspace
76100
if: matrix.test.name != 'Examples'
77-
uses: Swatinem/rust-cache@v1
101+
uses: Swatinem/rust-cache@v2
78102
with:
79-
key: ${{ matrix.test.name }}
103+
key: ${{ matrix.test.name }}-${{ steps.toolchain.outputs.cachekey }}
104+
105+
# Don't run out of disk space on Windows. C: has much much space than D:.
106+
- name: Switch Disk (Windows)
107+
if: matrix.platform.name == 'Windows'
108+
run: |
109+
Get-PSDrive
110+
cp D:\a C:\ -Recurse
111+
Get-PSDrive
80112
81113
- name: Run Tests
82-
run: ./scripts/test.sh ${{ matrix.test.flag }}
114+
continue-on-error: ${{ matrix.fallible }}
115+
working-directory: ${{ matrix.working-directory || github.workspace }}
116+
run: ./scripts/test.sh ${{ matrix.test.flag }} -q
83117
shell: bash

CHANGELOG.md

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,89 @@
1-
# Version 0.5.0-rc.2 (May 9, 2022)
1+
# Version 0.5.0-rc.3 (Mar 23, 2023)
2+
3+
## Major Features and Improvements
4+
5+
* Added a [`max_blocking`] configuration parameter.
6+
7+
The parameter sets a limit on the number of threads used by blocking tasks.
8+
9+
* Added an [`ip_header`] "real IP" header configuration parameter.
10+
11+
The parameter allows modifying the header that Rocket attempts to use to retrieve the "real IP"
12+
address of the client via `Request` methods like [`Request::client_ip()`]. Additionally, the
13+
change allows disabling the use of any such header entirely.
14+
15+
* A [`pool()`] method is emitted by [`rocket_sync_db_pools`] for code-generated pools.
16+
17+
The method returns an opaque reference to a type that can be used to retrieve pooled connections
18+
outside of a request handling context.
19+
20+
* Raw binary form field data can be retrieved using the `&[u8]` form guard.
21+
22+
* Data guards are now eligible [sentinels].
23+
24+
## General Improvements
25+
26+
* Final launch messages are now _always_ logged, irrespective of profile.
27+
* Only functions that return `Rocket<Build>` are now `#[must_use]`, not all `Rocket<P>`.
28+
* Fixed mismatched form field names in errors under certain conditions in [`FromForm`] derive.
29+
* The [`FromForm`] derive now collects _all_ errors that occur.
30+
* Data pools are now gracefully shutdown in [`rocket_sync_db_pools`].
31+
* Added [`Metadata::render()`] in [`rocket_dyn_templates`] for direct template rendering.
32+
* Rocket salvages more information from malformed requests for error catchers.
33+
* The `cookie` `secure` feature is now properly conditionally enabled.
34+
* Data before encapsulation boundaries in TLS keys is allowed and ignored.
35+
* Support for TLS keys in SEC1 format was added.
36+
* Rocket now warns when a known secret key is configured.
37+
* A panic that could occur on shutdown in `rocket_sync_db_pools` was fixed.
38+
39+
### Known Media Types
40+
41+
- Added `MP3`: `audio/mpeg`.
42+
- Added `CBZ`: `application/vnd.comicbook+zip`, extension `.cbz`.
43+
- Added `CBR`: `application/vnd.comicbook-rar`, extension `.cbr`.
44+
- Added `RAR`: `application/vnd.rar`, extension `.rar`.
45+
- Added `EPUB`: `application/epub+zip`, extension `.epub`.
46+
- Added `OPF`: `application/oebps-package+xml`, extension `.opf`.
47+
- Added `XHTML`: `application/xhtml+xml`, extension `.xhtml`.
48+
49+
### Trait Implementations
50+
51+
* Implemented `Responder` for `Box<T: Responder + Sized>`.
52+
* Implemented `FromForm` for `Arc<T>`.
53+
* Implemented `Fairing` for `Arc<dyn Fairing>`.
54+
55+
### Updated Dependencies
56+
57+
* Updated `syn` to `2`.
58+
* Updated `diesel` to `2.0`.
59+
* Updated `sqlx` to `0.6`.
60+
* Updated `notify` to `5.0`.
61+
* Updated `criterion` to `0.4`.
62+
* Updated `deadpool-redis` to `0.11`.
63+
* Updated `normpath` from to `1`.
64+
* Updated `cookie` to `0.17`.
65+
* Replaced `atty` with `is-terminal`.
66+
67+
## Infrastructure
68+
69+
* UI tests are now allowed to fail by the CI to avoid false negatives.
70+
* Fixed many typos, errors, and broken links throughout docs and examples.
71+
* The GitHub CI workflow was updated to use maintained actions.
72+
73+
[`Metadata::render()`]: https://api.rocket.rs/v0.5-rc/rocket_dyn_templates/struct.Metadata.html#method.render
74+
[`pool()`]: https://api.rocket.rs/v0.5-rc/rocket_sync_db_pools/example/struct.ExampleDb.html#method.pool
75+
[`Request::client_ip()`]: https://api.rocket.rs/v0.5-rc/rocket/request/struct.Request.html#method.client_ip
76+
[`max_blocking`]: https://api.rocket.rs/v0.5-rc/rocket/struct.Config.html#structfield.max_blocking
77+
[`ip_header`]: https://api.rocket.rs/v0.5-rc/rocket/struct.Config.html#structfield.ip_header
78+
79+
# Version 0.5.0-rc.2 (May 09, 2022)
280

381
## Major Features and Improvements
482

583
* Introduced [`rocket_db_pools`] for asynchronous database pooling.
684
* Introduced support for [mutual TLS] and client [`Certificate`]s.
785
* Added a [`local_cache_once!`] macro for request-local storage.
8-
* Added a [v0.4 to v0.5 migration guide] and [FAQ] the Rocket's website.
86+
* Added a [v0.4 to v0.5 migration guide] and [FAQ] to Rocket's website.
987
* Introduced [shutdown fairings].
1088

1189
## Breaking Changes
@@ -15,6 +93,7 @@
1593
* [`MediaType::with_params()`] and [`ContentType::with_params()`] are now builder methods.
1694
* Content-Type [`content`] responder type names are now prefixed with `Raw`.
1795
* The `content::Plain` responder is now called `content::RawText`.
96+
* The `content::Custom<T>` responder was removed in favor of [`(ContentType, T)`].
1897
* TLS config structs are now only available when the `tls` feature is enabled.
1998
* Removed `CookieJar::get_private_pending()` in favor of [`CookieJar::get_pending()`].
2099
* The [`local_cache!`] macro accepts fewer types. Use [`local_cache_once!`] as appropriate.
@@ -67,7 +146,8 @@
67146

68147
* Rocket now uses the 2021 edition of Rust.
69148

70-
[v0.4 to v0.5 migration guide]: https://rocket.rs/v0.5-rc/guide/upgrading-from-0.4/
149+
[`(ContentType, T)`]: https://api.rocket.rs/v0.5-rc/rocket/response/content/index.html#usage
150+
[v0.4 to v0.5 migration guide]: https://rocket.rs/v0.5-rc/guide/upgrading/
71151
[FAQ]: https://rocket.rs/v0.5-rc/guide/faq/
72152
[`Rocket::launch()`]: https://api.rocket.rs/v0.5-rc/rocket/struct.Rocket.html#method.launch
73153
[`ErrorKind::Shutdown`]: https://api.rocket.rs/v0.5-rc/rocket/error/enum.ErrorKind.html#variant.Shutdown
@@ -2166,7 +2246,7 @@ the Rocket APIs. They are summarized through the following API changes:
21662246
* Added `FromData` conversion trait and default implementation.
21672247
* `FromData` is used to automatically derive the `data` parameter.
21682248
* `Responder`s are now final: they cannot forward to other requests.
2169-
* `Responser`s may only forward to catchers.
2249+
* `Responder`s may only forward to catchers.
21702250

21712251
## Breaking
21722252

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[workspace]
2+
resolver = "2"
23
members = [
34
"core/lib/",
45
"core/codegen/",
@@ -8,5 +9,6 @@ members = [
89
"contrib/sync_db_pools/codegen/",
910
"contrib/sync_db_pools/lib/",
1011
"contrib/dyn_templates/",
12+
"contrib/ws/",
1113
"site/tests",
1214
]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ suite with `TRYBUILD=overwrite` and inspect the `diff` of `.std*` files.
103103

104104
[`trybuild`]: https://docs.rs/trybuild/1
105105

106-
## Documentation
106+
### API Docs
107107

108108
API documentation is built with `./scripts/mk-docs.sh`. The resulting assets are
109109
uploaded to [api.rocket.rs](https://api.rocket.rs/).

benchmarks/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ harness = false
1313

1414
[dev-dependencies]
1515
rocket = { path = "../core/lib/" }
16-
criterion = "0.3"
16+
criterion = "0.4"

benchmarks/src/routing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ fn generate_matching_requests<'c>(client: &'c Client, routes: &[Route]) -> Vec<L
4545
}
4646

4747
fn request_for_route<'c>(client: &'c Client, route: &Route) -> LocalRequest<'c> {
48-
let path = route.uri.origin.path()
48+
let path = route.uri.path()
4949
.raw_segments()
5050
.map(staticify_segment)
5151
.collect::<Vec<_>>()
5252
.join("/");
5353

54-
let query = route.uri.origin.query()
54+
let query = route.uri.query()
5555
.map(|q| q.raw_segments())
5656
.into_iter()
5757
.flatten()

contrib/db_pools/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ full usage details.
1717

1818
```toml
1919
[dependencies.rocket_db_pools]
20-
version = "0.1.0-rc.2"
20+
version = "=0.1.0-rc.3"
2121
features = ["sqlx_sqlite"]
2222
```
2323

contrib/db_pools/codegen/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rocket_db_pools_codegen"
3-
version = "0.1.0-rc.2"
3+
version = "0.1.0-rc.3"
44
authors = ["Sergio Benitez <[email protected]>", "Jeb Rosen <[email protected]>"]
55
description = "Procedural macros for rocket_db_pools."
66
repository = "https://github.com/SergioBenitez/Rocket/contrib/db_pools"
@@ -14,7 +14,7 @@ rust-version = "1.56"
1414
proc-macro = true
1515

1616
[dependencies]
17-
devise = "0.3"
17+
devise = "0.4"
1818
quote = "1"
1919

2020
[dev-dependencies]
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error[E0277]: the trait bound `Unknown: Pool` is not satisfied
2-
--> tests/ui-fail-nightly/database-types.rs:7:10
3-
|
4-
7 | struct A(Unknown);
5-
| ^^^^^^^ the trait `Pool` is not implemented for `Unknown`
6-
|
7-
= help: the trait `Pool` is implemented for `deadpool::managed::Pool<M, C>`
2+
--> tests/ui-fail-nightly/database-types.rs:7:10
3+
|
4+
7 | struct A(Unknown);
5+
| ^^^^^^^ the trait `Pool` is not implemented for `Unknown`
6+
|
7+
= help: the trait `Pool` is implemented for `deadpool::managed::Pool<M, C>`
88
note: required by a bound in `rocket_db_pools::Database::Pool`
9-
--> $WORKSPACE/contrib/db_pools/lib/src/database.rs
10-
|
11-
| type Pool: Pool;
12-
| ^^^^ required by this bound in `rocket_db_pools::Database::Pool`
9+
--> $WORKSPACE/contrib/db_pools/lib/src/database.rs
10+
|
11+
| type Pool: Pool;
12+
| ^^^^ required by this bound in `Database::Pool`
1313

1414
error[E0277]: the trait bound `Vec<i32>: Pool` is not satisfied
1515
--> tests/ui-fail-nightly/database-types.rs:11:10
@@ -22,4 +22,4 @@ note: required by a bound in `rocket_db_pools::Database::Pool`
2222
--> $WORKSPACE/contrib/db_pools/lib/src/database.rs
2323
|
2424
| type Pool: Pool;
25-
| ^^^^ required by this bound in `rocket_db_pools::Database::Pool`
25+
| ^^^^ required by this bound in `Database::Pool`

0 commit comments

Comments
 (0)