aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpserver.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-01-22 13:22:21 +0100
committerGitHub <[email protected]>2024-01-22 13:22:21 +0100
commitd0630968516f31a9c6ebc9a5643b7cd19f6cb184 (patch)
treea2bbf71b93f0254415f13cebcb41ac9d808db312 /src/zenhttp/httpserver.cpp
parentjobqueue - allow multiple threads to report progress/messages (#635) (diff)
downloadzen-d0630968516f31a9c6ebc9a5643b7cd19f6cb184.tar.xz
zen-d0630968516f31a9c6ebc9a5643b7cd19f6cb184.zip
improved errors from jupiter upstream (#636)
* get more detailed error messages from jupiter upstream
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),