aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/include
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2023-04-19 08:44:34 +0200
committerGitHub <[email protected]>2023-04-19 08:44:34 +0200
commit045702915c4b63d232b99d86a1ee0b16642098c8 (patch)
treeb8487d22d36b1c2a03352c45b386c209b9bb0b27 /zenhttp/include
parentmake sure initialization of a new filecas dont remove the cas manifest file o... (diff)
downloadzen-045702915c4b63d232b99d86a1ee0b16642098c8.tar.xz
zen-045702915c4b63d232b99d86a1ee0b16642098c8.zip
Support for HTTP range header (#245)
* Support for HTTP range header. * Implement http range for HTTP sys. * Validate range parameters. --------- Co-authored-by: Stefan Boberg <[email protected]>
Diffstat (limited to 'zenhttp/include')
-rw-r--r--zenhttp/include/zenhttp/httpcommon.h9
-rw-r--r--zenhttp/include/zenhttp/httpserver.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/zenhttp/include/zenhttp/httpcommon.h b/zenhttp/include/zenhttp/httpcommon.h
index 3e213ece4..19fda8db4 100644
--- a/zenhttp/include/zenhttp/httpcommon.h
+++ b/zenhttp/include/zenhttp/httpcommon.h
@@ -17,9 +17,18 @@ class CbObject;
class CbPackage;
class StringBuilderBase;
+struct HttpRange
+{
+ uint32_t Start = ~uint32_t(0);
+ uint32_t End = ~uint32_t(0);
+};
+
+using HttpRanges = std::vector<HttpRange>;
+
std::string_view MapContentTypeToString(HttpContentType ContentType);
extern HttpContentType (*ParseContentType)(const std::string_view& ContentTypeString);
std::string_view ReasonStringForHttpResultCode(int HttpCode);
+bool TryParseHttpRangeHeader(std::string_view RangeHeader, HttpRanges& Ranges);
[[nodiscard]] inline bool
IsHttpSuccessCode(int HttpCode)
diff --git a/zenhttp/include/zenhttp/httpserver.h b/zenhttp/include/zenhttp/httpserver.h
index 5bd51740a..451a47b4a 100644
--- a/zenhttp/include/zenhttp/httpserver.h
+++ b/zenhttp/include/zenhttp/httpserver.h
@@ -59,6 +59,8 @@ public:
}
};
+ virtual bool TryGetRanges(HttpRanges&) { return false; }
+
QueryParams GetQueryParams();
inline HttpVerb RequestVerb() const { return m_Verb; }