aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/include
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-04-20 10:58:35 +0200
committerGitHub Enterprise <[email protected]>2026-04-20 10:58:35 +0200
commit71cce4951b7e132c3aff5eb4cbe2985aca527e46 (patch)
tree5c99d9462f4b78726a0e6193bc78002049c57760 /src/zenhttp/include
parentMove ZipFs from zenserver frontend into zenhttp (#980) (diff)
downloadarchived-zen-71cce4951b7e132c3aff5eb4cbe2985aca527e46.tar.xz
archived-zen-71cce4951b7e132c3aff5eb4cbe2985aca527e46.zip
zenhttp: add FollowRedirects option to HttpClient (#982)
- Adds `FollowRedirects` (default `false`) and `MaxRedirects` (default `5`) fields to `HttpClientSettings`. - When `FollowRedirects` is enabled, the curl backend sets `CURLOPT_FOLLOWLOCATION` and `CURLOPT_MAXREDIRS` so HTTP 3xx redirects are handled transparently in the transport layer — callers no longer need to parse `Location` headers and re-issue requests themselves. - Defaults are off, so existing callers see no behavior change.
Diffstat (limited to 'src/zenhttp/include')
-rw-r--r--src/zenhttp/include/zenhttp/httpclient.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/zenhttp/include/zenhttp/httpclient.h b/src/zenhttp/include/zenhttp/httpclient.h
index e199b700f..8da94524e 100644
--- a/src/zenhttp/include/zenhttp/httpclient.h
+++ b/src/zenhttp/include/zenhttp/httpclient.h
@@ -120,6 +120,13 @@ struct HttpClientSettings
/// the system default CA store.
std::string CaBundlePath;
+ /// Automatically follow HTTP 3xx redirects. When true, curl handles
+ /// redirects internally (up to MaxRedirects hops). Default: false.
+ bool FollowRedirects = false;
+
+ /// Maximum number of redirects to follow when FollowRedirects is true.
+ int MaxRedirects = 5;
+
/// HTTP status codes that are expected and should not be logged as warnings.
/// 404 is always treated as expected regardless of this list.
std::vector<HttpResponseCode> ExpectedErrorCodes;