From 1a3a175a2ca0c06a29e6a679c325395c8008a17e Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 11 Mar 2026 16:12:00 +0100 Subject: added streaming download of payloads http client Post (#824) * added streaming download of payloads in cpr client ::Post * curlclient Post streaming download * case sensitivity fixes for http headers * move over missing functionality from crpclient to httpclient --- src/zenhttp/packageformat.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/zenhttp/packageformat.cpp') diff --git a/src/zenhttp/packageformat.cpp b/src/zenhttp/packageformat.cpp index cbfe4d889..9c62c1f2d 100644 --- a/src/zenhttp/packageformat.cpp +++ b/src/zenhttp/packageformat.cpp @@ -575,13 +575,21 @@ ParsePackageMessage(IoBuffer Payload, std::function 0) { - // Make a copy of the buffer so the attachments don't reference the entire payload - IoBuffer AttachmentBufferCopy = CreateBuffer(Entry.AttachmentHash, AttachmentSize); - ZEN_ASSERT(AttachmentBufferCopy); - ZEN_ASSERT(AttachmentBufferCopy.Size() == AttachmentSize); - AttachmentBufferCopy.GetMutableView().CopyFrom(AttachmentBuffer.GetView()); + IoBufferFileReference TestIfFileRef; + if (AttachmentBuffer.GetFileReference(TestIfFileRef)) + { + Attachments.emplace_back(CbAttachment(SharedBuffer{std::move(AttachmentBuffer)}, Entry.AttachmentHash)); + } + else + { + // Make a copy of the buffer so the attachments don't reference the entire payload + IoBuffer AttachmentBufferCopy = CreateBuffer(Entry.AttachmentHash, AttachmentSize); + ZEN_ASSERT(AttachmentBufferCopy); + ZEN_ASSERT(AttachmentBufferCopy.Size() == AttachmentSize); + AttachmentBufferCopy.GetMutableView().CopyFrom(AttachmentBuffer.GetView()); - Attachments.emplace_back(CbAttachment(SharedBuffer{AttachmentBufferCopy}, Entry.AttachmentHash)); + Attachments.emplace_back(CbAttachment(SharedBuffer{AttachmentBufferCopy}, Entry.AttachmentHash)); + } } else { -- cgit v1.2.3