aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/httpsys.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-10-19 13:30:32 +0200
committerStefan Boberg <[email protected]>2021-10-19 13:30:32 +0200
commit0fe877390805272f8efe6c793ffb83e8c159d50a (patch)
tree82752087d8c0386a6c79751fea243f6108a238b2 /zenhttp/httpsys.cpp
parentcas: added structured manifest support (diff)
parentstring: Fixed ToLower logic (needs to use unsigned arithmetic) (diff)
downloadzen-0fe877390805272f8efe6c793ffb83e8c159d50a.tar.xz
zen-0fe877390805272f8efe6c793ffb83e8c159d50a.zip
Merge branch 'main' into gc
Diffstat (limited to 'zenhttp/httpsys.cpp')
-rw-r--r--zenhttp/httpsys.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp
index f3568bbd1..cdf9e0a39 100644
--- a/zenhttp/httpsys.cpp
+++ b/zenhttp/httpsys.cpp
@@ -341,8 +341,6 @@ HttpMessageResponseRequest::~HttpMessageResponseRequest()
void
HttpMessageResponseRequest::InitializeForPayload(uint16_t ResponseCode, std::span<IoBuffer> BlobList)
{
- m_ResponseCode = ResponseCode;
-
const uint32_t ChunkCount = gsl::narrow<uint32_t>(BlobList.size());
m_HttpDataChunks.reserve(ChunkCount);
@@ -407,6 +405,16 @@ HttpMessageResponseRequest::InitializeForPayload(uint16_t ResponseCode, std::spa
m_RemainingChunkCount = gsl::narrow<uint32_t>(m_HttpDataChunks.size());
m_TotalDataSize = LocalDataSize;
+
+ if (m_TotalDataSize == 0 && ResponseCode == 200)
+ {
+ // Some HTTP clients really don't like empty responses unless a 204 response is sent
+ m_ResponseCode = uint16_t(HttpResponseCode::NoContent);
+ }
+ else
+ {
+ m_ResponseCode = ResponseCode;
+ }
}
void