Allow zero-length pong to be received by server
authorAndrejs Hanins <ahanins@gmail.com>
Tue, 1 Dec 2015 12:44:33 +0000 (14:44 +0200)
committerAndy Green <andy.green@linaro.org>
Tue, 1 Dec 2015 12:59:52 +0000 (20:59 +0800)
Client code already allows zero-length pongs

lib/parsers.c

index ef9c3e7..cec9585 100644 (file)
@@ -985,7 +985,8 @@ ping_drop:
                                LWS_EXT_CALLBACK_PAYLOAD_RX, &eff_buf, 0) < 0)
                        return -1;
 
-               if (eff_buf.token_len > 0) {
+               if (eff_buf.token_len > 0 ||
+                   callback_action == LWS_CALLBACK_RECEIVE_PONG) {
                        eff_buf.token[eff_buf.token_len] = '\0';
 
                        if (wsi->protocol->callback) {