Skip to content

Commit cb907bf

Browse files
authored
Update WebSocketClient.java
Added check for wss default port to avoid including it into the host. Some servers with proxy balancers may missunderstand the url if it includes the default port.
1 parent c08be4e commit cb907bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/org/java_websocket/client/WebSocketClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,9 @@ private void sendHandshake() throws InvalidHandshakeException {
434434
if( part2 != null )
435435
path += '?' + part2;
436436
int port = getPort();
437-
String host = uri.getHost() + ( port != WebSocket.DEFAULT_PORT ? ":" + port : "" );
437+
String host = uri.getHost() + (
438+
(port != WebSocket.DEFAULT_PORT && port != WbSocket.DEFAULT_WSS_PORT)
439+
? ":" + port : "" );
438440

439441
HandshakeImpl1Client handshake = new HandshakeImpl1Client();
440442
handshake.setResourceDescriptor( path );

0 commit comments

Comments
 (0)