You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "arturobernalg (via GitHub)" <gi...@apache.org> on 2026/08/13 18:45:07 UTC
[PR] Deprecate the never-cache-responses-with-query options and HTTP/1.0 r… [httpcomponents-client]
arturobernalg opened a new pull request, #870:
URL: https://github.com/apache/httpcomponents-client/pull/870
RFC 9111 section 4.2.2 no longer prohibits assigning heuristic freshness to a response with a query component; the earlier RFC 2616 section 13.9 prohibition was obsolete and not widely implemented. The CacheConfig options that suppress caching of such responses therefore no longer serve a purpose, so isNeverCacheHTTP10ResponsesWithQuery, isNeverCacheHTTP11ResponsesWithQuery and their builder setters are deprecated, as is HTTP/1.0 response caching itself. The options are still honoured for now; an origin that does not want a response cached should send an explicit directive such as Cache-Control: no-cache.
--
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: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Deprecate the never-cache-responses-with-query options and HTTP/1.0 response caching [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #870:
URL: https://github.com/apache/httpcomponents-client/pull/870#issuecomment-5301651451
@arturobernalg I tweaked some of your test case changes to keep the original asserts. I will also port the `neverCache1_1ResponsesWithQueryString` fix to the stable branch.
--
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: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Deprecate the never-cache-responses-with-query options and HTTP/1.0 response caching [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #870:
URL: https://github.com/apache/httpcomponents-client/pull/870#discussion_r3782654803
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java:
##########
Review Comment:
@arturobernalg I am sorry. I overlooked this bit. It needs to be fixed.
--
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: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Deprecate the never-cache-responses-with-query options and HTTP/1.0 response caching [httpcomponents-client]
Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg commented on code in PR #870:
URL: https://github.com/apache/httpcomponents-client/pull/870#discussion_r3783523416
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java:
##########
Review Comment:
@ok2c please do another pass
--
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: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Deprecate the never-cache-responses-with-query options and HTTP/1.0 response caching [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #870:
URL: https://github.com/apache/httpcomponents-client/pull/870#discussion_r3782617841
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java:
##########
Review Comment:
@arturobernalg Damn it. This is wrong. In fact the entire logic is based on the protocol version _hint_ and not t he real transport version. It is broken and wrong.
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java:
##########
@@ -105,6 +105,7 @@ public boolean isResponseCacheable(final RequestCacheControl requestCacheControl
}
return false;
}
+ // HTTP/1.0 response caching is deprecated and will be rejected here in a future release.
Review Comment:
@arturobernalg Let's drop this comment altogether. I am going to remove the request version check from this class shortly/
--
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: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Deprecate the never-cache-responses-with-query options and HTTP/1.0 response caching [httpcomponents-client]
Posted by "arturobernalg (via GitHub)" <gi...@apache.org>.
arturobernalg merged PR #870:
URL: https://github.com/apache/httpcomponents-client/pull/870
--
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: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Deprecate the never-cache-responses-with-query options and HTTP/1.0 response caching [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on code in PR #870:
URL: https://github.com/apache/httpcomponents-client/pull/870#discussion_r3783229567
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java:
##########
Review Comment:
@arturobernalg Do not you agree this bit of code should be refactored / fixed?
```
if (request.getPath().contains("?")) {
if (neverCache1_0ResponsesWithQueryString && from1_0Origin(response)) {
LOG.debug("Response is not cacheable as it had a query string");
return false;
} else if (!neverCache1_1ResponsesWithQueryString && !isExplicitlyCacheable(cacheControl, response)) {
LOG.debug("Response is not cacheable as it is missing explicit caching headers");
return false;
}
}
```
Should not it be something like this, so that in normal execution flow those bits would never get executed?
```
if (neverCache1_0ResponsesWithQueryString &&
request.getPath().contains("?") &&
from1_0Origin(response)) {
LOG.debug("Response is not cacheable as it had a query string");
return false;
}
if (neverCache1_1ResponsesWithQueryString &&
request.getPath().contains("?") &&
!isExplicitlyCacheable(cacheControl, response)) {
LOG.debug("Response is not cacheable as it is missing explicit caching headers");
return false;
}
```
--
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: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org