[#729] Correctly handle urls with empty abs_path in it when issue the websocket handshake
This commit is contained in:
parent
adee1b4156
commit
df575c6cd0
@ -155,6 +155,10 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
|
|||||||
path = wsURL.getPath() + '?' + wsURL.getQuery();
|
path = wsURL.getPath() + '?' + wsURL.getQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path == null || path.length() == 0) {
|
||||||
|
path = "/";
|
||||||
|
}
|
||||||
|
|
||||||
// Format request
|
// Format request
|
||||||
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
|
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
|
||||||
request.addHeader(Names.UPGRADE, Values.WEBSOCKET);
|
request.addHeader(Names.UPGRADE, Values.WEBSOCKET);
|
||||||
|
@ -128,6 +128,10 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker {
|
|||||||
path = wsURL.getPath() + '?' + wsURL.getQuery();
|
path = wsURL.getPath() + '?' + wsURL.getQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path == null || path.length() == 0) {
|
||||||
|
path = "/";
|
||||||
|
}
|
||||||
|
|
||||||
// Get 16 bit nonce and base 64 encode it
|
// Get 16 bit nonce and base 64 encode it
|
||||||
ChannelBuffer nonce = ChannelBuffers.wrappedBuffer(WebSocketUtil.randomBytes(16));
|
ChannelBuffer nonce = ChannelBuffers.wrappedBuffer(WebSocketUtil.randomBytes(16));
|
||||||
String key = WebSocketUtil.base64(nonce);
|
String key = WebSocketUtil.base64(nonce);
|
||||||
|
@ -127,6 +127,10 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
|
|||||||
path = wsURL.getPath() + '?' + wsURL.getQuery();
|
path = wsURL.getPath() + '?' + wsURL.getQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (path == null || path.length() == 0) {
|
||||||
|
path = "/";
|
||||||
|
}
|
||||||
|
|
||||||
// Get 16 bit nonce and base 64 encode it
|
// Get 16 bit nonce and base 64 encode it
|
||||||
ChannelBuffer nonce = ChannelBuffers.wrappedBuffer(WebSocketUtil.randomBytes(16));
|
ChannelBuffer nonce = ChannelBuffers.wrappedBuffer(WebSocketUtil.randomBytes(16));
|
||||||
String key = WebSocketUtil.base64(nonce);
|
String key = WebSocketUtil.base64(nonce);
|
||||||
|
Loading…
Reference in New Issue
Block a user