dirkhenselin opened a new pull request #250:
URL: https://github.com/apache/httpcomponents-client/pull/250


   I observed the following problem: `Transfer-Encoding` and
   `Content-Length` headers should be mutually exclusive and because I use
   chunked transfer, the `Transfer-Encoding` header is set in the response
   while the `Content-Length` header is not. In case of a 304 during a
   revalidation, the header contains Content-Length=0. Probably a proxy is
   responsible for this, just like the comment "Some well-known proxies
   respond with Content-Length=0, when returning 304" in the method
   CachedHttpResponseGenerator::addMissingContentLengthHeader is saying. In
   CacheEntryUpdater::mergeHeaders the Content-Length=0 is merged into the
   cached entry, but the cached entry contains also a `Transfer-Encoding`
   header, so in the cached entry these headers aren't mutually exclusive
   anymore. Because of the `Transfer-Encoding` header the method
   CachedHttpResponseGenerator::addMissingContentLengthHeader isn't fixing
   the `Content-Length` header and Content-Length=0 causes returning null
   instead of the cached content. IMHO the `Content-Length` header should
   not be merged into the cached response in case of a 304, at least if the
   cached entry contains a `Transfer-Encoding` header.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to