From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 5 Jun 2020 11:28:48 +0000 (+0200)
Subject: Use the connect-failed template when the forwarding proxy fails
X-Git-Tag: v_3_0_29~320
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/faq/%22https:/static/diff?a=commitdiff_plain;h=4b4f741402ad9b9d1bc3268a5e31d5f94141305b;p=privoxy.git

Use the connect-failed template when the forwarding proxy fails

... with https inspection enabled. Forwarding the response from
the proxy to the client will not work as the client expects
an encrypted response.

Sponsored by: Robert Klemme
---

diff --git a/jcc.c b/jcc.c
index 2389a8db..d0f0b34b 100644
--- a/jcc.c
+++ b/jcc.c
@@ -3891,8 +3891,11 @@ static void chat(struct client_state *csp)
             {
                log_error(LOG_LEVEL_ERROR, "Forwarder hasn't established "
                   "connection with destination server.");
-
-               write_socket(csp->cfd, server_response, (size_t)len);
+               rsp = error_response(csp, "connect-failed");
+               if (rsp)
+               {
+                  send_crunch_response(csp, rsp);
+               }
                mark_server_socket_tainted(csp);
                close_client_ssl_connection(csp);
                return;