mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-26 06:57:43 +02:00
Actix Web Rustls v0.21 support (#3116)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::{borrow::Cow, fmt::Write as _};
|
||||
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
|
||||
@ -8,9 +8,10 @@ fn compare_quoters(c: &mut Criterion) {
|
||||
let mut group = c.benchmark_group("Compare Quoters");
|
||||
|
||||
let quoter = actix_router::Quoter::new(b"", b"");
|
||||
let path_quoted = (0..=0x7f)
|
||||
.map(|c| format!("%{:02X}", c))
|
||||
.collect::<String>();
|
||||
let path_quoted = (0..=0x7f).fold(String::new(), |mut buf, c| {
|
||||
write!(&mut buf, "%{:02X}", c).unwrap();
|
||||
buf
|
||||
});
|
||||
let path_unquoted = ('\u{00}'..='\u{7f}').collect::<String>();
|
||||
|
||||
group.bench_function("quoter_unquoted", |b| {
|
||||
|
@ -62,6 +62,8 @@ impl ResourcePath for Url {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fmt::Write as _;
|
||||
|
||||
use http::Uri;
|
||||
|
||||
use super::*;
|
||||
@ -78,7 +80,11 @@ mod tests {
|
||||
}
|
||||
|
||||
fn percent_encode(data: &[u8]) -> String {
|
||||
data.iter().map(|c| format!("%{:02X}", c)).collect()
|
||||
data.iter()
|
||||
.fold(String::with_capacity(data.len() * 3), |mut buf, c| {
|
||||
write!(&mut buf, "%{:02X}", c).unwrap();
|
||||
buf
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user