aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-13 21:43:18 +0200
committerStefan Boberg <[email protected]>2021-09-13 21:43:18 +0200
commit11a2c78d69878e40a6ebafd00fd543f1f2eab702 (patch)
tree32f55acba3b44b9d7d9e800643e39c3f41d33edf
parentChanged explicit http status checking into IsHttpSuccessCode() call (diff)
downloadzen-11a2c78d69878e40a6ebafd00fd543f1f2eab702.tar.xz
zen-11a2c78d69878e40a6ebafd00fd543f1f2eab702.zip
Introduced FormatPackageMessageBuffer() returning a ComositeBuffer
-rw-r--r--zenhttp/httpshared.cpp16
-rw-r--r--zenhttp/httpshared.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/zenhttp/httpshared.cpp b/zenhttp/httpshared.cpp
index f11f91fae..85687b60b 100644
--- a/zenhttp/httpshared.cpp
+++ b/zenhttp/httpshared.cpp
@@ -3,6 +3,7 @@
#include "httpshared.h"
#include <zencore/compactbinarypackage.h>
+#include <zencore/compositebuffer.h>
#include <zencore/iobuffer.h>
#include <zencore/iohash.h>
#include <zencore/stream.h>
@@ -12,6 +13,21 @@
namespace zen {
+CompositeBuffer
+FormatPackageMessageBuffer(const CbPackage& Data)
+{
+ std::vector<IoBuffer> Message = FormatPackageMessage(Data);
+
+ std::vector<SharedBuffer> Buffers;
+
+ for (IoBuffer& Buf : Message)
+ {
+ Buffers.push_back(SharedBuffer(Buf));
+ }
+
+ return CompositeBuffer(std::move(Buffers));
+}
+
std::vector<IoBuffer>
FormatPackageMessage(const CbPackage& Data)
{
diff --git a/zenhttp/httpshared.h b/zenhttp/httpshared.h
index fbf35076b..e7c9e4a56 100644
--- a/zenhttp/httpshared.h
+++ b/zenhttp/httpshared.h
@@ -8,6 +8,7 @@ namespace zen {
class IoBuffer;
class CbPackage;
+class CompositeBuffer;
struct CbPackageHeader
{
@@ -31,6 +32,7 @@ struct CbAttachmentEntry
static_assert(sizeof(CbAttachmentEntry) == 32);
std::vector<IoBuffer> FormatPackageMessage(const CbPackage& Data);
+CompositeBuffer FormatPackageMessageBuffer(const CbPackage& Data);
CbPackage ParsePackageMessage(IoBuffer Payload);
} // namespace zen