mirror of
https://github.com/rwf2/Rocket.git
synced 2025-01-25 10:52:22 +00:00
0a56312607
* Trailing slashes are now allowed in all normalized URI paths, except for route attribute URIs: `/foo/` is considered normalized. * Query parts of URIs may now be empty: `/foo?` and `/foo/?` are now considered normalized. * The `base` field of `Catcher` is now only accessible via a new getter method: `Catcher::base()`. * `RawStr::split()` returns a `DoubleEndedIterator`. * Introduced a second normalization for `Origin`, "nontrailing", and associated methods: `Origin::normalize_nontrailing()`, and `Origin::is_normalized_nontrailing()`. * Added `Origin::has_trailing_slash()`. * The `Segments<Path>` iterator will now return an empty string if there is a trailing slash in the referenced path. * `Segments::len()` is now `Segments::num()`. * Added `RawStr::trim()`. Resolves #2512.
24 lines
675 B
Rust
24 lines
675 B
Rust
#![no_main]
|
|
|
|
use rocket::http::uri::*;
|
|
use libfuzzer_sys::fuzz_target;
|
|
|
|
fn fuzz(data: &str) {
|
|
if let Ok(uri) = Uri::parse_any(data) {
|
|
match uri {
|
|
Uri::Origin(uri) if uri.is_normalized() => {
|
|
assert_eq!(uri.clone(), uri.into_normalized());
|
|
}
|
|
Uri::Absolute(uri) if uri.is_normalized() => {
|
|
assert_eq!(uri.clone(), uri.into_normalized());
|
|
}
|
|
Uri::Reference(uri) if uri.is_normalized() => {
|
|
assert_eq!(uri.clone(), uri.into_normalized());
|
|
}
|
|
_ => { /* not normalizable */ },
|
|
}
|
|
}
|
|
}
|
|
|
|
fuzz_target!(|data: &str| { fuzz(data) });
|