GitHub user gesellix opened a pull request:
https://github.com/apache/httpcomponents-client/pull/101
Ignore cached ETag and Last-Modified headers of HEAD cache entries
Since httpclient-cache 4.4 `HEAD` requests can be cached with a `null`
response body. Subsequent `GET` requests to the same target then use the
headers "If-None-Match" and "If-Modified-Since" to leverage caching via HTTP
protocol. In that case a server can respond with status code 304 and an empty
response body, which leads to an invalid cache entry.
The issue seems to be introduced with PR #13. The repo
https://github.com/gesellix/httpclient-cache-demo shows the behaviour for
HttpClients 4.3, 4.4, and 4.5.
This PR, based on the 4.5.x tag, tries to recognise the described invalid
state and suppresses caching on the HTTP layer, so that the server has to
return the complete response.
Signed-off-by: Tobias Gesellchen <[email protected]>
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gesellix/httpcomponents-client
disable-cache-for-null-resource
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/httpcomponents-client/pull/101.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #101
----
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]