try {
length = Long.parseLong(lengthStr);
} catch (NumberFormatException nfe) {
length = 0;
}
is = new FixedSizeInputStream(is, length);
} else if (!hasToCloseConnection(readHeader)) {
// no content length and no valid transfer-encoding!
// consider as empty response.
// but only when there is no "Connection: close" or "Proxy-Connection: close" header,
// in that case just return "is".
// skipData will not read that as it should also analyze "close" instruction.
// return empty stream.
// and force connection close? (not to read garbage on the next request).
is = new FixedSizeInputStream(is, 0);
// this will force connection to close.
readHeader.setHeaderValue(HTTPHeader.CONNECTION_HEADER, "close");
}
if ("gzip".equals(readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_ENCODING_HEADER))) {