From 8c39e2823ecdc3c423132971269315e5a73158dd Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 17 Nov 2009 07:39:02 +0000 Subject: [PATCH] * HttpMessage.isChunked() checks the 'Transfer-Encoding' header --- .../codec/http/DefaultHttpMessage.java | 16 +++++++++++++- .../codec/http/HttpMessageDecoder.java | 22 ++++++------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java index 215f00674d..c00bfa1b70 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/DefaultHttpMessage.java @@ -113,7 +113,21 @@ public class DefaultHttpMessage implements HttpMessage { } public boolean isChunked() { - return chunked; + if (chunked) { + return true; + } + + List chunked = getHeaders(HttpHeaders.Names.TRANSFER_ENCODING); + if (chunked.isEmpty()) { + return false; + } + + for (String v: chunked) { + if (v.equalsIgnoreCase(HttpHeaders.Values.CHUNKED)) { + return true; + } + } + return false; } public void setChunked(boolean chunked) { diff --git a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java index eaa8dd38a8..1b9fb1b039 100644 --- a/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/http/HttpMessageDecoder.java @@ -453,7 +453,13 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder= 0) { nextState = State.READ_FIXED_LENGTH_CONTENT; @@ -463,20 +469,6 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder chunked = message.getHeaders(HttpHeaders.Names.TRANSFER_ENCODING); - if (chunked.isEmpty()) { - return false; - } - - for (String v: chunked) { - if (v.equalsIgnoreCase(HttpHeaders.Values.CHUNKED)) { - return true; - } - } - return false; - } - private HttpChunkTrailer readTrailingHeaders(ChannelBuffer buffer) throws TooLongFrameException { headerSize = 0; String line = readHeader(buffer);