diff options
| author | Stefan Boberg <[email protected]> | 2026-04-20 10:58:35 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-20 10:58:35 +0200 |
| commit | 71cce4951b7e132c3aff5eb4cbe2985aca527e46 (patch) | |
| tree | 5c99d9462f4b78726a0e6193bc78002049c57760 /src/zenhttp/include | |
| parent | Move ZipFs from zenserver frontend into zenhttp (#980) (diff) | |
| download | archived-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.h | 7 |
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; |