[#845] Enable PUT of files above 2GB

This commit is contained in:
Norman Maurer 2012-12-24 21:52:04 +01:00
parent 2ea45950f1
commit 5bd3648b3d

View File

@ -271,8 +271,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
return readFixedLengthContent(buffer); return readFixedLengthContent(buffer);
} }
case READ_FIXED_LENGTH_CONTENT_AS_CHUNKS: { case READ_FIXED_LENGTH_CONTENT_AS_CHUNKS: {
assert chunkSize <= Integer.MAX_VALUE; long chunkSize = this.chunkSize;
int chunkSize = (int) this.chunkSize;
int readLimit = actualReadableBytes(); int readLimit = actualReadableBytes();
// Check if the buffer is readable first as we use the readable byte count // Check if the buffer is readable first as we use the readable byte count
@ -285,12 +284,12 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<Object, HttpMe
return null; return null;
} }
int toRead = chunkSize; int toRead = readLimit;
if (toRead > maxChunkSize) { if (toRead > maxChunkSize) {
toRead = maxChunkSize; toRead = maxChunkSize;
} }
if (toRead > readLimit) { if (toRead > chunkSize) {
toRead = readLimit; toRead = (int) chunkSize;
} }
HttpChunk chunk = new DefaultHttpChunk(buffer.readBytes(toRead)); HttpChunk chunk = new DefaultHttpChunk(buffer.readBytes(toRead));
if (chunkSize > toRead) { if (chunkSize > toRead) {