Related issue: NETTY-116 HTTP issues including chunked request / response patch

* Applied Dave's patch for HttpMessageDecoder
This commit is contained in:
Trustin Lee 2009-02-12 04:37:48 +00:00
parent 334ea6f6e6
commit 32738273e0

View File

@ -81,7 +81,9 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
} }
case READ_HEADER: { case READ_HEADER: {
readHeaders(buffer); readHeaders(buffer);
if (message.getContentLength() == 0) { if (message.isChunked()) {
checkpoint(State.READ_CHUNK_SIZE);
} else if (message.getContentLength() == 0) {
content = ChannelBuffers.EMPTY_BUFFER; content = ChannelBuffers.EMPTY_BUFFER;
return reset(); return reset();
} }
@ -186,13 +188,11 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
} }
State nextState; State nextState;
if (message.getContentLength() >= 0) { if (message.isChunked()) {
nextState = State.READ_FIXED_LENGTH_CONTENT;
}
else if (message.isChunked()) {
nextState = State.READ_CHUNK_SIZE; nextState = State.READ_CHUNK_SIZE;
} } else if (message.getContentLength() >= 0) {
else { nextState = State.READ_FIXED_LENGTH_CONTENT;
} else {
nextState = State.READ_CONTENT; nextState = State.READ_CONTENT;
} }
checkpoint(nextState); checkpoint(nextState);