diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java index 433f3dde55..fb0e437d4b 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java @@ -223,8 +223,8 @@ public final class HttpClientCodec extends CombinedChannelDuplexHandler= 100 && statusCode < 200) { + // An informational response should be excluded from paired comparison. // Just delegate to super method which has all the needed handling. return super.isContentAlwaysEmpty(msg); } diff --git a/codec-http/src/test/java/io/netty/handler/codec/http/HttpClientCodecTest.java b/codec-http/src/test/java/io/netty/handler/codec/http/HttpClientCodecTest.java index 5d5dd540ec..fd04d8bb4a 100644 --- a/codec-http/src/test/java/io/netty/handler/codec/http/HttpClientCodecTest.java +++ b/codec-http/src/test/java/io/netty/handler/codec/http/HttpClientCodecTest.java @@ -327,6 +327,26 @@ public class HttpClientCodecTest { assertThat(ch.readInbound(), is(nullValue())); } + @Test + public void testWebDavResponse() { + byte[] data = ("HTTP/1.1 102 Processing\r\n" + + "Status-URI: Status-URI:http://status.com; 404\r\n" + + "\r\n" + + "1234567812345678").getBytes(); + EmbeddedChannel ch = new EmbeddedChannel(new HttpClientCodec()); + assertTrue(ch.writeInbound(Unpooled.wrappedBuffer(data))); + + HttpResponse res = ch.readInbound(); + assertThat(res.protocolVersion(), sameInstance(HttpVersion.HTTP_1_1)); + assertThat(res.status(), is(HttpResponseStatus.PROCESSING)); + HttpContent content = ch.readInbound(); + // HTTP 102 is not allowed to have content. + assertThat(content.content().readableBytes(), is(0)); + content.release(); + + assertThat(ch.finish(), is(false)); + } + @Test public void testMultipleResponses() { String response = "HTTP/1.1 200 OK\r\n" +