Skip to content

Commit 4b2afeb

Browse files
committed
Only prepend a "/" onto the path when there isn't already one there. Closes TooTallNate#6.
1 parent 2f819b4 commit 4b2afeb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/net/tootallnate/websocket/WebSocketClient.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,11 @@ public void run() {
175175
// Now that we're connected, re-register for only 'READ' keys.
176176
client.register(selector, SelectionKey.OP_READ);
177177

178-
// Now send WebSocket client-side handshake
179-
String path = "/" + uri.getPath();
178+
// Now send the WebSocket client-side handshake
179+
String path = uri.getPath();
180+
if (path.indexOf("/") != 0) {
181+
path = "/" + path;
182+
}
180183
String host = uri.getHost() + (port != WebSocket.DEFAULT_PORT ? ":" + port : "");
181184
String origin = null; // TODO: Make 'origin' configurable
182185
String request = "GET " + path + " HTTP/1.1\r\n" +

0 commit comments

Comments
 (0)