]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: http_ana: always drop the Expect header in HTTP/1.0
authorWilly Tarreau <w@1wt.eu>
Mon, 23 Nov 2026 08:47:23 +0000 (09:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 23 Nov 2026 22:24:23 +0000 (23:24 +0100)
The Expect header wasn't specified in HTTP/1.0, and its only known
value 100-continue isn't usable there. Yet it continues to fool various
servers and reverse-proxies. Let's just drop it when seen in 1.0 requests
to be sure not to respond.

src/http_ana.c

index fb87d5ec48abc9e3446ff24ffbe04998797691bd..9d208798abbd59e2beea97f4ee9ae3bd47882fd0 100644 (file)
@@ -213,6 +213,14 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
                goto return_bad_req;
        }
 
+       /* Note that Expect: is not supported in HTTP/1.0 and must be dropped */
+       if (unlikely(!(msg->flags & HTTP_MSGF_VER_11))) {
+               struct http_hdr_ctx ctx = { .blk = NULL };
+
+               while (http_find_header(htx, ist("expect"), &ctx, 1))
+                       http_remove_header(htx, &ctx);
+       }
+
        /*
         * 2: check if the URI matches the monitor_uri.  We have to do this for
         * every request which gets in, because the monitor-uri is defined by