Skip to content

Commit 84d3caf

Browse files
EricNRSkartben
authored andcommitted
net: websocket: fix masked data when server sends close
When sending the close command as a server, the data is incorrectly masked which violates RFC6455 section 5.1. Use the is_client flag to avoid masking if the close is for a websocket server. Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
1 parent 00ffb5b commit 84d3caf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/lib/websocket/websocket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ static int websocket_interal_disconnect(struct websocket_context *ctx)
421421
NET_DBG("[%p] Disconnecting", ctx);
422422

423423
ret = websocket_send_msg(ctx->sock, NULL, 0, WEBSOCKET_OPCODE_CLOSE,
424-
true, true, SYS_FOREVER_MS);
424+
ctx->is_client, true, SYS_FOREVER_MS);
425425
if (ret < 0) {
426426
NET_DBG("[%p] Failed to send close message (err %d).", ctx, ret);
427427
}

0 commit comments

Comments
 (0)