normalize_lws(): Only log the 'Reducing whitespace ...' message once per header
authorFabian Keil <fk@fabiankeil.de>
Sun, 8 Sep 2024 11:32:35 +0000 (13:32 +0200)
committerFabian Keil <fk@fabiankeil.de>
Thu, 10 Oct 2024 04:49:05 +0000 (06:49 +0200)
parsers.c

index 1cb46df..a14f970 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -903,6 +903,7 @@ jb_err decompress_iob(struct client_state *csp)
 static void normalize_lws(char *header)
 {
    char *p = header;
+   int reducing_white_space_message_logged = 0;
 
    while (*p != '\0')
    {
@@ -914,7 +915,11 @@ static void normalize_lws(char *header)
          {
             q++;
          }
-         log_error(LOG_LEVEL_HEADER, "Reducing whitespace in '%s'", header);
+         if (!reducing_white_space_message_logged)
+         {
+            log_error(LOG_LEVEL_HEADER, "Reducing whitespace in '%s'", header);
+            reducing_white_space_message_logged = 1;
+         }
          string_move(p+1, q);
       }