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/23 19:33:29 UTC

svn commit: r1799695 - in /httpd/test/framework/trunk/t: conf/ htdocs/modules/proxy/fcgi-generic-rewrite/ htdocs/modules/proxy/fcgi-generic/ modules/

Author: jchampion
Date: Fri Jun 23 19:33:29 2017
New Revision: 1799695

URL: http://svn.apache.org/viewvc?rev=1799695&view=rev
Log:
proxy_fcgi: add GENERIC backend type regression tests

For PR59618 and the followup PR59815.

Added:
    httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic/
    httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic-rewrite/
    httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic-rewrite/index.php   (with props)
    httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic/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=1799695&r1=1799694&r2=1799695&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/proxy.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/proxy.conf.in Fri Jun 23 19:33:29 2017
@@ -69,6 +69,25 @@
         SetHandler proxy:fcgi://127.0.0.1:${FCGI_PORT}
       </FilesMatch>
     </Directory>
+
+    <IfVersion >= 2.4.26>
+      <Directory @SERVERROOT@/htdocs/modules/proxy/fcgi-generic>
+        ProxyFCGIBackendType GENERIC
+        <FilesMatch \.php$>
+          SetHandler proxy:fcgi://127.0.0.1:${FCGI_PORT}
+        </FilesMatch>
+      </Directory>
+    </IfVersion>
+
+    <IfVersion >= 2.4.26>
+    <IfModule mod_rewrite.c>
+      <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>
+    </IfModule>
+    </IfVersion>
   </VirtualHost>
 </IfModule>
 

Added: httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic-rewrite/index.php
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic-rewrite/index.php?rev=1799695&view=auto
==============================================================================
--- httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic-rewrite/index.php (added)
+++ httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic-rewrite/index.php Fri Jun 23 19:33:29 2017
@@ -0,0 +1,3 @@
+<?php
+  /* This does nothing; it's just a placeholder. */
+?>

Propchange: httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic-rewrite/index.php
------------------------------------------------------------------------------
    svn:eol-style = native

Added: httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic/index.php
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic/index.php?rev=1799695&view=auto
==============================================================================
--- httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic/index.php (added)
+++ httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic/index.php Fri Jun 23 19:33:29 2017
@@ -0,0 +1,3 @@
+<?php
+  /* This does nothing; it's just a placeholder. */
+?>

Propchange: httpd/test/framework/trunk/t/htdocs/modules/proxy/fcgi-generic/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=1799695&r1=1799694&r2=1799695&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/proxy_fcgi.t (original)
+++ httpd/test/framework/trunk/t/modules/proxy_fcgi.t Fri Jun 23 19:33:29 2017
@@ -5,9 +5,11 @@ use Apache::Test;
 use Apache::TestRequest;
 use Apache::TestUtil;
 
-my $have_fcgisetenvif = have_min_apache_version('2.4.26');
+my $have_fcgisetenvif    = have_min_apache_version('2.4.26');
+my $have_fcgibackendtype = have_min_apache_version('2.4.26');
 
-plan tests => (7 * $have_fcgisetenvif) + 2,
+plan tests => (7 * $have_fcgisetenvif) + (2 * $have_fcgibackendtype) +
+               (2 * $have_fcgibackendtype * have_module('rewrite')) + 2,
      need (
         'mod_proxy_fcgi',
         'FCGI',
@@ -136,14 +138,13 @@ sub run_fcgi_envvar_request($$)
 # depending on the test conditions, that may not always be the case...
 my $fcgi_port = Apache::Test::vars('proxy_fcgi_port') - 1;
 my $envs;
+my $docroot = Apache::Test::vars('documentroot');
 
 if ($have_fcgisetenvif) {
     # ProxyFCGISetEnvIf tests. Query the backend.
     $envs = run_fcgi_envvar_request($fcgi_port, "/fcgisetenv?query");
 
     # Check the response values.
-    my $docroot = Apache::Test::vars('documentroot');
-
     ok t_cmp($envs->{'QUERY_STRING'},     'test_value', "ProxyFCGISetEnvIf can override an existing variable");
     ok t_cmp($envs->{'TEST_NOT_SET'},     undef,        "ProxyFCGISetEnvIf does not set variables if condition is false");
     ok t_cmp($envs->{'TEST_EMPTY'},       '',           "ProxyFCGISetEnvIf can set empty values");
@@ -152,6 +153,23 @@ if ($have_fcgisetenvif) {
     ok t_cmp($envs->{'REMOTE_ADDR'},      undef,        "ProxyFCGISetEnvIf can unset var");
 }
 
+# Tests for GENERIC backend type behavior.
+if ($have_fcgibackendtype) {
+    $envs = run_fcgi_envvar_request($fcgi_port, "/modules/proxy/fcgi-generic/index.php?query");
+
+    ok t_cmp($envs->{'SCRIPT_FILENAME'},
+             $docroot . '/modules/proxy/fcgi-generic/index.php',
+             "GENERIC SCRIPT_FILENAME should have neither query string nor proxy: prefix");
+}
+
+if ($have_fcgibackendtype && have_module('rewrite')) {
+    $envs = run_fcgi_envvar_request($fcgi_port, "/modules/proxy/fcgi-generic-rewrite/index.php?query");
+
+    ok t_cmp($envs->{'SCRIPT_FILENAME'},
+             $docroot . '/modules/proxy/fcgi-generic-rewrite/index.php',
+             "GENERIC SCRIPT_FILENAME should have neither query string nor proxy: prefix");
+}
+
 # Regression test for PR61202.
 $envs = run_fcgi_envvar_request($fcgi_port, "/modules/proxy/fcgi/index.php");