Skip to content

Commit 5c62d54

Browse files
committed
NETTY-420 HttpClientCodec doesn't handle HEAD requests with Transfer-Encoding: chunked responses
* Reverted back the workaround for servers that sends unnecessary zero-byte chunk in a HEAD response because it actually breaks the codec when the server that conforms to the RFC.
1 parent bdeed00 commit 5c62d54

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/main/java/org/jboss/netty/handler/codec/http/HttpClientCodec.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,20 @@ protected boolean isContentAlwaysEmpty(HttpMessage msg) {
136136
// message-body, even though the presence of entity-header fields
137137
// might lead one to believe they do.
138138
if (HttpMethod.HEAD.equals(method)) {
139-
// Interesting edge case:
140-
// Zero-byte chunk will appear if Transfer-Encoding of the
141-
// response is 'chunked'. This is probably because of the
142-
// trailing headers.
143-
return !msg.isChunked();
139+
return true;
140+
141+
// The following code was inserted to work around the servers
142+
// that behave incorrectly. It has been commented out
143+
// because it does not work with well behaving servers.
144+
// Please note, even if the 'Transfer-Encoding: chunked'
145+
// header exists in the HEAD response, the response should
146+
// have absolutely no content.
147+
//
148+
//// Interesting edge case:
149+
//// Some poorly implemented servers will send a zero-byte
150+
//// chunk if Transfer-Encoding of the response is 'chunked'.
151+
////
152+
//// return !msg.isChunked();
144153
}
145154
break;
146155
case 'C':

0 commit comments

Comments
 (0)