Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions 7 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ A set of types for representing HTTP requests and responses.
"""
keywords = ["http"]
categories = ["web-programming"]
edition = "2018"
# When updating this value, don't forget to also adjust the GitHub Actions config.
rust-version = "1.49.0"
edition = "2021"
rust-version = "1.57.0"

[workspace]
members = [
Expand All @@ -43,7 +42,7 @@ itoa = "1"

[dev-dependencies]
quickcheck = "1"
rand = "0.9.1"
rand = "0.8.0"
serde = "1.0"
serde_json = "1.0"
doc-comment = "0.3"
4 changes: 2 additions & 2 deletions 4 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ fn main() {

# Supported Rust Versions

This project follows the [Tokio MSRV][msrv] and is currently set to `1.49`.
This project follows the [hyper's MSRV _policy_][msrv], though it can be lower, and is currently set to `1.57`.

[msrv]: https://github.com/tokio-rs/tokio/#supported-rust-versions
[msrv]: https://hyper.rs/contrib/msrv/

# License

Expand Down
20 changes: 10 additions & 10 deletions 20 tests/header_map_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use http::header::*;
use http::*;

use quickcheck::{Arbitrary, Gen, QuickCheck, TestResult};
use rand::prelude::IndexedRandom;
use rand::rngs::StdRng;
use rand::seq::SliceRandom;
use rand::{Rng, SeedableRng};

use std::collections::HashMap;
Expand Down Expand Up @@ -76,12 +76,12 @@ impl Fuzz {

let mut steps = vec![];
let mut expect = AltMap::default();
let num = rng.random_range(5..500);
let num = rng.gen_range(5..500);

let weight = Weight {
insert: rng.random_range(1..10),
remove: rng.random_range(1..10),
append: rng.random_range(1..10),
insert: rng.gen_range(1..10),
remove: rng.gen_range(1..10),
append: rng.gen_range(1..10),
};

while steps.len() < num {
Expand Down Expand Up @@ -112,7 +112,7 @@ impl Fuzz {

impl Arbitrary for Fuzz {
fn arbitrary(_: &mut Gen) -> Self {
Self::new(rand::rng().random())
Self::new(rand::thread_rng().gen())
}
}

Expand All @@ -130,7 +130,7 @@ impl AltMap {
fn gen_action(&mut self, weight: &Weight, rng: &mut StdRng) -> Action {
let sum = weight.insert + weight.remove + weight.append;

let mut num = rng.random_range(0..sum);
let mut num = rng.gen_range(0..sum);

if num < weight.insert {
return self.gen_insert(rng);
Expand Down Expand Up @@ -180,7 +180,7 @@ impl AltMap {

/// Negative numbers weigh finding an existing header higher
fn gen_name(&self, weight: i32, rng: &mut StdRng) -> HeaderName {
let mut existing = rng.random_ratio(1, weight.abs() as u32);
let mut existing = rng.gen_ratio(1, weight.abs() as u32);

if weight < 0 {
existing = !existing;
Expand All @@ -202,7 +202,7 @@ impl AltMap {
if self.map.is_empty() {
None
} else {
let n = rng.random_range(0..self.map.len());
let n = rng.gen_range(0..self.map.len());
self.map.keys().nth(n).map(Clone::clone)
}
}
Expand Down Expand Up @@ -337,7 +337,7 @@ fn gen_header_name(g: &mut StdRng) -> HeaderName {
header::X_XSS_PROTECTION,
];

if g.random_ratio(1, 2) {
if g.gen_ratio(1, 2) {
STANDARD_HEADERS.choose(g).unwrap().clone()
} else {
let value = gen_string(g, 1, 25);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.