If the server sends multiple Connection headers, only parse and forward the first one
authorFabian Keil <fk@fabiankeil.de>
Sun, 22 Jun 2025 08:57:09 +0000 (10:57 +0200)
committerFabian Keil <fk@fabiankeil.de>
Tue, 24 Jun 2025 12:09:35 +0000 (14:09 +0200)
parsers.c

index 3be2add..37bbc13 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1857,6 +1857,14 @@ static int keep_alive_keyword_detected(const char *header)
  *********************************************************************/
 static jb_err server_connection(struct client_state *csp, char **header)
 {
+   if ((csp->flags & CSP_FLAG_SERVER_CONNECTION_HEADER_SET) != 0)
+   {
+      log_error(LOG_LEVEL_HEADER,
+         "Removing \'%s\' header to only parse and forward one.", *header);
+      freez(*header);
+
+      return JB_ERR_OK;
+   }
    if (keep_alive_keyword_detected(*header)
 #ifdef FEATURE_CONNECTION_KEEP_ALIVE
     && !(csp->flags & CSP_FLAG_SERVER_SOCKET_TAINTED)