r66515 - in /trunk/libplack-perl: ./ debian/ lib/ lib/Plack/ lib/Plack/Handler/ lib/Plack/Server/ lib/Plack/Test/ t/ t/Plack-Handler/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Mon Dec 27 19:46:04 UTC 2010


Author: jawnsy-guest
Date: Mon Dec 27 19:45:56 2010
New Revision: 66515

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66515
Log:
New upstream release

Modified:
    trunk/libplack-perl/Changes
    trunk/libplack-perl/META.yml
    trunk/libplack-perl/debian/changelog
    trunk/libplack-perl/lib/Plack.pm
    trunk/libplack-perl/lib/Plack/Handler/Apache2.pm
    trunk/libplack-perl/lib/Plack/Handler/FCGI.pm
    trunk/libplack-perl/lib/Plack/Request.pm
    trunk/libplack-perl/lib/Plack/Response.pm
    trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm
    trunk/libplack-perl/lib/Plack/Test/Suite.pm
    trunk/libplack-perl/t/FCGIUtils.pm
    trunk/libplack-perl/t/Plack-Handler/apache2.t
    trunk/libplack-perl/t/Plack-Handler/cgi.t
    trunk/libplack-perl/t/Plack-Handler/fcgi.t

Modified: trunk/libplack-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/Changes?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/Changes (original)
+++ trunk/libplack-perl/Changes Mon Dec 27 19:45:56 2010
@@ -1,6 +1,10 @@
 Revision history for Perl extension Plack
 
 Take a look at http://github.com/miyagawa/Plack/issues for the planned changes before 1.0 release.
+
+0.9960  Sat Dec 25 11:16:08 PST 2010
+        - FCGI: Fixed the bug introduced in 0.9958 where PATH_INFO contains the SCRIPT_NAME value (ambs)
+        - Improved the FastCGI and Apache2 test infrastructure to test SCRIPT_NAME values
 
 0.9959  Tue Dec 21 11:38:08 PST 2010
         - Apache2: Fixed the regression bug around LocationMatch caused by fixes in 0.9958 (cho45)

Modified: trunk/libplack-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/META.yml?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/META.yml (original)
+++ trunk/libplack-perl/META.yml Mon Dec 27 19:45:56 2010
@@ -38,4 +38,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://github.com/miyagawa/Plack.git
-version: 0.9959
+version: 0.9960

Modified: trunk/libplack-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/debian/changelog?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/debian/changelog (original)
+++ trunk/libplack-perl/debian/changelog Mon Dec 27 19:45:56 2010
@@ -1,8 +1,8 @@
-libplack-perl (0.9959-1) UNRELEASED; urgency=low
+libplack-perl (0.9960-1) UNRELEASED; urgency=low
 
   * New upstream release
 
- -- Jonathan Yu <jawnsy at cpan.org>  Fri, 24 Dec 2010 00:40:05 -0500
+ -- Jonathan Yu <jawnsy at cpan.org>  Mon, 27 Dec 2010 11:39:34 -0500
 
 libplack-perl (0.9951-1) unstable; urgency=low
 

Modified: trunk/libplack-perl/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack.pm (original)
+++ trunk/libplack-perl/lib/Plack.pm Mon Dec 27 19:45:56 2010
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9959';
+our $VERSION = '0.9960';
 $VERSION = eval $VERSION;
 
 1;

Modified: trunk/libplack-perl/lib/Plack/Handler/Apache2.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Handler/Apache2.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Handler/Apache2.pm (original)
+++ trunk/libplack-perl/lib/Plack/Handler/Apache2.pm Mon Dec 27 19:45:56 2010
@@ -97,7 +97,11 @@
     my $location = $r->location;
 
     # Let's *guess* if we're in a LocationMatch directive
