From 912cd60c4cdfd6e0253ee1b9ed1abade09ac8b7c Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 30 Jun 2023 10:55:49 +0200 Subject: 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 --- src/zenhttp/httpserver.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/zenhttp/httpserver.cpp') 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}, @@ -275,6 +277,12 @@ ToString(HttpVerb Verb) } } +std::string_view +ToString(HttpResponseCode HttpCode) +{ + return ReasonStringForHttpResultCode(int(HttpCode)); +} + std::string_view ReasonStringForHttpResultCode(int HttpCode) { -- cgit v1.2.3