}
res.setRedirectLocation(headerLocation.getValue());
}
// record some sizes to allow HTTPSampleResult.getBytes() with different options
HttpConnectionMetrics metrics = (HttpConnectionMetrics) localContext.getAttribute(CONTEXT_METRICS);
long headerBytes =
res.getResponseHeaders().length() // condensed length (without \r)
+ httpResponse.getAllHeaders().length // Add \r for each header
+ 1 // Add \r for initial header
+ 2; // final \r\n before data
long totalBytes = metrics.getReceivedBytesCount();
res.setHeadersSize((int) headerBytes);
res.setBodySize((int)(totalBytes - headerBytes));
if (log.isDebugEnabled()) {
log.debug("ResponseHeadersSize=" + res.getHeadersSize() + " Content-Length=" + res.getBodySize()
+ " Total=" + (res.getHeadersSize() + res.getBodySize()));