From: Anthony Minessale Date: Thu, 7 Feb 2013 23:47:04 +0000 (-0600) Subject: fix for firefox secure websockets which for some reason writes only 1 byte first... X-Git-Tag: v1.5.1~359 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52e7a63bbfc2b4cc43f64699867f35a19018f9fc;p=thirdparty%2Ffreeswitch.git fix for firefox secure websockets which for some reason writes only 1 byte first on secure ws frame --- diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 65fa826e1c..afbf80923d 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -441,8 +441,10 @@ ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) } if ((wsh->datalen = ws_raw_read(wsh, wsh->buffer, 14)) < need) { - /* too small - protocol err */ - return ws_close(wsh, WS_PROTO_ERR); + if ((wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen)) < need) { + /* too small - protocol err */ + return ws_close(wsh, WS_PROTO_ERR); + } } *oc = *wsh->buffer & 0xf;