Skip to content

Commit e330495

Browse files
author
Stephane Landelle
committed
minor clean up
1 parent 09a97fe commit e330495

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/com/ning/http/client/providers/netty/handler/WebSocketProtocol.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,10 @@ public void handle(Channel channel, NettyResponseFuture<?> future, Object e) thr
8787

8888
boolean validStatus = response.getStatus().equals(SWITCHING_PROTOCOLS);
8989
boolean validUpgrade = response.headers().get(HttpHeaders.Names.UPGRADE) != null;
90-
String c = response.headers().get(HttpHeaders.Names.CONNECTION);
91-
if (c == null) {
92-
c = response.headers().get(HttpHeaders.Names.CONNECTION.toLowerCase(Locale.ENGLISH));
93-
}
94-
95-
boolean validConnection = c != null && c.equalsIgnoreCase(HttpHeaders.Values.UPGRADE);
90+
String connection = response.headers().get(HttpHeaders.Names.CONNECTION);
91+
if (connection == null)
92+
connection = response.headers().get(HttpHeaders.Names.CONNECTION.toLowerCase(Locale.ENGLISH));
93+
boolean validConnection = HttpHeaders.Values.UPGRADE.equalsIgnoreCase(connection);
9694

9795
status = new NettyResponseStatus(future.getURI(), config, response);
9896
final boolean statusReceived = handler.onStatusReceived(status) == STATE.UPGRADE;

0 commit comments

Comments
 (0)