Compare commits

..

No commits in common. "a53f86190d64befcebc73388f349cef60080ef22" and "4a241bcd74c588993524a582dd33639d149827c2" have entirely different histories.

12 changed files with 63 additions and 37 deletions

View File

@ -49,7 +49,7 @@ jobs:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean - name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.48.1 uses: taiki-e/install-action@v2.47.18
with: with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -83,7 +83,7 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1 uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
- name: Install just, cargo-hack - name: Install just, cargo-hack
uses: taiki-e/install-action@v2.48.1 uses: taiki-e/install-action@v2.47.18
with: with:
tool: just,cargo-hack tool: just,cargo-hack

View File

@ -64,7 +64,7 @@ jobs:
toolchain: ${{ matrix.version.version }} toolchain: ${{ matrix.version.version }}
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean - name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.48.1 uses: taiki-e/install-action@v2.47.18
with: with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -113,7 +113,7 @@ jobs:
toolchain: nightly toolchain: nightly
- name: Install just - name: Install just
uses: taiki-e/install-action@v2.48.1 uses: taiki-e/install-action@v2.47.18
with: with:
tool: just tool: just

View File

@ -24,7 +24,7 @@ jobs:
components: llvm-tools components: llvm-tools
- name: Install just, cargo-llvm-cov, cargo-nextest - name: Install just, cargo-llvm-cov, cargo-nextest
uses: taiki-e/install-action@v2.48.1 uses: taiki-e/install-action@v2.47.18
with: with:
tool: just,cargo-llvm-cov,cargo-nextest tool: just,cargo-llvm-cov,cargo-nextest
@ -32,7 +32,7 @@ jobs:
run: just test-coverage-codecov run: just test-coverage-codecov
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.3.1 uses: codecov/codecov-action@v5.1.2
with: with:
files: codecov.json files: codecov.json
fail_ci_if_error: true fail_ci_if_error: true

View File

@ -77,12 +77,12 @@ jobs:
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }} toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
- name: Install just - name: Install just
uses: taiki-e/install-action@v2.48.1 uses: taiki-e/install-action@v2.47.18
with: with:
tool: just tool: just
- name: Install cargo-check-external-types - name: Install cargo-check-external-types
uses: taiki-e/cache-cargo-install-action@v2.1.0 uses: taiki-e/cache-cargo-install-action@v2.0.1
with: with:
tool: cargo-check-external-types tool: cargo-check-external-types

View File

