Skip to content

Commit dac71c4

Browse files
authored
moving host header
try to fix #159
1 parent 60903a2 commit dac71c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/WebSocketsClient.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
427427
transport = "&transport=websocket&sid=" + client->cSessionId;
428428
}
429429
handshake = "GET " + client->cUrl + transport + " HTTP/1.1\r\n"
430+
"Host: " + _host + ":" + _port + "\r\n"
430431
"Connection: Upgrade\r\n"
431432
"Upgrade: websocket\r\n"
432433
"Sec-WebSocket-Version: 13\r\n"
@@ -442,11 +443,11 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
442443

443444
} else {
444445
handshake = "GET " + client->cUrl + "&transport=polling HTTP/1.1\r\n"
446+
"Host: " + _host + ":" + _port + "\r\n"
445447
"Connection: keep-alive\r\n";
446448
}
447449

448-
handshake += "Host: " + _host + ":" + _port + "\r\n"
449-
"Origin: file://\r\n"
450+
handshake += "Origin: file://\r\n"
450451
"User-Agent: arduino-WebSocket-Client\r\n";
451452

452453
if(client->base64Authorization.length() > 0) {

0 commit comments

Comments
 (0)