"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedHttpResponseGenerator.java" between
httpcomponents-client-4.5.7-src.tar.gz and httpcomponents-client-4.5.8-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

CachedHttpResponseGenerator.java  (httpcomponents-client-4.5.7-src):CachedHttpResponseGenerator.java  (httpcomponents-client-4.5.8-src)
skipping to change at line 154 skipping to change at line 154
response.addHeader(varyHeader); response.addHeader(varyHeader);
} }
return Proxies.enhanceResponse(response); return Proxies.enhanceResponse(response);
} }
private void addMissingContentLengthHeader(final HttpResponse response, fina l HttpEntity entity) { private void addMissingContentLengthHeader(final HttpResponse response, fina l HttpEntity entity) {
if (transferEncodingIsPresent(response)) { if (transferEncodingIsPresent(response)) {
return; return;
} }
// Some well known proxies respond with Content-Length=0, when returning
Header contentLength = response.getFirstHeader(HTTP.CONTENT_LEN); 304. For robustness, always
if (contentLength == null) { // use the cached entity's content length, as modern browsers do.
contentLength = new BasicHeader(HTTP.CONTENT_LEN, Long.toString(enti final Header contentLength = new BasicHeader(HTTP.CONTENT_LEN, Long.toSt
ty ring(entity.getContentLength()));
.getContentLength())); response.setHeader(contentLength);
response.setHeader(contentLength);
}
} }
private boolean transferEncodingIsPresent(final HttpResponse response) { private boolean transferEncodingIsPresent(final HttpResponse response) {
final Header hdr = response.getFirstHeader(HTTP.TRANSFER_ENCODING); final Header hdr = response.getFirstHeader(HTTP.TRANSFER_ENCODING);
return hdr != null; return hdr != null;
} }
private boolean responseShouldContainEntity(final HttpRequestWrapper request , final HttpCacheEntry cacheEntry) { private boolean responseShouldContainEntity(final HttpRequestWrapper request , final HttpCacheEntry cacheEntry) {
return request.getRequestLine().getMethod().equals(HeaderConstants.GET_M ETHOD) && return request.getRequestLine().getMethod().equals(HeaderConstants.GET_M ETHOD) &&
cacheEntry.getResource() != null; cacheEntry.getResource() != null;
 End of changes. 1 change blocks. 
8 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)