Index: t/conf/proxy.conf.in
===================================================================
--- t/conf/proxy.conf.in (revision 1745237)
+++ t/conf/proxy.conf.in (working copy)
@@ -42,6 +42,19 @@
+
+ Define FCGI_PORT @NextAvailablePort@
+
+
+
+ SetHandler proxy:fcgi://127.0.0.1:${FCGI_PORT}
+
+
+
+
+
+
+
AllowOverride All
Index: t/modules/proxy_fcgi.t
===================================================================
--- t/modules/proxy_fcgi.t (nonexistent)
+++ t/modules/proxy_fcgi.t (working copy)
@@ -0,0 +1,54 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+
+plan tests => 2, [qw(CGI::Fast mod_proxy_fcgi)];
+require CGI::Fast;
+
+Apache::TestRequest::module("proxy_fcgi");
+
+my $htdocs = Apache::Test::vars('documentroot');
+
+# XXX There appears to be no way to get the value of a dynamically-reserved
+# @NextAvailablePort@ from Apache::Test. We assume here that the port reserved
+# for the proxy_fcgi vhost is one greater than the reserved FCGI_PORT, but
+# depending on the test conditions, that may not always be the case...
+my $fcgi_port = Apache::Test::vars('proxy_fcgi_port') - 1;
+
+# Launch a short-lived FCGI daemon.
+if (fork) {
+ # Listen for and respond to exactly one request from the client.
+ $ENV{'FCGI_SOCKET_PATH'} = "127.0.0.1:$fcgi_port";
+ new CGI::Fast;
+
+ # Echo all the envvars back to the client.
+ print("Content-Type: text/plain\r\n\r\n");
+ foreach my $key (sort(keys %ENV)) {
+ print($key, "=", $ENV{$key}, "\n");
+ }
+
+ exit;
+}
+
+# Wait for the daemon to launch.
+sleep 1;
+
+# Hit the backend.
+my $r = GET("/fcgitest");
+ok t_cmp($r->code, 200, "proxy to FCGI backend");
+
+# Split the returned envvars into a dictionary.
+my %envs = ();
+
+foreach my $line (split /\n/, $r->content) {
+ t_debug("> $line"); # log the response lines for debugging
+
+ my @components = split /=/, $line, 2;
+ $envs{$components[0]} = $components[1];
+}
+
+# Check the response values.
+ok t_cmp($envs{'SCRIPT_FILENAME'}, "$htdocs/fcgitest", "SCRIPT_FILENAME value");