]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_http_websocket.c: Continue reading after ping/pong
authorNickolay Shmyrev <nshmyrev@alphacephei.com>
Mon, 22 Jun 2020 17:16:15 +0000 (19:16 +0200)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Tue, 7 Jul 2020 13:54:06 +0000 (08:54 -0500)
Do not return error if the client received ping frame
while looking for a string and just wait for another frame.

ASTERISK-28958 #close

Change-Id: I4d06b4827bd71e56cbaafc011ffdcef9f0332922

res/res_http_websocket.c

index 9e9f4f14c4eb7726da2a03b4026af893fd5314ff..541c22f8a74af4eac5c04b7866d88f3bf0fbeb60 100644 (file)
@@ -1434,6 +1434,12 @@ int AST_OPTIONAL_API_NAME(ast_websocket_read_string)
                        return -1;
                }
 
+               if (opcode == AST_WEBSOCKET_OPCODE_PING) {
+                       /* Try read again, we have sent pong already */
+                       fragmented = 1;
+                       continue;
+               }
+
                if (opcode == AST_WEBSOCKET_OPCODE_CONTINUATION) {
                        continue;
                }