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) { if (msg instanceof HttpResponse) {
HttpResponse res = (HttpResponse) msg; HttpResponse res = (HttpResponse) msg;
int code = res.getStatus().getCode(); int code = res.getStatus().getCode();
if (code < 200) {
// Old Web Socket upgrade response had 16-byte fixed length content. // Correctly handle return codes of 1xx.
// See https://github.com/netty/netty/issues/222 //
if (code == 101 && // See:
res.containsHeader(HttpHeaders.Names.SEC_WEBSOCKET_ORIGIN) && // - http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html Section 4.4
res.containsHeader(HttpHeaders.Names.SEC_WEBSOCKET_LOCATION)) { // - https://github.com/netty/netty/issues/222
return false; if (!isDecodingRequest() && code >= 100 && code < 200) {
}
return true; return true;
} }