]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: fcgi: Don't set the status to 302 if it is already set
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 17 Feb 2025 15:37:47 +0000 (16:37 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 17 Feb 2025 15:37:53 +0000 (16:37 +0100)
When a "Location" header was found in a FCGI response, the status code was
forced to 302. But it should only be performed if no status code was set
first.

So now, we take care to not override an already defined status code when the
"Location" header is found.

This patch should fix the issue #2865. It must backported to all stable
versions.

src/h1_htx.c

index 611519c45285c984928e65257e817542cf1442f8..e731e88264b3411ca69ebcd4d67a160e7cfb2e9c 100644 (file)
@@ -274,7 +274,7 @@ static int h1_postparse_res_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
                        if (isteqi(hdrs[hdr].n, ist("status"))) {
                                code = http_parse_status_val(hdrs[hdr].v, &status, &reason);
                        }
-                       else if (isteqi(hdrs[hdr].n, ist("location"))) {
+                       else if (isteqi(hdrs[hdr].n, ist("location")) && !code) {
                                code = 302;
                                status = ist("302");
                                reason = ist("Found");