-    if ($path_info =~ s{^($location)/?}{/}) {
+    if ($location eq '/') {
+        # <Location /> could be handled as a 'root' case where we make
+        # everything PATH_INFO and empty SCRIPT_NAME as in the PSGI spec
+        $env->{SCRIPT_NAME} = '';
+    } elsif ($path_info =~ s{^($location)/?}{/}) {
         $env->{SCRIPT_NAME} = $1 || '';
     } else {
         # Apache's <Location> is matched but here is not.

Modified: trunk/libplack-perl/lib/Plack/Handler/FCGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Handler/FCGI.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Handler/FCGI.pm (original)
+++ trunk/libplack-perl/lib/Plack/Handler/FCGI.pm Mon Dec 27 19:45:56 2010
@@ -104,9 +104,10 @@
         delete $env->{HTTP_CONTENT_TYPE};
         delete $env->{HTTP_CONTENT_LENGTH};
 
-        # recover multiple slashes
+        # lighttpd munges multiple slashes in PATH_INFO into one. Try recovering it
         my $uri = URI->new($env->{REQUEST_URI});
         $env->{PATH_INFO} = uri_unescape($uri->path);
+        $env->{PATH_INFO} =~ s/^\Q$env->{SCRIPT_NAME}\E//;
 
         if ($env->{SERVER_SOFTWARE} && $env->{SERVER_SOFTWARE} =~ m!lighttpd[-/]1\.(\d+\.\d+)!) {
             no warnings;

Modified: trunk/libplack-perl/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Request.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Request.pm (original)
+++ trunk/libplack-perl/lib/Plack/Request.pm Mon Dec 27 19:45:56 2010
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9959';
+our $VERSION = '0.9960';
 $VERSION = eval $VERSION;
 
 use HTTP::Headers;
@@ -542,7 +542,8 @@
 
 Returns GET and POST parameters with a CGI.pm-compatible param
 method. This is an alternative method for accessing parameters in
-$req->parameters.
+$req->parameters. Unlike CGI.pm, it does I<not> allow
+setting or modifying query parameters.
 
     $value  = $req->param( 'foo' );
     @values = $req->param( 'foo' );

Modified: trunk/libplack-perl/lib/Plack/Response.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Response.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Response.pm (original)
+++ trunk/libplack-perl/lib/Plack/Response.pm Mon Dec 27 19:45:56 2010
@@ -1,7 +1,7 @@
 package Plack::Response;
 use strict;
 use warnings;
-our $VERSION = '0.9959';
+our $VERSION = '0.9960';
 $VERSION = eval $VERSION;
 
 use Plack::Util::Accessor qw(body status);

Modified: trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm (original)
+++ trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm Mon Dec 27 19:45:56 2010
@@ -1,6 +1,6 @@
 package Plack::Server::ServerSimple;
 use strict;
-our $VERSION = '0.9959';
+our $VERSION = '0.9960';
 $VERSION = eval $VERSION;
 
 use parent qw(Plack::Handler::HTTP::Server::Simple);

Modified: trunk/libplack-perl/lib/Plack/Test/Suite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Test/Suite.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Test/Suite.pm (original)
+++ trunk/libplack-perl/lib/Plack/Test/Suite.pm Mon Dec 27 19:45:56 2010
@@ -16,13 +16,25 @@
 
 my $share_dir = try { File::ShareDir::dist_dir('Plack') } || 'share';
 
-$ENV{PLACK_TEST_PATH_PREFIX} = '';
+$ENV{PLACK_TEST_SCRIPT_NAME} = '';
 
 # 0: test name
 # 1: request generator coderef.
 # 2: request handler
 # 3: test case for response
 our @TEST = (
+    [
+        'SCRIPT_NAME',
+        sub {
+            my $cb = shift;
+            my $res = $cb->(GET "http://127.0.0.1/");
+            is $res->content, $ENV{PLACK_TEST_SCRIPT_NAME};
+        },
+        sub {
+            my $env = shift;
+            return [ 200, ["Content-Type", "text/plain"], [ $env->{SCRIPT_NAME} ] ];
+        },
+    ],
     [
         'GET',
         sub {
@@ -478,7 +490,7 @@
         sub {
             my $cb  = shift;
             my $res = $cb->(GET "http://127.0.0.1/foo/bar%20baz%73?x=a");
-            is $res->content, ($ENV{PLACK_TEST_PATH_PREFIX} || '') . "/foo/bar%20baz%73?x=a";
+            is $res->content, $ENV{PLACK_TEST_SCRIPT_NAME} . "/foo/bar%20baz%73?x=a";
         },
         sub {
             my $env = shift;
@@ -737,8 +749,8 @@
                 my $cb = sub {
                     my $req = shift;
                     $req->uri->port($http_port || $port);
-                    if ($ENV{PLACK_TEST_PATH_PREFIX}) {
-                        $req->uri->path($ENV{PLACK_TEST_PATH_PREFIX} . $req->uri->path);
+                    if ($ENV{PLACK_TEST_SCRIPT_NAME}) {
+                        $req->uri->path($ENV{PLACK_TEST_SCRIPT_NAME} . $req->uri->path);
                     }
                     $req->header('X-Plack-Test' => $i);
                     return $ua->request($req);

Modified: trunk/libplack-perl/t/FCGIUtils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/FCGIUtils.pm?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/t/FCGIUtils.pm (original)
+++ trunk/libplack-perl/t/FCGIUtils.pm Mon Dec 27 19:45:56 2010
@@ -12,11 +12,6 @@
 # this file is copied from Catalyst. thanks!
 
 our @EXPORT = qw/ test_lighty_external test_fcgi_standalone /;
-
-# TODO: tesst for .fcgi 
-sub test_lighty_fcgi {
-
-}
 
 # test using FCGI::Client + FCGI External Server
 sub test_fcgi_standalone {
@@ -94,6 +89,7 @@
 
 sub _render_conf {
     my ($tmpdir, $port, $fcgiport) = @_;
+    my $script_name = $ENV{PLACK_TEST_SCRIPT_NAME} || '/';
     <<"END";
 # basic lighttpd config file for testing fcgi(external server)+Plack
 server.modules += ("mod_fastcgi")
@@ -105,7 +101,7 @@
 
 # HTTP::Engine app specific fcgi setup
 fastcgi.server = (
-    "/" => ((
+    "$script_name" => ((
             "check-local"     => "disable",
             "host"            => "127.0.0.1",
             "port"            => $fcgiport,

Modified: trunk/libplack-perl/t/Plack-Handler/apache2.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Handler/apache2.t?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Handler/apache2.t (original)
+++ trunk/libplack-perl/t/Plack-Handler/apache2.t Mon Dec 27 19:45:56 2010
@@ -13,7 +13,7 @@
 # Note: you need to load 64bit lib to test Apache2 on OS X 10.5 or later
 
 Plack::Test::Suite->run_server_tests(run_httpd(\&_render_conf));
-local $ENV{PLACK_TEST_PATH_PREFIX} = '/foo/bar/baz';
+local $ENV{PLACK_TEST_SCRIPT_NAME} = '/foo/bar/baz';
 Plack::Test::Suite->run_server_tests( run_httpd(\&_render_conf_location),);
 Plack::Test::Suite->run_server_tests( run_httpd(\&_render_conf_location_match),);
 done_testing();

Modified: trunk/libplack-perl/t/Plack-Handler/cgi.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Handler/cgi.t?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Handler/cgi.t (original)
+++ trunk/libplack-perl/t/Plack-Handler/cgi.t Mon Dec 27 19:45:56 2010
@@ -14,6 +14,7 @@
 Plack::Test::Suite->runtests(sub {
     my ($name, $test, $handler) = @_;
     local $ENV{PLACK_TEST_HANDLER} = 'CGI';
+    local $ENV{PLACK_TEST_SCRIPT_NAME} = '/plack_test.cgi';
 
     note $name;
     my $cb = sub {
@@ -21,10 +22,15 @@
 
         my $cgi = HTTP::Request::AsCGI->new($req);
         my $c = $cgi->setup;
+
+        # Fix CGI container parameters
         $ENV{SCRIPT_NAME} = '/plack_test.cgi';
+        $ENV{REQUEST_URI} = "/plack_test.cgi$ENV{REQUEST_URI}";
+
         # Apache's CGI implementation does not pass "Authorization" header by untrusted ENV.
         # We bow down to it under this test.
         delete $ENV{HTTP_AUTHORIZATION};
+
         eval { Plack::Handler::CGI->new->run($handler) };
         my $res = $c->response;
         $res->request($req);

Modified: trunk/libplack-perl/t/Plack-Handler/fcgi.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Handler/fcgi.t?rev=66515&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Handler/fcgi.t (original)
+++ trunk/libplack-perl/t/Plack-Handler/fcgi.t Mon Dec 27 19:45:56 2010
@@ -10,13 +10,17 @@
 my $lighty_port;
 my $fcgi_port;
 
-test_lighty_external(
-   sub {
-       ($lighty_port, $fcgi_port, my $needs_fix) = @_;
-       Plack::Test::Suite->run_server_tests(run_server_cb($needs_fix), $fcgi_port, $lighty_port);
-       done_testing();
-    }
-);
+for ('', '/fastcgi') {
+    $ENV{PLACK_TEST_SCRIPT_NAME} = $_;
+    test_lighty_external(
+        sub {
+            ($lighty_port, $fcgi_port, my $needs_fix) = @_;
+            Plack::Test::Suite->run_server_tests(run_server_cb($needs_fix), $fcgi_port, $lighty_port);
+        }
+    );
+}
+
+done_testing();
 
 {
     package Plack::Handler::FCGI::Manager;
@@ -35,8 +39,10 @@
     return sub {
         my($port, $app) = @_;
 
-        note "Applying LighttpdScriptNameFix" if $needs_fix;
-        $app = Plack::Middleware::LighttpdScriptNameFix->wrap($app) if $needs_fix;
+        if ($needs_fix) {
+            note "Applying LighttpdScriptNameFix";
+            $app = Plack::Middleware::LighttpdScriptNameFix->wrap($app);
+        }
 
         $| = 0; # Test::Builder autoflushes this. reset!
 




More information about the Pkg-perl-cvs-commits mailing list