diff options
| author | Stefan Boberg <[email protected]> | 2021-05-23 12:51:42 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-23 12:51:42 +0200 |
| commit | ac7871e0b0f478da1a36da40a1a56a9f98b284df (patch) | |
| tree | 813025a218a45b6e44b36fb4a4d44dbf0504d3b6 /zencore/httpserver.cpp | |
| parent | Added static_assert to ensure content type fits in allocated space (diff) | |
| download | zen-ac7871e0b0f478da1a36da40a1a56a9f98b284df.tar.xz zen-ac7871e0b0f478da1a36da40a1a56a9f98b284df.zip | |
Added content type to IoBuffer payloads from http server
Also added some additional logic for flagging buffer immutability
Diffstat (limited to 'zencore/httpserver.cpp')
| -rw-r--r-- | zencore/httpserver.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/zencore/httpserver.cpp b/zencore/httpserver.cpp index 2427bf9bc..bd54c90ab 100644 --- a/zencore/httpserver.cpp +++ b/zencore/httpserver.cpp @@ -1062,11 +1062,14 @@ public: HTTP_REQUEST* const HttpReq = m_HttpTx.HttpRequest(); - IoBuffer buffer(m_ContentLength); + IoBuffer PayloadBuffer(m_ContentLength); + + HttpContentType ContentType = RequestContentType(); + PayloadBuffer.SetContentType(ContentType); uint64_t BytesToRead = m_ContentLength; - uint8_t* ReadPointer = (uint8_t*)buffer.Data(); + uint8_t* ReadPointer = reinterpret_cast<uint8_t*>(PayloadBuffer.MutableData()); // First deal with any payload which has already been copied // into our request buffer @@ -1117,7 +1120,9 @@ public: ReadPointer += BytesRead; } - return buffer; + PayloadBuffer.MakeImmutable(); + + return PayloadBuffer; } virtual void WriteResponse(HttpResponse HttpResponseCode) override |