aboutsummaryrefslogtreecommitdiff
path: root/zencore
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-08-23 19:10:39 +0200
committerStefan Boberg <[email protected]>2021-08-23 19:10:39 +0200
commit83c9cde1f16e088bac9fba3fca5718baac1c32b6 (patch)
tree3647df93f75ac645ee3ad3be61eaf77c6216725a /zencore
parentInitial build deploy scripts. Still missing debug information upload step so ... (diff)
downloadzen-83c9cde1f16e088bac9fba3fca5718baac1c32b6.tar.xz
zen-83c9cde1f16e088bac9fba3fca5718baac1c32b6.zip
Added HttpServerRequest::ReadPayloadPackage()
Diffstat (limited to 'zencore')
-rw-r--r--zencore/httpserver.cpp18
-rw-r--r--zencore/include/zencore/httpserver.h4
2 files changed, 21 insertions, 1 deletions
diff --git a/zencore/httpserver.cpp b/zencore/httpserver.cpp
index 2941c287d..8e04ddfb6 100644
--- a/zencore/httpserver.cpp
+++ b/zencore/httpserver.cpp
@@ -11,6 +11,7 @@
#include <http.h>
#include <new.h>
#include <zencore/compactbinary.h>
+#include <zencore/compactbinarypackage.h>
#include <zencore/iobuffer.h>
#include <zencore/refcount.h>
#include <zencore/string.h>
@@ -381,6 +382,23 @@ HttpServerRequest::ReadPayloadObject()
}
}
+CbPackage
+HttpServerRequest::ReadPayloadPackage()
+{
+ IoBuffer Payload = ReadPayload();
+
+ if (!Payload)
+ {
+ return CbPackage();
+ }
+
+ CbObject PackageObject = LoadCompactBinaryObject(std::move(Payload));
+
+ CbPackage Package(PackageObject);
+
+ return Package;
+}
+
//////////////////////////////////////////////////////////////////////////
//
// http.sys implementation
diff --git a/zencore/include/zencore/httpserver.h b/zencore/include/zencore/httpserver.h
index 9f19479c1..6412a5a9a 100644
--- a/zencore/include/zencore/httpserver.h
+++ b/zencore/include/zencore/httpserver.h
@@ -22,6 +22,7 @@ using HttpContentType = ZenContentType;
class IoBuffer;
class CbObject;
+class CbPackage;
class StringBuilderBase;
enum class HttpVerb
@@ -219,12 +220,13 @@ public:
/** Read POST/PUT payload
This will return a null buffer if the contents are not fully available yet, and the handler should
- at that point return - another completion request will be issues once the contents have been received
+ at that point return - another completion request will be issued once the contents have been received
fully.
*/
virtual IoBuffer ReadPayload() = 0;
ZENCORE_API CbObject ReadPayloadObject();
+ ZENCORE_API CbPackage ReadPayloadPackage();
/** Respond with payload