aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-10-02 16:19:40 +0200
committerGitHub Enterprise <[email protected]>2025-10-02 16:19:40 +0200
commit7838d47561dbc2dd42ec3f6b851efb710fec1842 (patch)
treec27673e751c745f95045e794b653d8c9d0d23923 /src/zenhttp
parentadd zenremotestore lib (#540) (diff)
downloadzen-7838d47561dbc2dd42ec3f6b851efb710fec1842.tar.xz
zen-7838d47561dbc2dd42ec3f6b851efb710fec1842.zip
fix for RPC replay issue (wrong content-type) (#536)
likely fall-out from HttpClient refactor. The content type used to be explicit via headers but is now taken from the `IoBuffer` also fixed issue which meant the original request session ID would also not be propagated as intended
Diffstat (limited to 'src/zenhttp')
-rw-r--r--src/zenhttp/httpclient.cpp22
-rw-r--r--src/zenhttp/include/zenhttp/httpclient.h2
2 files changed, 23 insertions, 1 deletions
diff --git a/src/zenhttp/httpclient.cpp b/src/zenhttp/httpclient.cpp
index 3da9f91fc..c5c808c23 100644
--- a/src/zenhttp/httpclient.cpp
+++ b/src/zenhttp/httpclient.cpp
@@ -39,7 +39,14 @@ HttpClientBase::HttpClientBase(std::string_view BaseUri, const HttpClientSetting
, m_BaseUri(BaseUri)
, m_ConnectionSettings(ConnectionSettings)
{
- m_SessionId = GetSessionIdString();
+ if (ConnectionSettings.SessionId == Oid::Zero)
+ {
+ m_SessionId = GetSessionIdString();
+ }
+ else
+ {
+ m_SessionId = ConnectionSettings.SessionId.ToString();
+ }
}
HttpClientBase::~HttpClientBase()
@@ -207,6 +214,19 @@ HttpClient::~HttpClient()
delete m_Inner;
}
+void
+HttpClient::SetSessionId(const Oid& SessionId)
+{
+ if (SessionId == Oid::Zero)
+ {
+ m_SessionId = GetSessionIdString();
+ }
+ else
+ {
+ m_SessionId = SessionId.ToString();
+ }
+}
+
HttpClient::Response
HttpClient::Put(std::string_view Url, const IoBuffer& Payload, const HttpClient::KeyValueMap& AdditionalHeader)
{
diff --git a/src/zenhttp/include/zenhttp/httpclient.h b/src/zenhttp/include/zenhttp/httpclient.h
index aae7b94e5..c1fc1efa6 100644
--- a/src/zenhttp/include/zenhttp/httpclient.h
+++ b/src/zenhttp/include/zenhttp/httpclient.h
@@ -55,6 +55,7 @@ struct HttpClientSettings
bool AssumeHttp2 = false;
bool AllowResume = false;
uint8_t RetryCount = 0;
+ Oid SessionId = Oid::Zero;
};
class HttpClientError : public std::runtime_error
@@ -230,6 +231,7 @@ public:
LoggerRef Log() { return m_Log; }
std::string_view GetBaseUri() const { return m_BaseUri; }
std::string_view GetSessionId() const { return m_SessionId; }
+ void SetSessionId(const Oid& SessionId);
bool Authenticate();