sed(): Don't call enforce_header_order() if a filter removed the request line
authorFabian Keil <fk@fabiankeil.de>
Tue, 5 Jan 2021 13:32:50 +0000 (14:32 +0100)
committerFabian Keil <fk@fabiankeil.de>
Tue, 5 Jan 2021 13:56:02 +0000 (14:56 +0100)
... as enforce_header_order() asserts that the request line is present.

Without the request line the request will be rejected as invalid
later on anyway, so sorting the headers first is pointless.

parsers.c

index d63647d..ba151d1 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1291,7 +1291,9 @@ jb_err sed(struct client_state *csp, int filter_server_headers)
       f++;
    }
 
-   if (!filter_server_headers && !list_is_empty(csp->config->ordered_client_headers))
+   if (!filter_server_headers &&
+       !list_is_empty(csp->config->ordered_client_headers) &&
+       csp->headers->first->str != NULL)
    {
       enforce_header_order(csp->headers, csp->config->ordered_client_headers);
    }