From: Fabian Keil <fk@fabiankeil.de>
Date: Mon, 25 May 2020 10:01:57 +0000 (+0200)
Subject: receive_and_send_encrypted_post_data(): Loop until no data is left
X-Git-Tag: v_3_0_29~414
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/static/user-manual/@proxy-info-url@?a=commitdiff_plain;h=ef490f500f6910b0c620319020a4cd395e31e12b;p=privoxy.git

receive_and_send_encrypted_post_data(): Loop until no data is left

... if the content length is known.

Previously data that wasn't received yet was ignored
which could result in incomplete uploads.

Sponsored by: Robert Klemme
---

diff --git a/jcc.c b/jcc.c
index 4354fd2e..85c41825 100644
--- a/jcc.c
+++ b/jcc.c
@@ -2053,7 +2053,8 @@ static jb_err receive_and_send_encrypted_post_data(struct client_state *csp)
 {
    int content_length_known = csp->expected_client_content_length != 0;
 
-   while (is_ssl_pending(&(csp->mbedtls_client_attr.ssl)))
+   while (is_ssl_pending(&(csp->mbedtls_client_attr.ssl))
+      || (content_length_known && csp->expected_client_content_length != 0))
    {
       unsigned char buf[BUFFER_SIZE];
       int len;