1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

relay: fix disconnection of client on empty websocket frames

WeeChat disconnects any client when a frame with length 0 is recieved.
This commit is contained in:
Tor Hveem
2014-05-08 11:13:08 +02:00
committed by Sébastien Helleu
parent 87e9a061b5
commit 9e282febfd
+10 -1
View File
@@ -488,7 +488,16 @@ relay_client_recv_cb (void *arg_client, int fd)
(unsigned long long)num_read,
(unsigned char *)decoded,
&decoded_length);
if (!rc || (decoded_length == 0))
if (decoded_length == 0)
{
/* When decoded length is 0, assume client sent a PONG frame.
*
* RFC 6455 Section 5.5.3
* "A Pong frame MAY be sent unsolicited. This serves as a unidirectional heartbeat. A response to an unsolicited Pong frame is not expected."
*/
return WEECHAT_RC_OK;
}
if (!rc)
{
/* error when decoding frame: close connection */
weechat_printf_tags (NULL, "relay_client",