From 7ffbe1bfca47b8d92426ea7163a39bae6e0bd62a Mon Sep 17 00:00:00 2001 From: David Galeano Date: Thu, 10 Jan 2013 10:35:32 +0800 Subject: [PATCH] Fixed to keep reading data until the SSL internal buffer is empty. Before this fix only 2048 bytes were read, the rest were buffered inside SSL until another message arrived!!! --- lib/libwebsockets.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 66112a22..c5a6f400 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -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; }