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.
This commit is contained in:
Martin Becker
2017-07-18 12:37:04 +02:00
committed by GitHub
parent a4533a028c
commit ad07f3c665

View File

@ -479,8 +479,12 @@ void WebSocketsClient::sendHeader(WSclient_t * client) {
handshake += WEBSOCKETS_STRING("Connection: keep-alive\r\n");
}
handshake += WEBSOCKETS_STRING("Origin: file://\r\n"
"User-Agent: arduino-WebSocket-Client\r\n");
#ifndef WEBSOCKET_HEADERS_NO_ORIGIN
// add origin header if requested
handshake += WEBSOCKETS_STRING("Origin: file://\r\n");
#endif
handshake += WEBSOCKETS_STRING("User-Agent: arduino-WebSocket-Client\r\n");
if(client->base64Authorization.length() > 0) {
handshake += WEBSOCKETS_STRING("Authorization: Basic ");