Fixed to keep reading data until the SSL internal buffer is empty. 67/2867/1
authorDavid Galeano <davidgaleano@turbulenz.biz>
Thu, 10 Jan 2013 02:35:32 +0000 (10:35 +0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Thu, 7 Mar 2013 21:01:23 +0000 (13:01 -0800)
Before this fix only 2048 bytes were read,
the rest were buffered inside SSL until another message arrived!!!

lib/libwebsockets.c

index 66112a2..c5a6f40 100644 (file)
@@ -1998,6 +1998,7 @@ bail3:
                        break;
 
 #ifdef LWS_OPENSSL_SUPPORT
+read_pending:
                if (wsi->ssl)
                        eff_buf.token_len = SSL_read(wsi->ssl, buf, sizeof buf);
                else
@@ -2070,6 +2071,11 @@ bail3:
                        eff_buf.token = NULL;
                        eff_buf.token_len = 0;
                }
+
+#ifdef LWS_OPENSSL_SUPPORT
+               if (wsi->ssl && SSL_pending(wsi->ssl))
+                       goto read_pending;
+#endif
                break;
        }