Handle chunked HTTP correctly

This commit is contained in:
Pascal Engélibert 2026-01-16 16:45:40 +01:00
commit 1d62dae785
6 changed files with 799 additions and 198 deletions

View file

@ -1,7 +1,10 @@
#![feature(ascii_char)]
mod client;
mod http;
mod record;
mod server;
mod util;
use record::Records;
@ -29,6 +32,8 @@ enum Subcommand {
Print(OptPrint),
/// Record traffic
Record(OptRecord),
/// Write test record
Test(OptTest),
}
/// Replay from records
@ -68,6 +73,9 @@ struct OptPrint {
/// Print packets
#[argp(switch, short = 'p')]
packets: bool,
/// Record number
#[argp(option, short = 'n')]
number: Option<u64>,
}
/// Record traffic
@ -75,6 +83,11 @@ struct OptPrint {
#[argp(subcommand, name = "record")]
struct OptRecord {}
/// Record traffic
#[derive(FromArgs)]
#[argp(subcommand, name = "test")]
struct OptTest {}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum RunMode {
Client,
@ -228,10 +241,13 @@ async fn main() {
}
Subcommand::Print(subopt) => {
let records = record::read_record_file(&opt.record_file);
record::print_records(&records, subopt.packets);
record::print_records(&records, subopt.packets, subopt.number);
}
Subcommand::Record(_subopt) => {
record::make_record(&opt.record_file);
}
Subcommand::Test(_subopt) => {
record::make_test_record(&opt.record_file);
}
}
}