aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-02-20 09:05:23 +0100
committerGitHub Enterprise <[email protected]>2026-02-20 09:05:23 +0100
commitee26e5af2ced0987fbdf666dc6bce7c2074e925f (patch)
tree7d8e6c614d62a9d31e85d2b508c4b209ebb847bc /src/zenhttp
parent5.7.21 (diff)
downloadzen-ee26e5af2ced0987fbdf666dc6bce7c2074e925f.tar.xz
zen-ee26e5af2ced0987fbdf666dc6bce7c2074e925f.zip
GC - fix handling of attachment ranges, http access token expiration, lock file retry logic (#766)
* GC - fix handling of attachment ranges * fix trace/log strings * fix HTTP access token expiration time logic * added missing lock retry in zenserver startup
Diffstat (limited to 'src/zenhttp')
-rw-r--r--src/zenhttp/httpclientauth.cpp2
-rw-r--r--src/zenhttp/servers/httpparser.cpp9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/zenhttp/httpclientauth.cpp b/src/zenhttp/httpclientauth.cpp
index 72df12d02..02e1b57e2 100644
--- a/src/zenhttp/httpclientauth.cpp
+++ b/src/zenhttp/httpclientauth.cpp
@@ -170,7 +170,7 @@ namespace zen { namespace httpclientauth {
time_t UTCTime = timegm(&Time);
HttpClientAccessToken::TimePoint ExpireTime = std::chrono::system_clock::from_time_t(UTCTime);
- ExpireTime += std::chrono::microseconds(Millisecond);
+ ExpireTime += std::chrono::milliseconds(Millisecond);
return HttpClientAccessToken{.Value = fmt::format("Bearer {}"sv, Token), .ExpireTime = ExpireTime};
}
diff --git a/src/zenhttp/servers/httpparser.cpp b/src/zenhttp/servers/httpparser.cpp
index be5befcd2..f0485aa25 100644
--- a/src/zenhttp/servers/httpparser.cpp
+++ b/src/zenhttp/servers/httpparser.cpp
@@ -226,6 +226,8 @@ NormalizeUrlPath(std::string_view InUrl, std::string& NormalizedUrl)
NormalizedUrl.append(Url, UrlIndex);
}
+ // NOTE: this check is redundant given the enclosing if,
+ // need to verify the intent of this code
if (!LastCharWasSeparator)
{
NormalizedUrl.push_back('/');
@@ -310,6 +312,7 @@ HttpRequestParser::OnHeadersComplete()
if (ContentLength)
{
+ // TODO: should sanity-check content length here
m_BodyBuffer = IoBuffer(ContentLength);
}
@@ -329,9 +332,9 @@ HttpRequestParser::OnHeadersComplete()
int
HttpRequestParser::OnBody(const char* Data, size_t Bytes)
{
- if (m_BodyPosition + Bytes > m_BodyBuffer.Size())
+ if ((m_BodyPosition + Bytes) > m_BodyBuffer.Size())
{
- ZEN_WARN("HTTP parser incoming body is larger than content size, need {} more bytes",
+ ZEN_WARN("HTTP parser incoming body is larger than content size, need {} more buffer bytes",
(m_BodyPosition + Bytes) - m_BodyBuffer.Size());
return 1;
}
@@ -342,7 +345,7 @@ HttpRequestParser::OnBody(const char* Data, size_t Bytes)
{
if (m_BodyPosition != m_BodyBuffer.Size())
{
- ZEN_WARN("Body mismatch! {} != {}", m_BodyPosition, m_BodyBuffer.Size());
+ ZEN_WARN("Body size mismatch! {} != {}", m_BodyPosition, m_BodyBuffer.Size());
return 1;
}
}