1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Changed client handshake to use "Origin" instead of "Sec-WebSocket-Origin" as defined by RFC 6455 when using version 13 of the protocol.

This commit is contained in:
David Galeano 2013-01-09 15:31:46 +08:00 committed by Andy Green
parent cb19368e14
commit aa0bc86143

View file

@ -950,9 +950,16 @@ libwebsockets_generate_client_handshake(struct libwebsocket_context *context,
strcpy(p, wsi->key_b64);
p += strlen(wsi->key_b64);
p += sprintf(p, "\x0d\x0a");
if (wsi->c_origin)
if (wsi->c_origin) {
if (wsi->ietf_spec_revision == 13) {
p += sprintf(p, "Origin: %s\x0d\x0a",
wsi->c_origin);
}
else {
p += sprintf(p, "Sec-WebSocket-Origin: %s\x0d\x0a",
wsi->c_origin);
}
}
if (wsi->c_protocol)
p += sprintf(p, "Sec-WebSocket-Protocol: %s\x0d\x0a",
wsi->c_protocol);