[#729] Correctly handle urls with empty abs_path in it when issue the websocket handshake

This commit is contained in:
Norman Maurer 2012-11-12 15:29:02 +01:00
parent 105f952f5d
commit 2d5028bfd6
3 changed files with 12 additions and 0 deletions

View File

@ -137,6 +137,10 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
path = wsURL.getPath() + '?' + wsURL.getQuery();
}
if (path == null || path.isEmpty()) {
path = "/";
}
// Format request
HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
request.addHeader(Names.UPGRADE, Values.WEBSOCKET);

View File

@ -105,6 +105,10 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker {
path = wsURL.getPath() + '?' + wsURL.getQuery();
}
if (path == null || path.isEmpty()) {
path = "/";
}
// Get 16 bit nonce and base 64 encode it
byte[] nonce = WebSocketUtil.randomBytes(16);
String key = WebSocketUtil.base64(nonce);

View File

@ -105,6 +105,10 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
path = wsURL.getPath() + '?' + wsURL.getQuery();
}
if (path == null || path.isEmpty()) {
path = "/";
}
// Get 16 bit nonce and base 64 encode it
byte[] nonce = WebSocketUtil.randomBytes(16);
String key = WebSocketUtil.base64(nonce);