19 DomainCookie = 1 << 2,
28 [[nodiscard]]
bool isInUse()
const {
return not name.isEmpty(); }
37 [[nodiscard]]
bool isInUse()
const {
return not origin.isEmpty(); }
55 Target target = Origin;
56 Scheme scheme = Unsupported;
59 [[nodiscard]]
const char* getTargetName()
const {
return getTargetName(target); }
60 [[nodiscard]]
const char* getSchemeName()
const {
return getSchemeName(scheme); }
61 [[nodiscard]]
static const char* getTargetName(Target target);
62 [[nodiscard]]
static const char* getSchemeName(Scheme scheme);
78 uint8_t maxAttempts = 1;
80 bool retryTransportErrors =
true;
81 bool retryHttpStatusCodes =
true;
82 bool retryNonIdempotentReplayableBody =
false;
88 HttpClientRequest::Method method = HttpClientRequest::HttpGET;
90 uint8_t attemptsStarted = 0;
91 bool requestBodyReplayable =
true;
93 [[nodiscard]]
bool isStarted()
const {
return attemptsStarted > 0; }
94 [[nodiscard]]
bool hasAttemptsRemaining()
const {
return attemptsStarted < policy.maxAttempts; }
95 [[nodiscard]] uint8_t getRemainingAttempts()
const
97 return attemptsStarted < policy.maxAttempts ?
static_cast<uint8_t
>(policy.maxAttempts - attemptsStarted) : 0;
111 void clearAuthorizations();
113 [[nodiscard]] Result addAuthorization(StringSpan origin, StringSpan authorizationHeader);
114 [[nodiscard]]
bool findAuthorization(StringSpan origin, StringSpan& authorizationHeader)
const;
115 [[nodiscard]]
bool hasAuthorization(StringSpan origin)
const;
116 [[nodiscard]]
bool findCookie(StringSpan name, StringSpan domain, StringSpan path,
118 [[nodiscard]]
bool hasCookie(StringSpan name, StringSpan domain, StringSpan path)
const;
122 [[nodiscard]]
static Result makeBasicAuthorization(StringSpan username, StringSpan password, Span<char> destination,
123 StringSpan& authorizationHeader);
125 HttpClientSessionAuthChallenge::Target target,
127 [[nodiscard]]
static Result makeBasicAuthorizationForChallenge(
const HttpClientResponse& response,
128 HttpClientSessionAuthChallenge::Target target,
129 StringSpan username, StringSpan password,
130 Span<char> destination,
131 StringSpan& authorizationHeader);
138 [[nodiscard]]
static bool isIdempotentMethod(HttpClientRequest::Method method);
139 [[nodiscard]]
static bool isRetryableStatusCode(
int statusCode);
141 [[nodiscard]]
bool isInitialized()
const {
return initialized; }
142 [[nodiscard]]
size_t getNumCookies()
const;
143 [[nodiscard]]
size_t getNumAuthorizations()
const;
146 [[nodiscard]] Result copyStateString(StringSpan source, StringSpan& destination);
147 [[nodiscard]] Result appendPreparedHeader(StringSpan name, StringSpan value,
size_t& numHeaders);
148 [[nodiscard]] Result appendScratch(StringSpan text,
bool addSeparator);
149 [[nodiscard]] Result appendMatchingCookies(StringSpan url,
size_t& numHeaders);
150 [[nodiscard]] Result captureSetCookie(StringSpan requestUrl, StringSpan setCookie);
153 size_t stateScratchUsed = 0;
154 size_t headerScratchUsed = 0;
155 bool initialized =
false;
Configuration for an outgoing HTTP request.
Definition HttpClient.h:275
Parsed response metadata filled when headers arrive.
Definition HttpClient.h:304
Caller-managed authorization cache entry for one exact request origin.
Definition HttpClientSession.h:33
StringSpan authorizationHeader
Full Authorization header value, e.g. Basic ...
Definition HttpClientSession.h:35
StringSpan origin
scheme://host[:port]
Definition HttpClientSession.h:34
Authentication challenge parsed from response headers without owning memory.
Definition HttpClientSession.h:42
Cookie state owned by HttpClientSession caller-provided memory.
Definition HttpClientSession.h:14
Caller-owned memory for the optional HttpClientSession layer.
Definition HttpClientSession.h:67
Span< HttpClientSessionAuthCacheEntry > authEntries
Durable auth cache slots.
Definition HttpClientSession.h:70
Span< char > stateScratch
Append-only durable state string scratch.
Definition HttpClientSession.h:72
Span< HttpClientHeader > requestHeaders
Header workspace for prepared requests.
Definition HttpClientSession.h:68
Span< char > headerScratch
Per-prepare header value scratch.
Definition HttpClientSession.h:71
Span< HttpClientSessionCookie > cookies
Durable cookie slots.
Definition HttpClientSession.h:69
Retry policy used by HttpClientSessionRetryState.
Definition HttpClientSession.h:77
Caller-owned retry bookkeeping for one logical request.
Definition HttpClientSession.h:87
Optional caller-owned state layer above the stateless HttpClient core.
Definition HttpClientSession.h:107