From 95540bd49e12ea1e600d45ffe5334a8a393a3f4d Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Sat, 22 Nov 2014 09:30:02 -0500 Subject: [PATCH] HTTP Client Upgrade Handler Compare Issue Motivation: The HttpClientUpgradeHandler attempts to compare a supported codec against the input codec but the comparison logic is reversed. Modification: Negate the logic in HttpClientUpgradeHandler so an error is detected in the error condition. Result: HttpClientUpgradeHandler should not fail the upgrade when the input protocol is valid. --- .../io/netty/handler/codec/http/HttpClientUpgradeHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java index fdf9c2b45a..fa7b35d21a 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java @@ -182,7 +182,7 @@ public class HttpClientUpgradeHandler extends HttpObjectAggregator { throw new IllegalStateException( "Switching Protocols response missing UPGRADE header"); } - if (AsciiString.equalsIgnoreCase(upgradeCodec.protocol(), upgradeHeader)) { + if (!AsciiString.equalsIgnoreCase(upgradeCodec.protocol(), upgradeHeader)) { throw new IllegalStateException( "Switching Protocols response with unexpected UPGRADE protocol: " + upgradeHeader);