diff options
| author | Dan Engelbrecht <[email protected]> | 2026-03-18 22:28:14 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-18 22:28:14 +0100 |
| commit | 59bc08385515997a34fe2b4b3cbbfd03dd9a7c5b (patch) | |
| tree | 0a65fca5537909f41b5f8b0d87daa7dbcd967677 /src/zenhttp/clients/httpclientcpr.cpp | |
| parent | Update libcurl to 8.19.0 (#862) (diff) | |
| download | zen-59bc08385515997a34fe2b4b3cbbfd03dd9a7c5b.tar.xz zen-59bc08385515997a34fe2b4b3cbbfd03dd9a7c5b.zip | |
improve auth token refresh (#863)
Authentication callbacks are not thread safe, ensured call sites does single threaded calls
Diffstat (limited to 'src/zenhttp/clients/httpclientcpr.cpp')
| -rw-r--r-- | src/zenhttp/clients/httpclientcpr.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/zenhttp/clients/httpclientcpr.cpp b/src/zenhttp/clients/httpclientcpr.cpp index a52b8f74b..bd6de3ff7 100644 --- a/src/zenhttp/clients/httpclientcpr.cpp +++ b/src/zenhttp/clients/httpclientcpr.cpp @@ -399,13 +399,13 @@ CprHttpClient::DoWithRetry(std::string_view SessionId, ////////////////////////////////////////////////////////////////////////// CprHttpClient::Session -CprHttpClient::AllocSession(const std::string_view BaseUrl, - const std::string_view ResourcePath, - const HttpClientSettings& ConnectionSettings, - const KeyValueMap& AdditionalHeader, - const KeyValueMap& Parameters, - const std::string_view SessionId, - std::optional<HttpClientAccessToken> AccessToken) +CprHttpClient::AllocSession(const std::string_view BaseUrl, + const std::string_view ResourcePath, + const HttpClientSettings& ConnectionSettings, + const KeyValueMap& AdditionalHeader, + const KeyValueMap& Parameters, + const std::string_view SessionId, + std::optional<std::string> AccessToken) { ZEN_TRACE_CPU("CprHttpClient::AllocSession"); cpr::Session* CprSession = nullptr; @@ -494,9 +494,10 @@ CprHttpClient::AllocSession(const std::string_view BaseUrl, { CprSession->UpdateHeader({{"Connection", "close"}}); } - if (AccessToken) + + if (AccessToken.has_value()) { - CprSession->UpdateHeader({{"Authorization", AccessToken->Value}}); + CprSession->UpdateHeader({{"Authorization", AccessToken.value()}}); } if (!Parameters->empty()) { |