aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-05-02 17:40:30 +0200
committerGitHub Enterprise <[email protected]>2024-05-02 17:40:30 +0200
commit1155ed2048a24f4dfcfa65d63243b77973f820d6 (patch)
tree49961435a57e3a516506bb6965d021c4864e3ecb /src/zenserver/cache
parentuse write and move in place for safer writing of files (#70) (diff)
downloadzen-1155ed2048a24f4dfcfa65d63243b77973f820d6.tar.xz
zen-1155ed2048a24f4dfcfa65d63243b77973f820d6.zip
fix zero size attachment replies (#69)
- Bugfix: Don't try to respond with zero size partial cache value when partial size is zero - Improvement: Added more validation of data read from cache / cas
Diffstat (limited to 'src/zenserver/cache')
-rw-r--r--src/zenserver/cache/httpstructuredcache.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp
index 135eee57c..449a43653 100644
--- a/src/zenserver/cache/httpstructuredcache.cpp
+++ b/src/zenserver/cache/httpstructuredcache.cpp
@@ -727,7 +727,15 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con
if (IoBuffer Chunk = m_CidStore.FindChunkByCid(AttachmentHash.AsHash()))
{
CompressedBuffer Compressed = CompressedBuffer::FromCompressedNoValidate(std::move(Chunk));
- Package.AddAttachment(CbAttachment(Compressed, AttachmentHash.AsHash()));
+ if (Compressed)
+ {
+ Package.AddAttachment(CbAttachment(Compressed, AttachmentHash.AsHash()));
+ }
+ else
+ {
+ ZEN_WARN("invalid compressed binary returned for {}", AttachmentHash.AsHash());
+ MissingCount++;
+ }
}
else
{