From 546982ad5164581ebf2d294426de8189084aae60 Mon Sep 17 00:00:00 2001 From: hatoo Date: Sat, 11 Jul 2026 15:08:46 +0900 Subject: [PATCH] Change default redirect limit to 0 Following redirects requires looking up the `Location` header on every response, which shows up as overhead in the hot path. Most load tests target a single endpoint and don't need redirection, so disable it by default; pass `-r ` to opt back in. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 2 +- src/lib.rs | 2 +- tests/tests.rs | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 875f60af..ce92be20 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ Options: --disable-compression Disable compression. -r, --redirect - Limit for number of Redirect. Set 0 for no redirection. Redirection isn't supported for HTTP/2. [default: 10] + Limit for number of Redirect. Set 0 for no redirection. Redirection isn't supported for HTTP/2. [default: 0] --disable-keepalive Disable keep-alive, prevents re-use of TCP connections between different HTTP requests. This isn't supported for HTTP/2. --no-pre-lookup diff --git a/src/lib.rs b/src/lib.rs index db144066..4bdf0621 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -233,7 +233,7 @@ Note: If qps is specified, burst will be ignored", disable_compression: bool, #[arg( help = "Limit for number of Redirect. Set 0 for no redirection. Redirection isn't supported for HTTP/2.", - default_value = "10", + default_value = "0", short = 'r', long = "redirect" )] diff --git a/tests/tests.rs b/tests/tests.rs index cf4c50ee..77634921 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -352,6 +352,8 @@ async fn get_host_with_connect_to_redirect(host: &'static str) -> String { let args = [ "-n".to_string(), "1".to_string(), + "-r".to_string(), + "10".to_string(), format!("http://{host}/source"), "--connect-to".to_string(), format!("{host}:80:localhost:{port}"),