You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2020/08/18 10:27:41 UTC

[GitHub] [httpcomponents-client] dirkhenselin opened a new pull request #250: Avoid updating Content-Length header in a 304 response.

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-client] ok2c merged pull request #250: Avoid updating Content-Length header in a 304 response.

Posted by GitBox <gi...@apache.org>.
ok2c merged pull request #250:
URL: https://github.com/apache/httpcomponents-client/pull/250


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[GitHub] [httpcomponents-client] michael-o commented on pull request #250: Avoid updating Content-Length header in a 304 response.

Posted by GitBox <gi...@apache.org>.
michael-o commented on pull request #250:
URL: https://github.com/apache/httpcomponents-client/pull/250#issuecomment-675405532


   Both headers seem to be pointless, RFC says:
   
   ```
      The server generating a 304 response MUST generate any of the
      following header fields that would have been sent in a 200 (OK)
      response to the same request: Cache-Control, Content-Location, Date,
      ETag, Expires, and Vary.
   
      Since the goal of a 304 response is to minimize information transfer
      when the recipient already has one or more cached representations, a
      sender SHOULD NOT generate representation metadata other than the
      above listed fields unless said metadata exists for the purpose of
      guiding cache updates (e.g., Last-Modified might be useful if the
      response does not have an ETag field).
   ```


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org