Merge branch 'rwf2:master' into fix_issue_1224

This commit is contained in:
Jesper Steen Møller 2024-12-02 13:38:25 +01:00 committed by GitHub
commit fd4a6f5cde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 19 additions and 28 deletions

View File

@ -22,7 +22,7 @@ minijinja = ["dep:minijinja"]
[dependencies] [dependencies]
walkdir = "2.4" walkdir = "2.4"
notify = "6" notify = "7"
normpath = "1" normpath = "1"
tera = { version = "1.19.0", optional = true } tera = { version = "1.19.0", optional = true }

View File

@ -20,7 +20,7 @@ default = ["tungstenite"]
tungstenite = ["tokio-tungstenite"] tungstenite = ["tokio-tungstenite"]
[dependencies] [dependencies]
tokio-tungstenite = { version = "0.23", optional = true } tokio-tungstenite = { version = "0.24", optional = true }
[dependencies.rocket] [dependencies.rocket]
version = "0.6.0-dev" version = "0.6.0-dev"

View File

@ -258,19 +258,9 @@ impl RawStr {
/// # extern crate rocket; /// # extern crate rocket;
/// use rocket::http::RawStr; /// use rocket::http::RawStr;
/// ///
/// let raw_str = RawStr::new("Hello%21"); /// let raw_str = RawStr::new("Hello/goodbye");
/// let decoded = raw_str.percent_decode(); /// let encoded = raw_str.percent_encode();
/// assert_eq!(decoded, Ok("Hello!".into())); /// assert_eq!(encoded.as_str(), "Hello%2Fgoodbye");
/// ```
///
/// 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());
/// ``` /// ```
#[inline(always)] #[inline(always)]
pub fn percent_encode(&self) -> Cow<'_, RawStr> { pub fn percent_encode(&self) -> Cow<'_, RawStr> {
@ -288,6 +278,7 @@ impl RawStr {
/// // Note: Rocket should never hand you a bad `&RawStr`. /// // Note: Rocket should never hand you a bad `&RawStr`.
/// let bytes = &[93, 12, 0, 13, 1]; /// let bytes = &[93, 12, 0, 13, 1];
/// let encoded = RawStr::percent_encode_bytes(&bytes[..]); /// let encoded = RawStr::percent_encode_bytes(&bytes[..]);
/// assert_eq!(encoded.as_str(), "]%0C%00%0D%01");
/// ``` /// ```
#[inline(always)] #[inline(always)]
pub fn percent_encode_bytes(bytes: &[u8]) -> Cow<'_, RawStr> { pub fn percent_encode_bytes(bytes: &[u8]) -> Cow<'_, RawStr> {

View File

@ -121,14 +121,14 @@ version = "2.1.0"
optional = true optional = true
[dependencies.s2n-quic] [dependencies.s2n-quic]
version = "1.36" version = "1.51"
default-features = false default-features = false
features = ["provider-address-token-default", "provider-tls-rustls"] features = ["provider-address-token-default", "provider-tls-rustls"]
optional = true optional = true
[dependencies.s2n-quic-h3] [dependencies.s2n-quic-h3]
git = "https://github.com/SergioBenitez/s2n-quic-h3.git" git = "https://github.com/SergioBenitez/s2n-quic-h3.git"
rev = "6613956" rev = "f832471"
optional = true optional = true
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]

View File

@ -24,7 +24,7 @@ impl Bind for TcpListener {
type Error = Either<figment::Error, io::Error>; type Error = Either<figment::Error, io::Error>;
async fn bind(rocket: &Rocket<Ignite>) -> Result<Self, Self::Error> { async fn bind(rocket: &Rocket<Ignite>) -> Result<Self, Self::Error> {
let endpoint = Self::bind_endpoint(&rocket)?; let endpoint = Self::bind_endpoint(rocket)?;
let addr = endpoint.tcp() let addr = endpoint.tcp()
.ok_or_else(|| io::Error::other("internal error: invalid endpoint")) .ok_or_else(|| io::Error::other("internal error: invalid endpoint"))
.map_err(Right)?; .map_err(Right)?;

View File

@ -75,7 +75,7 @@ impl Bind for UnixListener {
type Error = Either<figment::Error, io::Error>; type Error = Either<figment::Error, io::Error>;
async fn bind(rocket: &Rocket<Ignite>) -> Result<Self, Self::Error> { async fn bind(rocket: &Rocket<Ignite>) -> Result<Self, Self::Error> {
let endpoint = Self::bind_endpoint(&rocket)?; let endpoint = Self::bind_endpoint(rocket)?;
let path = endpoint.unix() let path = endpoint.unix()
.ok_or_else(|| Right(io::Error::other("internal error: invalid endpoint")))?; .ok_or_else(|| Right(io::Error::other("internal error: invalid endpoint")))?;

View File

@ -39,7 +39,7 @@ use crate::http::uri::{Segments, error::PathError, fmt::Path};
/// If `usize::from_param` returns an `Ok(usize)` variant, the encapsulated /// If `usize::from_param` returns an `Ok(usize)` variant, the encapsulated
/// value is used as the `id` function parameter. If not, the request is /// 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 /// 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. /// `id` values.
/// ///
/// # Catching Errors /// # Catching Errors

View File

@ -159,7 +159,7 @@ use crate::{Rocket, Ignite};
/// ///
/// **Note:** _Rocket actively discourages using `impl Trait` in route /// **Note:** _Rocket actively discourages using `impl Trait` in route
/// signatures. In addition to impeding sentinel discovery, doing so decreases /// 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, /// 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` /// it is not possible to name the underlying concrete type of an `impl Trait`

View File

@ -876,7 +876,7 @@ use rocket::data::{Data, ToByteUnit};
#[post("/debug", data = "<data>")] #[post("/debug", data = "<data>")]
async fn debug(data: Data<'_>) -> std::io::Result<()> { 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()) data.open(512.kibibytes())
.stream_to(tokio::io::stdout()) .stream_to(tokio::io::stdout())
.await?; .await?;

View File

@ -6,7 +6,7 @@ summary = "overview and customization of Rocket application configuration"
Rocket's configuration system is flexible. Based on [Figment](@figment), it Rocket's configuration system is flexible. Based on [Figment](@figment), it
allows you to configure your application the way _you_ want while also providing 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 ## Overview

View File

@ -169,17 +169,17 @@ function test_default() {
indir "${BENCHMARKS_ROOT}" $CARGO update indir "${BENCHMARKS_ROOT}" $CARGO update
indir "${BENCHMARKS_ROOT}" $CARGO check --benches --all-features $@ 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 case "$OSTYPE" in
darwin* | linux*) darwin* | linux*)
echo ":: Checking testbench..." echo ":: Checking testbench..."
indir "${TESTBENCH_ROOT}" $CARGO update indir "${TESTBENCH_ROOT}" $CARGO update
indir "${TESTBENCH_ROOT}" $CARGO check $@ 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 esac
} }