aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenhttp/httpserver.cpp')
-rw-r--r--src/zenhttp/httpserver.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp
index 3270855ad..dcbeac907 100644
--- a/src/zenhttp/httpserver.cpp
+++ b/src/zenhttp/httpserver.cpp
@@ -94,6 +94,7 @@ MapContentTypeToString(HttpContentType ContentType)
static constinit uint32_t HashBinary = HashStringDjb2("application/octet-stream"sv);
static constinit uint32_t HashJson = HashStringDjb2("json"sv);
static constinit uint32_t HashApplicationJson = HashStringDjb2("application/json"sv);
+static constinit uint32_t HashApplicationProblemJson = HashStringDjb2("application/problem+json"sv);
static constinit uint32_t HashYaml = HashStringDjb2("yaml"sv);
static constinit uint32_t HashTextYaml = HashStringDjb2("text/yaml"sv);
static constinit uint32_t HashText = HashStringDjb2("text/plain"sv);
@@ -132,6 +133,7 @@ struct HashedTypeEntry
{HashCompactBinaryPackageOffer, HttpContentType::kCbPackageOffer},
{HashJson, HttpContentType::kJSON},
{HashApplicationJson, HttpContentType::kJSON},
+ {HashApplicationProblemJson, HttpContentType::kJSON},
{HashYaml, HttpContentType::kYAML},
{HashTextYaml, HttpContentType::kYAML},
{HashText, HttpContentType::kText},
@@ -156,7 +158,14 @@ ParseContentTypeImpl(const std::string_view& ContentTypeString)
{
if (!ContentTypeString.empty())
{
- const uint32_t CtHash = HashStringDjb2(ContentTypeString);
+ size_t ContentEnd = ContentTypeString.find(';');
+ if (ContentEnd == std::string_view::npos)
+ {
+ ContentEnd = ContentTypeString.length();
+ }
+ std::string_view ContentString(ContentTypeString.substr(0, ContentEnd));
+
+ const uint32_t CtHash = HashStringDjb2(ContentString);
if (auto It = std::lower_bound(std::begin(TypeHashTable),
std::end(TypeHashTable),