if (contentLength != null) {
contentSoFar += chunk.readableBytes();
} else {
// find content length
BasicHttpDecoder basicHttpDecoder = new BasicHttpDecoder(Unpooled.copiedBuffer(chunk));
contentLength = basicHttpDecoder.getContentLength();
contentSoFar = (chunk.readableBytes() - basicHttpDecoder.getContentStart());
}
if (logger.isTraceEnabled()) {
logger.trace("CHUNK: ---\n-" + System.getProperty("line.separator") + Unpooled.copiedBuffer(chunk).toString(Charsets.UTF_8) + "\n-" + System.getProperty("line.separator"));
logger.trace("CONTENT-SO-FAR-PRE-CHUNK: --- " + (contentSoFar - Unpooled.copiedBuffer(chunk).toString(Charsets.UTF_8).length()));