aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpserver.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-06-30 10:55:49 +0200
committerStefan Boberg <[email protected]>2023-06-30 10:55:49 +0200
commit912cd60c4cdfd6e0253ee1b9ed1abade09ac8b7c (patch)
treeef0994084304dd5ce1fdd42621e36a9b34b191f7 /src/zenhttp/httpserver.cpp
parentadded zen::ChunkResolver (diff)
downloadzen-912cd60c4cdfd6e0253ee1b9ed1abade09ac8b7c.tar.xz
zen-912cd60c4cdfd6e0253ee1b9ed1abade09ac8b7c.zip
various zenhttp fixes from sb/proto
* Made HttpHealthService use locks to serialize access to state * Added ToString(HttpResponseCode HttpCode) * Added support for JS source maps * Moved IHttpStatsProvider/IHttpStatsService * Enabled enumeration of stats providers * Disabled build of HttpTestingService unless ZEN_WITH_TESTS is defined
Diffstat (limited to 'src/zenhttp/httpserver.cpp')
-rw-r--r--src/zenhttp/httpserver.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp
index 671cbd319..dbf284ab5 100644
--- a/src/zenhttp/httpserver.cpp
+++ b/src/zenhttp/httpserver.cpp
@@ -95,6 +95,7 @@ static constinit uint32_t HashCompressedBinary = HashStringDjb2("application/x
static constinit uint32_t HashHtml = HashStringDjb2("html"sv);
static constinit uint32_t HashTextHtml = HashStringDjb2("text/html"sv);
static constinit uint32_t HashJavaScript = HashStringDjb2("js"sv);
+static constinit uint32_t HashJavaScriptSourceMap = HashStringDjb2("map"sv); // actually .js.map
static constinit uint32_t HashApplicationJavaScript = HashStringDjb2("application/javascript"sv);
static constinit uint32_t HashCss = HashStringDjb2("css"sv);
static constinit uint32_t HashTextCss = HashStringDjb2("text/css"sv);
@@ -127,6 +128,7 @@ struct HashedTypeEntry
{HashTextHtml, HttpContentType::kHTML},
{HashJavaScript, HttpContentType::kJavaScript},
{HashApplicationJavaScript, HttpContentType::kJavaScript},
+ {HashJavaScriptSourceMap, HttpContentType::kJavaScript},
{HashCss, HttpContentType::kCSS},
{HashTextCss, HttpContentType::kCSS},
{HashPng, HttpContentType::kPNG},
@@ -276,6 +278,12 @@ ToString(HttpVerb Verb)
}
std::string_view
+ToString(HttpResponseCode HttpCode)
+{
+ return ReasonStringForHttpResultCode(int(HttpCode));
+}
+
+std::string_view
ReasonStringForHttpResultCode(int HttpCode)
{
switch (HttpCode)