From fd75d0ccca37ea344b3625560d0d072c3f86a6c1 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Mon, 21 Oct 2024 20:51:58 -0400 Subject: [PATCH 1/8] Fix minor typos in guide and docstring --- core/lib/src/sentinel.rs | 2 +- docs/guide/05-requests.md | 2 +- docs/guide/10-configuration.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/lib/src/sentinel.rs b/core/lib/src/sentinel.rs index 2ac1ec9af3..c825b299e8 100644 --- a/core/lib/src/sentinel.rs +++ b/core/lib/src/sentinel.rs @@ -159,7 +159,7 @@ use crate::{Rocket, Ignite}; /// /// **Note:** _Rocket actively discourages using `impl Trait` in route /// signatures. In addition to impeding sentinel discovery, doing so decreases -/// the ability to gleam a handler's functionality based on its type signature._ +/// the ability to glean a handler's functionality based on its type signature._ /// /// The return type of the route `f` depends on its implementation. At present, /// it is not possible to name the underlying concrete type of an `impl Trait` diff --git a/docs/guide/05-requests.md b/docs/guide/05-requests.md index d3ad9792cd..5e8e0bcf95 100644 --- a/docs/guide/05-requests.md +++ b/docs/guide/05-requests.md @@ -876,7 +876,7 @@ use rocket::data::{Data, ToByteUnit}; #[post("/debug", data = "")] async fn debug(data: Data<'_>) -> std::io::Result<()> { - // Stream at most 512KiB all of the body data to stdout. + // Stream at most 512KiB of the body data to stdout. data.open(512.kibibytes()) .stream_to(tokio::io::stdout()) .await?; diff --git a/docs/guide/10-configuration.md b/docs/guide/10-configuration.md index 02218bb5f0..ffe018eac5 100644 --- a/docs/guide/10-configuration.md +++ b/docs/guide/10-configuration.md @@ -6,7 +6,7 @@ summary = "overview and customization of Rocket application configuration" Rocket's configuration system is flexible. Based on [Figment](@figment), it allows you to configure your application the way _you_ want while also providing -with a sensible set of defaults. +a sensible set of defaults. ## Overview From ebfcbd2c759dc232e210b59c3a4a56f66f22f4a3 Mon Sep 17 00:00:00 2001 From: sheshnath-at-knoldus Date: Thu, 1 Aug 2024 18:39:08 +0530 Subject: [PATCH 2/8] fixed clippy warnings --- core/codegen/src/attribute/route/mod.rs | 8 ++++++-- core/lib/src/listener/tcp.rs | 2 +- core/lib/src/listener/unix.rs | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/codegen/src/attribute/route/mod.rs b/core/codegen/src/attribute/route/mod.rs index 506102499c..b2979d3fac 100644 --- a/core/codegen/src/attribute/route/mod.rs +++ b/core/codegen/src/attribute/route/mod.rs @@ -266,8 +266,12 @@ fn internal_uri_macro_decl(route: &Route) -> TokenStream { route.attr.method.as_ref().map(|m| m.0.hash(&mut hasher)); route.attr.uri.path().hash(&mut hasher); route.attr.uri.query().hash(&mut hasher); - route.attr.data.as_ref().map(|d| d.value.hash(&mut hasher)); - route.attr.format.as_ref().map(|f| f.0.hash(&mut hasher)); + if let Some(data) = &route.attr.data { + data.value.hash(&mut hasher); + } + if let Some(format) = &route.attr.format { + format.0.hash(&mut hasher); + } }); let route_uri = route.attr.uri.to_string(); diff --git a/core/lib/src/listener/tcp.rs b/core/lib/src/listener/tcp.rs index 61252c7d79..bdf337ee18 100644 --- a/core/lib/src/listener/tcp.rs +++ b/core/lib/src/listener/tcp.rs @@ -24,7 +24,7 @@ impl Bind for TcpListener { type Error = Either; async fn bind(rocket: &Rocket) -> Result { - let endpoint = Self::bind_endpoint(&rocket)?; + let endpoint = Self::bind_endpoint(rocket)?; let addr = endpoint.tcp() .ok_or_else(|| io::Error::other("internal error: invalid endpoint")) .map_err(Right)?; diff --git a/core/lib/src/listener/unix.rs b/core/lib/src/listener/unix.rs index a6992a7acc..37a22b9dda 100644 --- a/core/lib/src/listener/unix.rs +++ b/core/lib/src/listener/unix.rs @@ -75,7 +75,7 @@ impl Bind for UnixListener { type Error = Either; async fn bind(rocket: &Rocket) -> Result { - let endpoint = Self::bind_endpoint(&rocket)?; + let endpoint = Self::bind_endpoint(rocket)?; let path = endpoint.unix() .ok_or_else(|| Right(io::Error::other("internal error: invalid endpoint")))?; From b453bd589bc0a072b4203ef5efff47a66a66c639 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 2 Dec 2024 10:37:48 +0100 Subject: [PATCH 3/8] Revert unnecessary change for clippy. --- core/codegen/src/attribute/route/mod.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/codegen/src/attribute/route/mod.rs b/core/codegen/src/attribute/route/mod.rs index b2979d3fac..506102499c 100644 --- a/core/codegen/src/attribute/route/mod.rs +++ b/core/codegen/src/attribute/route/mod.rs @@ -266,12 +266,8 @@ fn internal_uri_macro_decl(route: &Route) -> TokenStream { route.attr.method.as_ref().map(|m| m.0.hash(&mut hasher)); route.attr.uri.path().hash(&mut hasher); route.attr.uri.query().hash(&mut hasher); - if let Some(data) = &route.attr.data { - data.value.hash(&mut hasher); - } - if let Some(format) = &route.attr.format { - format.0.hash(&mut hasher); - } + route.attr.data.as_ref().map(|d| d.value.hash(&mut hasher)); + route.attr.format.as_ref().map(|f| f.0.hash(&mut hasher)); }); let route_uri = route.attr.uri.to_string(); From 3fd5508629e42e3cb2a188d9a31cde7eb8026111 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 2 Dec 2024 10:58:14 +0100 Subject: [PATCH 4/8] Sync 's2n-quic-h3' to fix upstream bug. --- core/lib/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/Cargo.toml b/core/lib/Cargo.toml index 0ce5f3a854..a2ed3b40dc 100644 --- a/core/lib/Cargo.toml +++ b/core/lib/Cargo.toml @@ -121,14 +121,14 @@ version = "2.1.0" optional = true [dependencies.s2n-quic] -version = "1.36" +version = "1.51" default-features = false features = ["provider-address-token-default", "provider-tls-rustls"] optional = true [dependencies.s2n-quic-h3] git = "https://github.com/SergioBenitez/s2n-quic-h3.git" -rev = "6613956" +rev = "f832471" optional = true [target.'cfg(unix)'.dependencies] From f058f6e01d6abc27ea766edd23db16edfac3affc Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 2 Dec 2024 11:08:09 +0100 Subject: [PATCH 5/8] Fix error code in 'FromParam' rustdocs. Resolves #2880. --- core/lib/src/request/from_param.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/src/request/from_param.rs b/core/lib/src/request/from_param.rs index f639d38efb..ac701eb8f2 100644 --- a/core/lib/src/request/from_param.rs +++ b/core/lib/src/request/from_param.rs @@ -39,7 +39,7 @@ use crate::http::uri::{Segments, error::PathError, fmt::Path}; /// If `usize::from_param` returns an `Ok(usize)` variant, the encapsulated /// value is used as the `id` function parameter. If not, the request is /// forwarded to the next matching route. Since there are no additional matching -/// routes, this example will result in a 404 error for requests with invalid +/// routes, this example will result in a 422 error for requests with invalid /// `id` values. /// /// # Catching Errors From ea0a1af683e1e1330825963d6d68c518b29952e9 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Sun, 24 Nov 2024 12:23:08 -0500 Subject: [PATCH 6/8] Improve 'RawStr' percent encoding doctests. --- core/http/src/raw_str.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/core/http/src/raw_str.rs b/core/http/src/raw_str.rs index 3606502bd6..88e7a44f7c 100644 --- a/core/http/src/raw_str.rs +++ b/core/http/src/raw_str.rs @@ -258,19 +258,9 @@ impl RawStr { /// # extern crate rocket; /// use rocket::http::RawStr; /// - /// let raw_str = RawStr::new("Hello%21"); - /// let decoded = raw_str.percent_decode(); - /// assert_eq!(decoded, Ok("Hello!".into())); - /// ``` - /// - /// With an invalid string: - /// - /// ```rust - /// # extern crate rocket; - /// use rocket::http::RawStr; - /// - /// let bad_raw_str = RawStr::new("%FF"); - /// assert!(bad_raw_str.percent_decode().is_err()); + /// let raw_str = RawStr::new("Hello/goodbye"); + /// let encoded = raw_str.percent_encode(); + /// assert_eq!(encoded.as_str(), "Hello%2Fgoodbye"); /// ``` #[inline(always)] pub fn percent_encode(&self) -> Cow<'_, RawStr> { @@ -288,6 +278,7 @@ impl RawStr { /// // Note: Rocket should never hand you a bad `&RawStr`. /// let bytes = &[93, 12, 0, 13, 1]; /// let encoded = RawStr::percent_encode_bytes(&bytes[..]); + /// assert_eq!(encoded.as_str(), "]%0C%00%0D%01"); /// ``` #[inline(always)] pub fn percent_encode_bytes(bytes: &[u8]) -> Cow<'_, RawStr> { From 4c232c7f746f9d507ffe998faae114e6b7b00854 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 2 Dec 2024 11:49:14 +0100 Subject: [PATCH 7/8] Skip fuzzer check on Windows. --- scripts/test.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/test.sh b/scripts/test.sh index 612c4659be..13df52cdc2 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -169,17 +169,17 @@ function test_default() { indir "${BENCHMARKS_ROOT}" $CARGO update indir "${BENCHMARKS_ROOT}" $CARGO check --benches --all-features $@ - echo ":: Checking fuzzers..." - indir "${FUZZ_ROOT}" $CARGO update - indir "${FUZZ_ROOT}" $CARGO check --all --all-features $@ - case "$OSTYPE" in darwin* | linux*) echo ":: Checking testbench..." indir "${TESTBENCH_ROOT}" $CARGO update indir "${TESTBENCH_ROOT}" $CARGO check $@ + + echo ":: Checking fuzzers..." + indir "${FUZZ_ROOT}" $CARGO update + indir "${FUZZ_ROOT}" $CARGO check --all --all-features $@ ;; - *) echo ":: Skipping testbench [$OSTYPE]" ;; + *) echo ":: Skipping testbench, fuzzers [$OSTYPE]" ;; esac } From 28891e8072136f4641a33fb8c3f2aafce9d88d5b Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 2 Dec 2024 11:55:57 +0100 Subject: [PATCH 8/8] Update 'tokio-tungstenite' to 0.24, 'notify' to 7. --- contrib/dyn_templates/Cargo.toml | 2 +- contrib/ws/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/dyn_templates/Cargo.toml b/contrib/dyn_templates/Cargo.toml index f34bcd1b55..9a0eea923a 100644 --- a/contrib/dyn_templates/Cargo.toml +++ b/contrib/dyn_templates/Cargo.toml @@ -22,7 +22,7 @@ minijinja = ["dep:minijinja"] [dependencies] walkdir = "2.4" -notify = "6" +notify = "7" normpath = "1" tera = { version = "1.19.0", optional = true } diff --git a/contrib/ws/Cargo.toml b/contrib/ws/Cargo.toml index 079b36322d..63bbf3940c 100644 --- a/contrib/ws/Cargo.toml +++ b/contrib/ws/Cargo.toml @@ -20,7 +20,7 @@ default = ["tungstenite"] tungstenite = ["tokio-tungstenite"] [dependencies] -tokio-tungstenite = { version = "0.23", optional = true } +tokio-tungstenite = { version = "0.24", optional = true } [dependencies.rocket] version = "0.6.0-dev"