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.
This commit is contained in:
Scott Mitchell 2014-11-22 09:30:02 -05:00 committed by Norman Maurer
parent df7a1223f4
commit 95540bd49e

View File

@ -182,7 +182,7 @@ public class HttpClientUpgradeHandler extends HttpObjectAggregator {
throw new IllegalStateException( throw new IllegalStateException(
"Switching Protocols response missing UPGRADE header"); "Switching Protocols response missing UPGRADE header");
} }
if (AsciiString.equalsIgnoreCase(upgradeCodec.protocol(), upgradeHeader)) { if (!AsciiString.equalsIgnoreCase(upgradeCodec.protocol(), upgradeHeader)) {
throw new IllegalStateException( throw new IllegalStateException(
"Switching Protocols response with unexpected UPGRADE protocol: " "Switching Protocols response with unexpected UPGRADE protocol: "
+ upgradeHeader); + upgradeHeader);