serve(): Close the client socket as well
authorFabian Keil <fk@fabiankeil.de>
Sat, 6 Mar 2021 10:52:10 +0000 (11:52 +0100)
committerFabian Keil <fk@fabiankeil.de>
Fri, 12 Mar 2021 11:34:11 +0000 (12:34 +0100)
... if the server socket for an inspected connection has been closed.

Privoxy currently can't establish a new server connection
when the client socket is reused and would drop the connection
in continue_https_chat() anyway.

jcc.c

diff --git a/jcc.c b/jcc.c
index ee408b3..cd7bf71 100644 (file)
--- a/jcc.c
+++ b/jcc.c
@@ -4847,6 +4847,22 @@ static void serve(struct client_state *csp)
 #endif
             close_socket(csp->server_connection.sfd);
             mark_connection_closed(&csp->server_connection);
+#ifdef FEATURE_HTTPS_INSPECTION
+            if (continue_chatting && client_use_ssl(csp))
+            {
+               /*
+                * Close the client socket as well as Privoxy currently
+                * can't establish a new server connection when the client
+                * socket is reused and would drop the connection in
+                * continue_https_chat() anyway.
+                */
+               continue_chatting = 0;
+               csp->flags &= ~CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE;
+               log_error(LOG_LEVEL_CONNECT,
+                  "Client socket %d is no longer usable. "
+                  "The server socket has been closed.", csp->cfd);
+            }
+#endif
          }
       }