Merge branch 'PR-134' into 4.5.x

This commit is contained in:
Oleg Kalnichevski 2019-02-07 19:17:36 +01:00
commit 77cbf6c9f4
1 changed files with 4 additions and 7 deletions

View File

@ -151,13 +151,10 @@ class CachedHttpResponseGenerator {
if (transferEncodingIsPresent(response)) {
return;
}
Header contentLength = response.getFirstHeader(HTTP.CONTENT_LEN);
if (contentLength == null) {
contentLength = new BasicHeader(HTTP.CONTENT_LEN, Long.toString(entity
.getContentLength()));
response.setHeader(contentLength);
}
// Some well known proxies respond with Content-Length=0, when returning 304. For robustness, always
// use the cached entity's content length, as modern browsers do.
final Header contentLength = new BasicHeader(HTTP.CONTENT_LEN, Long.toString(entity.getContentLength()));
response.setHeader(contentLength);
}
private boolean transferEncodingIsPresent(final HttpResponse response) {