@ -16,7 +16,6 @@ use actix_utils::future::{err, ok, ready};
use bytes::Bytes; use bytes::Bytes;
use derive_more::derive::{Display, Error}; use derive_more::derive::{Display, Error};
use futures_util::{stream::once, FutureExt as _, StreamExt as _}; use futures_util::{stream::once, FutureExt as _, StreamExt as _};
use rand::Rng as _;
use regex::Regex; use regex::Regex;
#[actix_rt::test] #[actix_rt::test]
@ -165,10 +164,7 @@ async fn chunked_payload() {
for chunk_size in chunk_sizes.iter() { for chunk_size in chunk_sizes.iter() {
let mut bytes = Vec::new(); let mut bytes = Vec::new();
let random_bytes = rand::rng() let random_bytes: Vec<u8> = (0..*chunk_size).map(|_| rand::random::<u8>()).collect();
.sample_iter(rand::distr::StandardUniform)
.take(*chunk_size)
.collect::<Vec<_>>();
bytes.extend(format!("{:X}\r\n", chunk_size).as_bytes()); bytes.extend(format!("{:X}\r\n", chunk_size).as_bytes());
bytes.extend(&random_bytes[..]); bytes.extend(&random_bytes[..]);

View File

@ -5,7 +5,10 @@ use actix_web::{
web::{BufMut as _, Bytes, BytesMut}, web::{BufMut as _, Bytes, BytesMut},
}; };
use mime::Mime; use mime::Mime;
use rand::distr::{Alphanumeric, SampleString as _}; use rand::{
distributions::{Alphanumeric, DistString as _},
thread_rng,
};
const CRLF: &[u8] = b"\r\n"; const CRLF: &[u8] = b"\r\n";
const CRLF_CRLF: &[u8] = b"\r\n\r\n"; const CRLF_CRLF: &[u8] = b"\r\n\r\n";
@ -61,7 +64,7 @@ pub fn create_form_data_payload_and_headers(
content_type: Option<Mime>, content_type: Option<Mime>,
file: Bytes, file: Bytes,
) -> (Bytes, HeaderMap) { ) -> (Bytes, HeaderMap) {
let boundary = Alphanumeric.sample_string(&mut rand::rng(), 32); let boundary = Alphanumeric.sample_string(&mut thread_rng(), 32);
create_form_data_payload_and_headers_with_boundary( create_form_data_payload_and_headers_with_boundary(
&boundary, &boundary,

View File

@ -105,7 +105,7 @@ fn hex_pair_to_char(d1: u8, d2: u8) -> Option<u8> {
let d_low = char::from(d2).to_digit(16)?; let d_low = char::from(d2).to_digit(16)?;
// left shift high nibble by 4 bits // left shift high nibble by 4 bits
Some(((d_high as u8) << 4) | (d_low as u8)) Some((d_high as u8) << 4 | (d_low as u8))
} }
#[derive(Debug, Default, Clone)] #[derive(Debug, Default, Clone)]

View File

@ -1021,7 +1021,6 @@ impl ResourceDef {
panic!("prefix resource definitions should not have tail segments"); panic!("prefix resource definitions should not have tail segments");
} }
#[allow(clippy::literal_string_with_formatting_args)]
if unprocessed.ends_with('*') { if unprocessed.ends_with('*') {
// unnamed tail segment // unnamed tail segment
@ -1370,7 +1369,6 @@ mod tests {
assert_eq!(path.unprocessed(), ""); assert_eq!(path.unprocessed(), "");
} }
#[expect(clippy::literal_string_with_formatting_args)]
#[test] #[test]
fn newline_patterns_and_paths() { fn newline_patterns_and_paths() {
let re = ResourceDef::new("/user/a\nb"); let re = ResourceDef::new("/user/a\nb");

View File

@ -145,7 +145,6 @@ mod tests {
}; };
#[allow(clippy::cognitive_complexity)] #[allow(clippy::cognitive_complexity)]
#[expect(clippy::literal_string_with_formatting_args)]
#[test] #[test]
fn test_recognizer_1() { fn test_recognizer_1() {
let mut router = Router::<usize>::build(); let mut router = Router::<usize>::build();

View File

@ -25,10 +25,7 @@ use openssl::{
ssl::{SslAcceptor, SslMethod}, ssl::{SslAcceptor, SslMethod},
x509::X509, x509::X509,
}; };
use rand::{ use rand::{distributions::Alphanumeric, Rng as _};
distr::{Alphanumeric, SampleString as _},
Rng as _,
};
mod utils; mod utils;
@ -191,7 +188,11 @@ async fn body_gzip_large() {
#[actix_rt::test] #[actix_rt::test]
async fn test_body_gzip_large_random() { async fn test_body_gzip_large_random() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 70_000); let data = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(70_000)
.map(char::from)
.collect::<String>();
let srv_data = data.clone(); let srv_data = data.clone();
let srv = actix_test::start_with(actix_test::config().h1(), move || { let srv = actix_test::start_with(actix_test::config().h1(), move || {
@ -431,7 +432,11 @@ async fn test_zstd_encoding() {
#[actix_rt::test] #[actix_rt::test]
async fn test_zstd_encoding_large() { async fn test_zstd_encoding_large() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 320_000); let data = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(320_000)
.map(char::from)
.collect::<String>();
let srv = actix_test::start_with(actix_test::config().h1(), || { let srv = actix_test::start_with(actix_test::config().h1(), || {
App::new().service( App::new().service(
@ -524,7 +529,11 @@ async fn test_gzip_encoding_large() {
#[actix_rt::test] #[actix_rt::test]
async fn test_reading_gzip_encoding_large_random() { async fn test_reading_gzip_encoding_large_random() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 60_000); let data = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(60_000)
.map(char::from)
.collect::<String>();
let srv = actix_test::start_with(actix_test::config().h1(), || { let srv = actix_test::start_with(actix_test::config().h1(), || {
App::new().service(web::resource("/").route(web::to(move |body: Bytes| async { App::new().service(web::resource("/").route(web::to(move |body: Bytes| async {
@ -590,7 +599,11 @@ async fn test_reading_deflate_encoding_large() {
#[actix_rt::test] #[actix_rt::test]
async fn test_reading_deflate_encoding_large_random() { async fn test_reading_deflate_encoding_large_random() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 160_000); let data = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(160_000)
.map(char::from)
.collect::<String>();
let srv = actix_test::start_with(actix_test::config().h1(), || { let srv = actix_test::start_with(actix_test::config().h1(), || {
App::new().service(web::resource("/").route(web::to(move |body: Bytes| async { App::new().service(web::resource("/").route(web::to(move |body: Bytes| async {
@ -635,7 +648,11 @@ async fn test_brotli_encoding() {
#[actix_rt::test] #[actix_rt::test]
async fn test_brotli_encoding_large() { async fn test_brotli_encoding_large() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 320_000); let data = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(320_000)
.map(char::from)
.collect::<String>();
let srv = actix_test::start_with(actix_test::config().h1(), || { let srv = actix_test::start_with(actix_test::config().h1(), || {
App::new().service( App::new().service(
@ -720,7 +737,11 @@ mod plus_rustls {
#[actix_rt::test] #[actix_rt::test]
async fn test_reading_deflate_encoding_large_random_rustls() { async fn test_reading_deflate_encoding_large_random_rustls() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 160_000); let data = rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(160_000)
.map(char::from)
.collect::<String>();
let srv = actix_test::start_with(actix_test::config().rustls_0_23(tls_config()), || { let srv = actix_test::start_with(actix_test::config().rustls_0_23(tls_config()), || {
App::new().service(web::resource("/").route(web::to(|bytes: Bytes| async { App::new().service(web::resource("/").route(web::to(|bytes: Bytes| async {

View File

@ -326,7 +326,7 @@ impl WebsocketsRequest {
// Generate a random key for the `Sec-WebSocket-Key` header which is a base64-encoded // Generate a random key for the `Sec-WebSocket-Key` header which is a base64-encoded
// (see RFC 4648 §4) value that, when decoded, is 16 bytes in length (RFC 6455 §1.3). // (see RFC 4648 §4) value that, when decoded, is 16 bytes in length (RFC 6455 §1.3).
let sec_key = rand::random::<[u8; 16]>(); let sec_key: [u8; 16] = rand::random();
let key = BASE64_STANDARD.encode(sec_key); let key = BASE64_STANDARD.encode(sec_key);
self.head.headers.insert( self.head.headers.insert(

View File

@ -20,10 +20,7 @@ use base64::prelude::*;
use bytes::Bytes; use bytes::Bytes;
use cookie::Cookie; use cookie::Cookie;
use futures_util::stream; use futures_util::stream;
use rand::{ use rand::Rng;
distr::{Alphanumeric, SampleString as _},
Rng,
};
mod utils; mod utils;
@ -519,7 +516,11 @@ async fn client_gzip_encoding_large() {
#[cfg(feature = "compress-gzip")] #[cfg(feature = "compress-gzip")]
#[actix_rt::test] #[actix_rt::test]
async fn client_gzip_encoding_large_random() { async fn client_gzip_encoding_large_random() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 100_000); let data = rand::thread_rng()
.sample_iter(&rand::distributions::Alphanumeric)
.take(100_000)
.map(char::from)
.collect::<String>();
let srv = actix_test::start(|| { let srv = actix_test::start(|| {
App::new().service(web::resource("/").route(web::to(|data: Bytes| async { App::new().service(web::resource("/").route(web::to(|data: Bytes| async {
@ -561,7 +562,11 @@ async fn client_brotli_encoding() {
#[cfg(feature = "compress-brotli")] #[cfg(feature = "compress-brotli")]
#[actix_rt::test] #[actix_rt::test]
async fn client_brotli_encoding_large_random() { async fn client_brotli_encoding_large_random() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 70_000); let data = rand::thread_rng()
.sample_iter(&rand::distributions::Alphanumeric)
.take(70_000)
.map(char::from)
.collect::<String>();
let srv = actix_test::start(|| { let srv = actix_test::start(|| {
App::new().service(web::resource("/").route(web::to(|data: Bytes| async { App::new().service(web::resource("/").route(web::to(|data: Bytes| async {
@ -602,7 +607,11 @@ async fn client_deflate_encoding() {
#[actix_rt::test] #[actix_rt::test]
async fn client_deflate_encoding_large_random() { async fn client_deflate_encoding_large_random() {
let data = Alphanumeric.sample_string(&mut rand::rng(), 70_000); let data = rand::thread_rng()
.sample_iter(rand::distributions::Alphanumeric)
.map(char::from)
.take(70_000)
.collect::<String>();
let srv = actix_test::start(|| { let srv = actix_test::start(|| {
App::new().default_service(web::to(|body: Bytes| async { App::new().default_service(web::to(|body: Bytes| async {