]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7587: keep sofia-sip ws lib in sync
authorMichael Jerris <mike@jerris.com>
Mon, 1 Jun 2015 19:27:45 +0000 (15:27 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 1 Jun 2015 19:27:45 +0000 (15:27 -0400)
libs/sofia-sip/libsofia-sip-ua/tport/ws.c

index 8a46b65502e2cf40ab282309d70abbb53407f20d..6e9a69d025713d64670ee8f61ccaf349413bbcac 100644 (file)
@@ -691,6 +691,7 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
        ssize_t need = 2;
        char *maskp;
        int ll = 0;
+       int frag = 0;
 
  again:
        need = 2;
@@ -741,8 +742,16 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
        case WSOC_PING:
        case WSOC_PONG:
                {
-                       //int fin = (wsh->buffer[0] >> 7) & 1;
+                       int fin = (wsh->buffer[0] >> 7) & 1;
                        int mask = (wsh->buffer[1] >> 7) & 1;
+                       
+                       if (fin) {
+                               if (*oc == WSOC_CONTINUATION) {
+                                       frag = 1;
+                               } else {
+                                       frag = 0;
+                               }
+                       }
 
                        if (mask) {
                                need += 4;
@@ -837,6 +846,10 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data)
                                ws_write_frame(wsh, WSOC_PONG, wsh->payload, wsh->rplen);
                                goto again;
                        }
+
+                       if (frag) {
+                               goto again;
+                       }
                        
 
                        *(wsh->payload+wsh->rplen) = '\0';