1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-14 03:13:54 +02:00
openwrt-packages/net/lighttpd/patches/0002-mod_cgi-fix-CGI-local-redir-w-url.rewrite-once-fixes.patch
Rafał Miłecki 1359e072be lighttpd: backport more mod_cgi fixes queued for 1.4.46
The most important change is local redirects being disabled by default.
There is an option called cgi.local-redir that allows enabling this
optimization manually back if needed.

Local redirects were initially introduced in 1.4.40 but caused many
problems for *some* web services.

One of problems is breaking Post/Redirect/Get design pattern. With
redirects handled on server side there is no browser redirection making
it "lose" the POST data.

Another possible issue are HTML forms with action="". With CGI local
redirects browser may be sending form data to the wrong URL (the one
that was supposed to redirect the browser).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-06-29 09:41:30 +02:00

35 lines
1.2 KiB
Diff

From ab85841b142c62c47f69fc45c0b54f080d54ddc9 Mon Sep 17 00:00:00 2001
From: Glenn Strauss <gstrauss@gluelogic.com>
Date: Mon, 20 Feb 2017 14:47:13 -0500
Subject: [PATCH] [mod_cgi] fix CGI local-redir w/ url.rewrite-once (fixes
#2793)
x-ref:
"1.4.40 regression: broken redirect (using Location) between url.rewrite-once URLs"
https://redmine.lighttpd.net/issues/2793
---
src/mod_cgi.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- a/src/mod_cgi.c
+++ b/src/mod_cgi.c
@@ -583,8 +583,7 @@ static int cgi_demux_response(server *sr
}
connection_response_reset(srv, con); /*(includes con->http_status = 0)*/
-
- con->mode = DIRECT;
+ plugins_call_connection_reset(srv, con);
return FDEVENT_HANDLED_COMEBACK;
}
}
@@ -803,7 +802,7 @@ static int cgi_recv_response(server *srv
/* if we get a IN|HUP and have read everything don't exec the close twice */
return HANDLER_FINISHED;
case FDEVENT_HANDLED_COMEBACK:
- cgi_connection_close(srv, hctx);
+ /*cgi_connection_close(srv, hctx);*//*(already cleaned up and hctx is now invalid)*/
return HANDLER_COMEBACK;
case FDEVENT_HANDLED_ERROR:
log_error_write(srv, __FILE__, __LINE__, "s", "demuxer failed: ");