Skip to content

Commit cfc38a8

Browse files
zbuckleyjpwsutton
authored andcommitted
fix issue for reverse proxy (#240)
* Bumping version to 1.1.0 Signed-off-by: James Sutton <james.sutton@uk.ibm.com> * Updating Versions in Readme Signed-off-by: James Sutton <james.sutton@uk.ibm.com> * fix issue for reverse proxy Header information included :80 and/or :443 when Host: was written to socket. This doesn't work well for reverse proxy solutions which don't redirect correctly when the Host: info in the header isn't simply a host name. Signed-off-by: zbuckley <buckley.zach@gmail.com> * removed unnecesary white-space changes from prev commit Signed-off-by: zbuckley <buckley.zach@gmail.com> * updated to use curly braces as requested
1 parent ee9f3b8 commit cfc38a8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/websocket

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/websocket/WebSocketHandshake.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,13 @@ private void sendHandshakeRequest(String key) throws IOException{
9393

9494
PrintWriter pw = new PrintWriter(output);
9595
pw.print("GET " + path + " HTTP/1.1" + LINE_SEPARATOR);
96-
pw.print("Host: " + host + ":" + port + LINE_SEPARATOR);
96+
if (port != 80 && port != 443) {
97+
pw.print("Host: " + host + ":" + port + LINE_SEPARATOR);
98+
}
99+
else {
100+
pw.print("Host: " + host + LINE_SEPARATOR);
101+
}
102+
97103
pw.print("Upgrade: websocket" + LINE_SEPARATOR);
98104
pw.print("Connection: Upgrade" + LINE_SEPARATOR);
99105
pw.print("Sec-WebSocket-Key: " + key + LINE_SEPARATOR);

0 commit comments

Comments
 (0)