diff options
| author | Stefan Boberg <[email protected]> | 2021-05-25 09:54:09 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-25 09:54:09 +0200 |
| commit | 882e93e4786f9e67e0edf6c276b16bb40848bae9 (patch) | |
| tree | c5d4c45679c676c6aeb804c7601f43340b78ea0b /zencore/httpserver.cpp | |
| parent | Updated structured cache description (diff) | |
| parent | Compile out all rocksdb code for a smaller binary (diff) | |
| download | zen-882e93e4786f9e67e0edf6c276b16bb40848bae9.tar.xz zen-882e93e4786f9e67e0edf6c276b16bb40848bae9.zip | |
Merged from origin/main
Diffstat (limited to 'zencore/httpserver.cpp')
| -rw-r--r-- | zencore/httpserver.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/zencore/httpserver.cpp b/zencore/httpserver.cpp index 1bfe224f8..bd54c90ab 100644 --- a/zencore/httpserver.cpp +++ b/zencore/httpserver.cpp @@ -933,6 +933,7 @@ using namespace std::literals; static constinit uint32_t HashBinary = HashStringDjb2("application/octet-stream"sv); static constinit uint32_t HashJson = HashStringDjb2("application/json"sv); +static constinit uint32_t HashYaml = HashStringDjb2("text/yaml"sv); static constinit uint32_t HashText = HashStringDjb2("text/plain"sv); static constinit uint32_t HashCompactBinary = HashStringDjb2("application/x-ue-cb"sv); static constinit uint32_t HashCompactBinaryPackage = HashStringDjb2("application/x-ue-cbpkg"sv); @@ -960,6 +961,10 @@ MapContentType(const std::string_view& ContentTypeString) { return HttpContentType::kJSON; } + else if (CtHash == HashYaml) + { + return HttpContentType::kYAML; + } else if (CtHash == HashText) { return HttpContentType::kText; @@ -1057,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 @@ -1112,7 +1120,9 @@ public: ReadPointer += BytesRead; } - return buffer; + PayloadBuffer.MakeImmutable(); + + return PayloadBuffer; } virtual void WriteResponse(HttpResponse HttpResponseCode) override |