ok2c commented on code in PR #868:
URL:
https://github.com/apache/httpcomponents-client/pull/868#discussion_r3795512434
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/BasicHttpCache.java:
##########
@@ -95,14 +111,44 @@ public BasicHttpCache() {
void storeInternal(final String cacheKey, final HttpCacheEntry entry) {
try {
- storage.putEntry(cacheKey, entry);
+ storage.putEntry(cacheKey, sharedCache ? stripPrivateFields(entry)
: entry);
} catch (final ResourceIOException ex) {
if (LOG.isWarnEnabled()) {
LOG.warn("I/O error storing cache entry with key {}",
cacheKey);
}
}
}
+ static HttpCacheEntry stripPrivateFields(final HttpCacheEntry entry) {
+ final ResponseCacheControl cacheControl =
CacheControlHeaderParser.INSTANCE.parse(entry);
Review Comment:
@arturobernalg This looks conceptually wrong. Why do we need to re-parse the
headers and re-create `ResponseCacheControl` here? In fact this is the wrong
architectural layer for such a decision. This is the responsibility of the
protocol layer, not of a caching backend. Pull this logic up into `CachingExec`
/ `AsyncCachingExec`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]