From a7d3372b3d924ac43993bc4d9743ab29186e6e61 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Mon, 17 Aug 2015 15:23:31 +0200 Subject: [PATCH] [#4095] Correctly handle Upgrade responses with special handling of Hixie 76 Motivation: Hixie 76 needs special handling compared to other connection upgrade responses. Our detection code of non websocket responses did actually always use the special handling that only should be used for Hixie 76 responses. Modifications: Correctly detect connection upgrade responses which are not for websockets. Result: Be able to upgrade connections for other protocols then websockets. --- .../java/io/netty/handler/codec/http/HttpObjectDecoder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java index 09ad9acf49..7dff08f33d 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java @@ -457,7 +457,8 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder { // - https://github.com/netty/netty/issues/222 if (code >= 100 && code < 200) { // One exception: Hixie 76 websocket handshake response - return !(code == 101 && !res.headers().contains(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT)); + return !(code == 101 && !res.headers().contains(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT) + && res.headers().contains(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET, true)); } switch (code) {