Don't forward connection options Privoxy doesn't understand
authorFabian Keil <fk@fabiankeil.de>
Mon, 10 Feb 2025 11:05:22 +0000 (12:05 +0100)
committerFabian Keil <fk@fabiankeil.de>
Wed, 18 Jun 2025 03:48:30 +0000 (05:48 +0200)
parsers.c

index 944a932..605f54a 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1870,8 +1870,20 @@ static jb_err server_connection(struct client_state *csp, char **header)
 
       if ((csp->flags & CSP_FLAG_CLIENT_CONNECTION_KEEP_ALIVE))
       {
-         log_error(LOG_LEVEL_HEADER,
-            "Keeping the server header '%s' around.", *header);
+         if (!strcmpic(*header, "Connection: keep-alive"))
+         {
+            log_error(LOG_LEVEL_HEADER,
+               "Keeping the server header '%s' around.", *header);
+         }
+         else
+         {
+            char *old_header = *header;
+
+            *header = strdup_or_die("Connection: keep-alive");
+            log_error(LOG_LEVEL_HEADER, "Replaced: \'%s\' with \'%s\'",
+               old_header, *header);
+            freez(old_header);
+         }
       }
       else
 #endif /* FEATURE_CONNECTION_KEEP_ALIVE */