[libsoup] Fix reserved opcode



commit 5dec678b276c5e378a530599f021d8a39e28dd8b
Author: Italo Guerrieri <guerital amazon it>
Date:   Thu Dec 28 11:55:23 2017 +0100

    Fix reserved opcode
    
    Some opcode are reserved for future implementations of the
    WebSocket protocol. If these reserved code are send,
    the connection needs to be closed.
    Fix Autobahn test cases 4.*.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792113

 libsoup/soup-websocket-connection.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
index ef984b5..f381256 100644
--- a/libsoup/soup-websocket-connection.c
+++ b/libsoup/soup-websocket-connection.c
@@ -691,7 +691,8 @@ process_contents (SoupWebsocketConnection *self,
                        break;
                default:
                        g_debug ("received unsupported control frame: %d", (int)opcode);
-                       break;
+                       protocol_error_and_close (self);
+                       return;
                }
        } else if (pv->close_received) {
                g_debug ("received message after close was received");
@@ -757,7 +758,8 @@ process_contents (SoupWebsocketConnection *self,
                        break;
                default:
                        g_debug ("received unknown data frame: %d", (int)opcode);
-                       break;
+                       protocol_error_and_close (self);
+                       return;
                }
 
                /* Actually deliver the message? */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]