machinezone / IXWebSocket

websocket and http client and server library, with TLS support and very few dependencies
BSD 3-Clause "New" or "Revised" License
512 stars 167 forks source link

Adding port to host in WebSocketHandshake::clientHandshake causes HTTP/1.1 404 Not Found #521

Open ArthurChristianus opened 1 week ago

ArthurChristianus commented 1 week ago

Hi! First of all, I would like to thank you for the effort you put in creating this library. The ease of use and clean syntax makes it great to work with.

I am trying to create a websocket connection to a server. However, when adding the port to the host in the initial handshake message, the server returns HTTP/1.1 404 Not Found.

E.g. This can connect to the server:

ss << "GET " << path << " HTTP/1.1\r\n";
ss << "Host: " << host << "\r\n";
ss << "Upgrade: websocket\r\n";

And this cannot:

ss << "GET " << path << " HTTP/1.1\r\n";
ss << "Host: " << host << ":" << port << "\r\n";
ss << "Upgrade: websocket\r\n";

I am completely new to websockets so I am unsure if this is a problem with IXWidgets. If it is, I am more than willing to create a pull request to fix this.