From 99d04696cd82a0b4e0613d05e53dce1fe977c452 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Tue, 21 May 2024 16:40:12 -0600 Subject: [PATCH] Publish 0.1.5 to fight fraudulent CVE --- Cargo.toml | 2 +- benches/bench.rs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7387b38..25c8929 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "urlnorm" -version = "0.1.3" +version = "0.1.5" edition = "2021" description = "A URL normalization library for Rust" license = "Apache-2.0 OR MIT" diff --git a/benches/bench.rs b/benches/bench.rs index cc51b86..b1c6528 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -14,5 +14,22 @@ pub fn normalize_benchmark(c: &mut Criterion) { }); } -criterion_group!(benches, normalize_benchmark); +pub fn torture_test(c: &mut Criterion) { + let x = std::iter::repeat("A5.html") + .take(50000) + .collect::() + .to_owned(); + let mut url_input = "https://goooooooogle.com/hello/index.html/".to_owned(); + url_input.push_str(x.as_str()); + let url = Url::parse(&url_input).unwrap(); + + let norm = UrlNormalizer::default(); + c.bench_function("normalize url", |b| { + b.iter(|| { + norm.compute_normalization_string(&url); + }) + }); +} + +criterion_group!(benches, normalize_benchmark, torture_test); criterion_main!(benches);