Bug fix: response Cache-Control attribute does not get updated in the cache execution context in case of a cache miss

This commit is contained in:
Oleg Kalnichevski 2024-10-14 14:00:52 +02:00
parent aad0e9a9b5
commit e7b3a5316c
2 changed files with 4 additions and 0 deletions

View File

@ -523,7 +523,9 @@ public void cancelled() {
return asyncExecCallback.handleResponse(backendResponse, entityDetails);
}
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
final ResponseCacheControl responseCacheControl = CacheControlHeaderParser.INSTANCE.parse(backendResponse);
context.setResponseCacheControl(responseCacheControl);
final boolean cacheable = responseCachingPolicy.isResponseCacheable(responseCacheControl, request, backendResponse);
if (cacheable) {
storeRequestIfModifiedSinceFor304Response(request, backendResponse);

View File

@ -467,7 +467,9 @@ ClassicHttpResponse handleBackendResponse(
}
return backendResponse;
}
final HttpCacheContext context = HttpCacheContext.cast(scope.clientContext);
final ResponseCacheControl responseCacheControl = CacheControlHeaderParser.INSTANCE.parse(backendResponse);
context.setResponseCacheControl(responseCacheControl);
final boolean cacheable = responseCachingPolicy.isResponseCacheable(responseCacheControl, request, backendResponse);
if (cacheable) {
storeRequestIfModifiedSinceFor304Response(request, backendResponse);