Correctly handle responses with return code of 1xx. See #222

This commit is contained in:
norman 2012-03-20 15:40:34 +01:00
parent d68b104969
commit 8d9f78c84d

View File

@ -368,14 +368,13 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
if (msg instanceof HttpResponse) {
HttpResponse res = (HttpResponse) msg;
int code = res.getStatus().getCode();
if (code < 200) {
// Old Web Socket upgrade response had 16-byte fixed length content.
// See https://github.com/netty/netty/issues/222
if (code == 101 &&
res.containsHeader(HttpHeaders.Names.SEC_WEBSOCKET_ORIGIN) &&
res.containsHeader(HttpHeaders.Names.SEC_WEBSOCKET_LOCATION)) {
return false;
}
// Correctly handle return codes of 1xx.
//
// See:
// - http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html Section 4.4
// - https://github.com/netty/netty/issues/222
if (!isDecodingRequest() && code >= 100 && code < 200) {
return true;
}