You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2019/06/18 14:16:27 UTC
svn commit: r1861580 - in /httpd/test/framework/trunk/t: conf/extra.conf.in
modules/alias.t
Author: covener
Date: Tue Jun 18 14:16:27 2019
New Revision: 1861580
URL: http://svn.apache.org/viewvc?rev=1861580&view=rev
Log:
test RedirectRelative in trunk
Modified:
httpd/test/framework/trunk/t/conf/extra.conf.in
httpd/test/framework/trunk/t/modules/alias.t
Modified: httpd/test/framework/trunk/t/conf/extra.conf.in
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/conf/extra.conf.in?rev=1861580&r1=1861579&r2=1861580&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/extra.conf.in Tue Jun 18 14:16:27 2019
@@ -423,6 +423,24 @@
</IfDefine>
</IfModule>
+
+<IfVersion >= 2.5.1>
+ <Location /redirect_relative/default>
+ Redirect /out-default
+ </Location>
+ <Location /redirect_relative/on>
+ RedirectRelative ON
+ Redirect /out-on
+ </Location>
+ <Location /redirect_relative/off>
+ RedirectRelative OFF
+ Redirect /out-off
+ </Location>
+ <Location /redirect_relative/off/fail>
+ Redirect fail-to-construct-url
+ </Location>
+</IfVersion>
+
Alias /manual @inherit_documentroot@/manual
<Location /manual>
Order deny,allow
Modified: httpd/test/framework/trunk/t/modules/alias.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/alias.t?rev=1861580&r1=1861579&r2=1861580&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/alias.t (original)
+++ httpd/test/framework/trunk/t/modules/alias.t Tue Jun 18 14:16:27 2019
@@ -35,6 +35,14 @@ my %rm_rc = (
f => '403'
);
+
+my %relative_redirects = (
+ "/redirect_relative/default" => "^http", # URL should be absolute
+ "/redirect_relative/on" => "^/out-on", # URL should be relative
+ "/redirect_relative/off" => "^http", # URL should be absolute
+ "/redirect_relative/off/fail" => undef, # 500 due to invalid URL
+);
+
#XXX: find something that'll on other platforms (/bin/sh aint it)
my $script_tests = WINFU ? 0 : 4 + have_min_apache_version("2.4.19");
@@ -44,6 +52,10 @@ my $tests = 12 + have_min_apache_version
(keys %rm_rc) * (1 + have_min_apache_version("2.4.19")) * 10 +
$script_tests;
+if (have_min_apache_version("2.5.1")) {
+ $tests += (keys %relative_redirects)*2;
+}
+
#LWP required to follow redirects
plan tests => $tests, need need_module('alias'), need_lwp;
@@ -207,3 +219,22 @@ ok t_cmp((GET_RC "/aliascgi-nada"),
## clean up ##
t_rmtree("$vars->{t_logs}/mod_cgi.log");
+
+
+if (have_min_apache_version("2.5.1")) {
+ my ($path, $regex);
+ while (($path, $regex) = each (%relative_redirects)) {
+ local $Apache::TestRequest::RedirectOK = 0;
+ my $r;
+ $r = GET($path);
+ if (defined($regex)) {
+ ok t_cmp($r->code, "302");
+ ok t_cmp($r->header("Location"), qr/$regex/, "failure on $path");
+ }
+ else {
+ ok t_cmp($r->code, "500");
+ ok t_cmp($r->header("Location"), undef, "failure on $path");
+ }
+ }
+}
+