8000 Allow to disable "Origin" header · Quanghoster/arduinoWebSockets@ad07f3c · GitHub
[go: up one dir, main page]

Skip to content

Commit ad07f3c

Browse files
authored
Allow to disable "Origin" header
The origin header often makes trouble with current WebSocket implementations. Thus, we introduce the WEBSOCKET_HEADERS_NO_ORIGIN macro which disables this header it if defined.
1 parent a4533a0 commit ad07f3c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/WebSocketsClient.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,12 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
479479
handshake += WEBSOCKETS_STRING("Connection: keep-alive\r\n");
480480
}
481481

482-
handshake += WEBSOCKETS_STRING("Origin: file://\r\n"
483-
"User-Agent: arduino-WebSocket-Client\r\n");
482+
#ifndef WEBSOCKET_HEADERS_NO_ORIGIN
483+
// add origin header if requested
484+
handshake += WEBSOCKETS_STRING("Origin: file://\r\n");
485+
#endif
486+
487+
handshake += WEBSOCKETS_STRING("User-Agent: arduino-WebSocket-Client\r\n");
484488

485489
if(client->base64Authorization.length() > 0) {
486490
handshake += WEBSOCKETS_STRING("Authorization: Basic ");

0 commit comments

Comments
 (0)
0