[#1558] Corrects handling of port number in WebSockets handshake header values

* This patch was inspired by the work of @golovnin
This commit is contained in:
Norman Maurer 2013-07-11 23:23:36 +02:00
parent daa79f3a11
commit 2380461861

View File

@ -116,6 +116,16 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
// Format request
int wsPort = wsURL.getPort();
// check if the URI contained a port if not set the correct one depending on the schema.
// See https://github.com/netty/netty/pull/1558
if (wsPort == -1) {
if ("https".equals(wsURL.getScheme())) {
wsPort = 443;
} else {
wsPort = 80;
}
}
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
HttpHeaders headers = request.headers();