diff options
| author | zousar <[email protected]> | 2025-09-24 22:12:11 -0600 |
|---|---|---|
| committer | zousar <[email protected]> | 2025-09-24 22:12:11 -0600 |
| commit | ebfade799e7199f7c6b981f17a55ed67d4323c41 (patch) | |
| tree | dd04a483893bb3b9ab4c125fa61f967978ce67b3 /src/zenserver/cache/httpstructuredcache.cpp | |
| parent | Adjust the responses from PUT commands (diff) | |
| download | zen-ebfade799e7199f7c6b981f17a55ed67d4323c41.tar.xz zen-ebfade799e7199f7c6b981f17a55ed67d4323c41.zip | |
Report Incomplete Records To Client
When requesting partial records, report back when a record is incomplete via an "Incomplete" array of bools that is a sibling to the "Result" array for batch/rpc operations, or via the HttpResponseCode::PartialContent status code for individual record requests.
Diffstat (limited to 'src/zenserver/cache/httpstructuredcache.cpp')
| -rw-r--r-- | src/zenserver/cache/httpstructuredcache.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index dc14465de..bc3f4ee20 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -821,7 +821,8 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con const bool SkipData = EnumHasAllFlags(PolicyFromUrl, CachePolicy::SkipData); const bool PartialRecord = EnumHasAllFlags(PolicyFromUrl, CachePolicy::PartialRecord); - bool Success = false; + bool Success = false; + uint32_t MissingCount = 0; ZenCacheValue ClientResultValue; if (!EnumHasAnyFlags(PolicyFromUrl, CachePolicy::Query)) { @@ -844,7 +845,6 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con if (ContentType == ZenContentType::kCbObject) { CbPackage Package; - uint32_t MissingCount = 0; CbValidateError ValidateError = CbValidateError::None; if (CbObject PackageObject = ValidateAndReadCompactBinaryObject(std::move(ClientResultValue.Value), ValidateError); ValidateError == CbValidateError::None) @@ -936,7 +936,9 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con else { // kCbPackage handled SkipData when constructing the ClientResultValue, kcbObject ignores SkipData - return Request.WriteResponse(HttpResponseCode::OK, ClientResultValue.Value.GetContentType(), ClientResultValue.Value); + return Request.WriteResponse((MissingCount == 0) ? HttpResponseCode::OK : HttpResponseCode::PartialContent, + ClientResultValue.Value.GetContentType(), + ClientResultValue.Value); } } else if (!HasUpstream || !EnumHasAllFlags(PolicyFromUrl, CachePolicy::QueryRemote)) |