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

This commit is contained in:
norman 2012-03-20 15:43:52 +01:00
parent cc41970d2f
commit 8532112224

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 (code >= 100 && code < 200) {
return true;
}
@ -387,6 +386,7 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
return false;
}
private Object reset() {
HttpMessage message = this.message;
ChannelBuffer content = this.content;