aboutsummaryrefslogtreecommitdiff
path: root/zenhttp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-04-24 15:53:30 +0200
committerStefan Boberg <[email protected]>2023-04-24 15:53:30 +0200
commit9ee1a686c29b7ab18207c2963497337532f441cb (patch)
tree17d2681767e92603b7199d88235a775e5ca354ab /zenhttp
parentadded changelog comment (diff)
parentfixed dashboard file serving bug (#255) (diff)
downloadzen-9ee1a686c29b7ab18207c2963497337532f441cb.tar.xz
zen-9ee1a686c29b7ab18207c2963497337532f441cb.zip
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zenhttp')
-rw-r--r--zenhttp/httpasio.cpp5
-rw-r--r--zenhttp/httpsys.cpp13
-rw-r--r--zenhttp/include/zenhttp/httpserver.h2
3 files changed, 11 insertions, 9 deletions
diff --git a/zenhttp/httpasio.cpp b/zenhttp/httpasio.cpp
index f270c9d2b..510b349f9 100644
--- a/zenhttp/httpasio.cpp
+++ b/zenhttp/httpasio.cpp
@@ -1077,8 +1077,9 @@ HttpAsioServerRequest::HttpAsioServerRequest(asio_http::HttpRequest& Request, Ht
std::string_view Uri = Request.Url();
Uri.remove_prefix(std::min(PrefixLength, static_cast<int>(Uri.size())));
- m_Uri = Uri;
- m_QueryString = Request.QueryString();
+ m_Uri = Uri;
+ m_UriWithExtension = Uri;
+ m_QueryString = Request.QueryString();
m_Verb = Request.RequestVerb();
m_ContentLength = Request.Body().Size();
diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp
index 16ec135cd..0f4fe0a6d 100644
--- a/zenhttp/httpsys.cpp
+++ b/zenhttp/httpsys.cpp
@@ -1232,6 +1232,9 @@ HttpSysServerRequest::HttpSysServerRequest(HttpSysTransaction& Tx, HttpService&
std::string_view UriSuffix8{m_UriUtf8};
+ m_UriWithExtension = UriSuffix8; // Retain URI with extension for user access
+ m_Uri = UriSuffix8;
+
const size_t LastComponentIndex = UriSuffix8.find_last_of('/');
if (LastComponentIndex != std::string_view::npos)
@@ -1244,22 +1247,18 @@ HttpSysServerRequest::HttpSysServerRequest(HttpSysTransaction& Tx, HttpService&
if (LastDotIndex != std::string_view::npos)
{
UriSuffix8.remove_prefix(LastDotIndex + 1);
+ m_Uri.remove_suffix(UriSuffix8.size() + 1);
AcceptContentType = ParseContentType(UriSuffix8);
-
- if (AcceptContentType != HttpContentType::kUnknownContentType)
- {
- m_UriUtf8.RemoveSuffix((uint32_t)(UriSuffix8.size() + 1));
- }
}
}
else
{
m_UriUtf8.Reset();
+ m_Uri = {};
+ m_UriWithExtension = {};
}
- m_Uri = std::string_view(m_UriUtf8);
-
if (uint16_t QueryStringLength = HttpRequestPtr->CookedUrl.QueryStringLength)
{
--QueryStringLength; // We skip the leading question mark
diff --git a/zenhttp/include/zenhttp/httpserver.h b/zenhttp/include/zenhttp/httpserver.h
index 451a47b4a..3b9fa50b4 100644
--- a/zenhttp/include/zenhttp/httpserver.h
+++ b/zenhttp/include/zenhttp/httpserver.h
@@ -34,6 +34,7 @@ public:
// Synchronous operations
[[nodiscard]] inline std::string_view RelativeUri() const { return m_Uri; } // Returns URI without service prefix
+ [[nodiscard]] std::string_view RelativeUriWithExtension() const { return m_UriWithExtension; }
[[nodiscard]] inline std::string_view QueryString() const { return m_QueryString; }
struct QueryParams
@@ -118,6 +119,7 @@ protected:
HttpContentType m_AcceptType = HttpContentType::kUnknownContentType;
uint64_t m_ContentLength = ~0ull;
std::string_view m_Uri;
+ std::string_view m_UriWithExtension;
std::string_view m_QueryString;
mutable uint32_t m_RequestId = ~uint32_t(0);
mutable Oid m_SessionId = Oid::Zero;