Fix https inspection with HTTP forwarding
authorFabian Keil <fk@fabiankeil.de>
Fri, 5 Jun 2020 10:19:09 +0000 (12:19 +0200)
committerFabian Keil <fk@fabiankeil.de>
Fri, 5 Jun 2020 13:58:24 +0000 (15:58 +0200)
Previously Privoxy would not send the CSUCCEED
message to the client so the client would not
send the encrypted request.

Now that we send the CSUCCEED, we don't need to
forward the response from the upstream HTTP proxy
anymore.

Sponsored by: Robert Klemme

jcc.c

diff --git a/jcc.c b/jcc.c
index c401fed..a4a588c 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -3735,24 +3735,18 @@ static void chat(struct client_state *csp)
       {
          int ret;
          /*
       {
          int ret;
          /*
-          * Creating an SSL proxy. If forwarding is disabled, we must send
-          * CSUCCEED message to client. Then TLS/SSL connection with client
-          * is created.
+          * Creating a SSL proxy.
+          *
+          * By sending the CSUCCEED message we're lying to the client as
+          * the connection hasn't actually been established yet. We don't
+          * establish the connection until we have seen and parsed the
+          * encrypted client headers.
           */
           */
-
-         if (fwd->forward_host == NULL)
+         if (write_socket_delayed(csp->cfd, CSUCCEED,
+               strlen(CSUCCEED), get_write_delay(csp)) != 0)
          {
          {
-            /*
-             * We're lying to the client as the connection hasn't actually
-             * been established yet. We don't establish the connection until
-             * we have seen and parsed the encrypted client headers.
-             */
-            if (write_socket_delayed(csp->cfd, CSUCCEED,
-                  strlen(CSUCCEED), get_write_delay(csp)) != 0)
-            {
-               log_error(LOG_LEVEL_ERROR, "Sending SUCCEED to client failed");
-               return;
-            }
+            log_error(LOG_LEVEL_ERROR, "Sending SUCCEED to client failed");
+            return;
          }
 
          ret = create_client_ssl_connection(csp);
          }
 
          ret = create_client_ssl_connection(csp);
@@ -3927,20 +3921,6 @@ static void chat(struct client_state *csp)
                }
                return;
             }
                }
                return;
             }
-
-            /*
-             * TLS/SSL connection with parent proxy is established, we can
-             * inform client about success.
-             */
-            ret = write_socket(csp->cfd, server_response, (size_t)len);
-            if (ret != 0)
-            {
-               log_error(LOG_LEVEL_ERROR,
-                  "Sending parent proxy response to client failed");
-               mark_server_socket_tainted(csp);
-               close_client_ssl_connection(csp);
-               return;
-            }
          }/* -END- if (fwd->forward_host != NULL) */
          else
          {
          }/* -END- if (fwd->forward_host != NULL) */
          else
          {