You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jc...@apache.org on 2017/06/26 16:05:18 UTC
svn commit: r1799939 - in /httpd/test/framework/trunk/t: conf/proxy.conf.in
htdocs/modules/proxy/fcgi-rewrite-path-info/
htdocs/modules/proxy/fcgi-rewrite-path-info/index.php modules/proxy_fcgi.t
Author: jchampion
Date: Mon Jun 26 16:05:18 2017
New Revision: 1799939
URL: http://svn.apache.org/viewvc?rev=1799939&view=rev
Log:
proxy_fcgi.t: add rewrite-PATH_INFO-to-script regression case
This the case that prompted reversion to 2.4.20 behavior.
Added:
httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-rewrite-path-info/
httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-rewrite-path-info/index.php (with props)
Modified:
httpd/test/framework/trunk/t/conf/proxy.conf.in
httpd/test/framework/trunk/t/modules/proxy_fcgi.t
Modified: httpd/test/framework/trunk/t/conf/proxy.conf.in
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/conf/proxy.conf.in?rev=1799939&r1=1799938&r2=1799939&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/proxy.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/proxy.conf.in Mon Jun 26 16:05:18 2017
@@ -79,15 +79,24 @@
</Directory>
</IfVersion>
- <IfVersion >= 2.4.26>
<IfModule mod_rewrite.c>
- <Directory @SERVERROOT@/htdocs/modules/proxy/fcgi-generic-rewrite>
- ProxyFCGIBackendType GENERIC
+ <IfVersion >= 2.4.26>
+ <Directory @SERVERROOT@/htdocs/modules/proxy/fcgi-generic-rewrite>
+ ProxyFCGIBackendType GENERIC
+ RewriteEngine On
+ RewriteRule ^.*\.php(/.*)?$ fcgi://127.0.0.1:${FCGI_PORT}@SERVERROOT@/htdocs/modules/proxy/fcgi-generic-rewrite/$0 [L,P]
+ </Directory>
+ </IfVersion>
+
+ <Directory @SERVERROOT@/htdocs/modules/proxy/fcgi-rewrite-path-info>
RewriteEngine On
- RewriteRule ^.*\.php(/.*)?$ fcgi://127.0.0.1:${FCGI_PORT}@SERVERROOT@/htdocs/modules/proxy/fcgi-generic-rewrite/$0 [L,P]
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^.*$ index.php/$0 [L]
+ <Files index.php>
+ SetHandler proxy:fcgi://127.0.0.1:${FCGI_PORT}
+ </Files>
</Directory>
</IfModule>
- </IfVersion>
</VirtualHost>
</IfModule>
Added: httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-rewrite-path-info/index.php
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-rewrite-path-info/index.php?rev=1799939&view=auto
==============================================================================
--- httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-rewrite-path-info/index.php (added)
+++ httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-rewrite-path-info/index.php Mon Jun 26 16:05:18 2017
@@ -0,0 +1,3 @@
+<?php
+ /* This does nothing; it's just a placeholder. */
+?>
Propchange: httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-rewrite-path-info/index.php
------------------------------------------------------------------------------
svn:eol-style = native
Modified: httpd/test/framework/trunk/t/modules/proxy_fcgi.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/proxy_fcgi.t?rev=1799939&r1=1799938&r2=1799939&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/proxy_fcgi.t (original)
+++ httpd/test/framework/trunk/t/modules/proxy_fcgi.t Mon Jun 26 16:05:18 2017
@@ -9,7 +9,8 @@ my $have_fcgisetenvif = have_min_apac
my $have_fcgibackendtype = have_min_apache_version('2.4.26');
plan tests => (7 * $have_fcgisetenvif) + (2 * $have_fcgibackendtype) +
- (2 * $have_fcgibackendtype * have_module('rewrite')) + 2,
+ (2 * $have_fcgibackendtype * have_module('rewrite')) +
+ (7 * have_module('rewrite')) + 2,
need (
'mod_proxy_fcgi',
'FCGI',
@@ -110,7 +111,7 @@ sub run_fcgi_envvar_request($$)
# Hit the backend.
my $r = GET($uri);
- ok t_cmp($r->code, 200, "proxy to FCGI backend works");
+ ok t_cmp($r->code, 200, "proxy to FCGI backend works (" . $uri . ")");
# Split the returned envvars into a dictionary.
my %envs = ();
@@ -155,6 +156,7 @@ if ($have_fcgisetenvif) {
# Tests for GENERIC backend type behavior.
if ($have_fcgibackendtype) {
+ # Regression test for PR59618.
$envs = run_fcgi_envvar_request($fcgi_port, "/modules/proxy/fcgi-generic/index.php?query");
ok t_cmp($envs->{'SCRIPT_FILENAME'},
@@ -163,6 +165,7 @@ if ($have_fcgibackendtype) {
}
if ($have_fcgibackendtype && have_module('rewrite')) {
+ # Regression test for PR59815.
$envs = run_fcgi_envvar_request($fcgi_port, "/modules/proxy/fcgi-generic-rewrite/index.php?query");
ok t_cmp($envs->{'SCRIPT_FILENAME'},
@@ -170,6 +173,32 @@ if ($have_fcgibackendtype && have_module
"GENERIC SCRIPT_FILENAME should have neither query string nor proxy: prefix");
}
+if (have_module('rewrite')) {
+ # Regression test for general FPM breakage when using mod_rewrite for
+ # nice-looking URIs; see
+ # https://github.com/apache/httpd/commit/cab0bfbb2645bb8f689535e5e2834e2dbc23f5a5#commitcomment-20393588
+ $envs = run_fcgi_envvar_request($fcgi_port, "/modules/proxy/fcgi-rewrite-path-info/path/info?query");
+
+ # Not all of these values follow the CGI spec, but unfortunately FPM expects
+ # some breakage and doesn't function properly without it, so we can't fully
+ # fix the problem by default. These tests verify that we follow the 2.4.20
+ # way of doing things for the "rewrite-redirect PATH_INFO to script" case.
+ ok t_cmp($envs->{'SCRIPT_FILENAME'}, "proxy:fcgi://127.0.0.1:" . $fcgi_port
+ . $docroot
+ . '/modules/proxy/fcgi-rewrite-path-info/index.php',
+ "Default SCRIPT_FILENAME has proxy:fcgi prefix for compatibility");
+ ok t_cmp($envs->{'SCRIPT_NAME'}, '/modules/proxy/fcgi-rewrite-path-info/index.php',
+ "Default SCRIPT_NAME uses actual path to script");
+ ok t_cmp($envs->{'PATH_INFO'}, '/path/info',
+ "Default PATH_INFO is correct");
+ ok t_cmp($envs->{'PATH_TRANSLATED'}, $docroot . '/path/info',
+ "Default PATH_TRANSLATED is correct");
+ ok t_cmp($envs->{'QUERY_STRING'}, 'query',
+ "Default QUERY_STRING is correct");
+ ok t_cmp($envs->{'REDIRECT_URL'}, '/modules/proxy/fcgi-rewrite-path-info/path/info',
+ "Default REDIRECT_URL uses original client URL");
+}
+
# Regression test for PR61202.
$envs = run_fcgi_envvar_request($fcgi_port, "/modules/proxy/fcgi/index.php");