diff options
| author | Dan Engelbrecht <[email protected]> | 2026-03-11 16:12:00 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-11 16:12:00 +0100 |
| commit | 1a3a175a2ca0c06a29e6a679c325395c8008a17e (patch) | |
| tree | 21156d69bb90bc5c6f539fff02e4c23c229269a4 /src/zenhttp/packageformat.cpp | |
| parent | improved oplog import progress reporting (#825) (diff) | |
| download | zen-1a3a175a2ca0c06a29e6a679c325395c8008a17e.tar.xz zen-1a3a175a2ca0c06a29e6a679c325395c8008a17e.zip | |
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
Diffstat (limited to 'src/zenhttp/packageformat.cpp')
| -rw-r--r-- | src/zenhttp/packageformat.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
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<IoBuffer(const IoHash&, uint } else if (AttachmentSize > 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 { |