mirror of https://github.com/nealey/eris.git
fix HTTP redirect
This commit is contained in:
parent
f56fbd7477
commit
9683c12bbd
2
cgi.c
2
cgi.c
|
@ -111,7 +111,7 @@ cgi_parent(int cin, int cout, int passthru)
|
||||||
if (! header_sent) {
|
if (! header_sent) {
|
||||||
if (! strcasecmp(cgiheader, "Location")) {
|
if (! strcasecmp(cgiheader, "Location")) {
|
||||||
header(302, "CGI Redirect");
|
header(302, "CGI Redirect");
|
||||||
fwrite(cgiheader, 1, cgiheaderlen, stdout);
|
printf("%s: %s\r\n\r\n", cgiheader, val);
|
||||||
dolog(302, 0);
|
dolog(302, 0);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
9
test.sh
9
test.sh
|
@ -55,6 +55,12 @@ echo 'james'
|
||||||
EOD
|
EOD
|
||||||
chmod +x default/mongo.cgi
|
chmod +x default/mongo.cgi
|
||||||
|
|
||||||
|
cat <<'EOD' > default/redir.cgi
|
||||||
|
#! /bin/sh
|
||||||
|
echo "Location: http://example.com/froot"
|
||||||
|
EOD
|
||||||
|
chmod +x default/redir.cgi
|
||||||
|
|
||||||
mkdir -p default/empty
|
mkdir -p default/empty
|
||||||
mkdir -p default/subdir
|
mkdir -p default/subdir
|
||||||
touch default/subdir/a
|
touch default/subdir/a
|
||||||
|
@ -202,6 +208,9 @@ printf 'GET /a.cgi HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | d | grep -Eq '%S
|
||||||
title "Large response"
|
title "Large response"
|
||||||
printf 'GET /mongo.cgi HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | grep -q james && pass || fail
|
printf 'GET /mongo.cgi HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | grep -q james && pass || fail
|
||||||
|
|
||||||
|
title "Redirect"
|
||||||
|
printf 'GET /redir.cgi HTTP/1.0\r\n\r\n' | $HTTPD_CGI 2>/dev/null | grep -Fq 'Location: http://example.com/froot' && pass || fail
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
H "Timeouts"
|
H "Timeouts"
|
||||||
|
|
Loading…
Reference in New Issue