r60095 - in /trunk/libplack-perl: ./ debian/ inc/Module/ inc/Module/Install/ lib/ lib/HTTP/Server/ lib/Plack/ lib/Plack/Middleware/ lib/Plack/Server/ lib/Plack/Test/ t/Plack-Middleware/ t/Plack-Request/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Mon Jul 5 20:27:57 UTC 2010


Author: gregoa
Date: Mon Jul  5 20:27:48 2010
New Revision: 60095

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

Added:
    trunk/libplack-perl/t/Plack-Request/path_info_escaped.t
      - copied unchanged from r60094, branches/upstream/libplack-perl/current/t/Plack-Request/path_info_escaped.t
Modified:
    trunk/libplack-perl/Changes
    trunk/libplack-perl/MANIFEST
    trunk/libplack-perl/META.yml
    trunk/libplack-perl/README
    trunk/libplack-perl/debian/changelog
    trunk/libplack-perl/inc/Module/Install.pm
    trunk/libplack-perl/inc/Module/Install/AutoInstall.pm
    trunk/libplack-perl/inc/Module/Install/Base.pm
    trunk/libplack-perl/inc/Module/Install/Can.pm
    trunk/libplack-perl/inc/Module/Install/Fetch.pm
    trunk/libplack-perl/inc/Module/Install/Include.pm
    trunk/libplack-perl/inc/Module/Install/Makefile.pm
    trunk/libplack-perl/inc/Module/Install/Metadata.pm
    trunk/libplack-perl/inc/Module/Install/Scripts.pm
    trunk/libplack-perl/inc/Module/Install/Share.pm
    trunk/libplack-perl/inc/Module/Install/Win32.pm
    trunk/libplack-perl/inc/Module/Install/WriteAll.pm
    trunk/libplack-perl/lib/HTTP/Server/PSGI.pm
    trunk/libplack-perl/lib/Plack.pm
    trunk/libplack-perl/lib/Plack/Builder.pm
    trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm
    trunk/libplack-perl/lib/Plack/Middleware/HTTPExceptions.pm
    trunk/libplack-perl/lib/Plack/Middleware/NullLogger.pm
    trunk/libplack-perl/lib/Plack/Middleware/XSendfile.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/lib/Plack/Util.pm
    trunk/libplack-perl/t/Plack-Middleware/httpexceptions.t

Modified: trunk/libplack-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/Changes?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/Changes (original)
+++ trunk/libplack-perl/Changes Mon Jul  5 20:27:48 2010
@@ -1,6 +1,18 @@
 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.9940  Fri Jul  2 23:37:51 PDT 2010
+        - Fixed META.yml
+
+0.9939  Fri Jul  2 17:56:10 PDT 2010
+        - Improved middleware documentation (miyagawa, leedo, bobtfish)
+        - Added a test about Transfer-Encoding with Content-Length: 0 (chiba)
+        - Fixed NullLogger middleware (haarg)
+        - Fixed Plack::Util inline object's can() (haarg)
+        - Middleware::HTTPException now honors ->location method of the exception (frodwith)
+        - Middleware::AccessLog: Fixes %D to be microsec so it's compatible to Apache #119 (cho45)
+        - Fixed Plack::Request->uri when PATH_INFO conatins URI reserved characters #118 (leedo)
 
 0.9938  Sun May 23 17:13:05 PDT 2010
         - ErrorDocument: Added Content-Length to error responses (hachi)

Modified: trunk/libplack-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/MANIFEST?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/MANIFEST (original)
+++ trunk/libplack-perl/MANIFEST Mon Jul  5 20:27:48 2010
@@ -228,6 +228,7 @@
 t/Plack-Request/parameters.t
 t/Plack-Request/params.t
 t/Plack-Request/path_info.t
+t/Plack-Request/path_info_escaped.t
 t/Plack-Request/readbody.t
 t/Plack-Request/request_uri.t
 t/Plack-Request/upload-basename.t

Modified: trunk/libplack-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/META.yml?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/META.yml (original)
+++ trunk/libplack-perl/META.yml Mon Jul  5 20:27:48 2010
@@ -9,7 +9,7 @@
 configure_requires:
   ExtUtils::MakeMaker: 6.42
 distribution_type: module
-generated_by: 'Module::Install version 0.97'
+generated_by: 'Module::Install version 1.00'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -24,15 +24,12 @@
 requires:
   Devel::StackTrace: 0
   Devel::StackTrace::AsHTML: 0.09
-  ExtUtils::MakeMaker: 6.11
   File::ShareDir: 1.00
   Filesys::Notify::Simple: 0
   HTTP::Body: 1.06
   Hash::MultiValue: 0.05
   LWP: 5.814
   Pod::Usage: 0
-  Test::More: 0.88
-  Test::Requires: 0
   Test::TCP: 0.11
   Try::Tiny: 0
   URI: 1.36
@@ -41,4 +38,4 @@
 resources:
   license: http://dev.perl.org/licenses/
   repository: git://github.com/miyagawa/Plack.git
-version: 0.9938
+version: 0.9940

Modified: trunk/libplack-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/README?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/README (original)
+++ trunk/libplack-perl/README Mon Jul  5 20:27:48 2010
@@ -2,7 +2,7 @@
     Plack - Perl Superglue for Web frameworks and Web Servers (PSGI toolkit)
 
 DESCRIPTION
-    Plack is a set of tools for using PSGI stack. It contains middleware
+    Plack is a set of tools for using the PSGI stack. It contains middleware
     components, a reference server and utilities for Web application
     frameworks. Plack is like Ruby's Rack or Python's Paste for WSGI.
 
@@ -51,7 +51,8 @@
       my $app = sub { MyApp->run_psgi(@_) };
 
     It's important that the return value of ".psgi" file is the code
-    reference. See eg/dot-psgi directory for more examples of ".psgi" files.
+    reference. See "eg/dot-psgi" directory for more examples of ".psgi"
+    files.
 
   plackup, Plack::Runner
     plackup is a command line launcher to run PSGI applications from command
@@ -122,8 +123,8 @@
 
     DO NOT USE Plack:: namespace to build a new web application or a
     framework. It's like naming your application under CGI:: namespace if
-    it's supposed to run on CGI and that is a really bad choice and confuse
-    people.
+    it's supposed to run on CGI and that is a really bad choice and would
+    confuse people badly.
 
 AUTHOR
     Tatsuhiko Miyagawa

Modified: trunk/libplack-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/debian/changelog?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/debian/changelog (original)
+++ trunk/libplack-perl/debian/changelog Mon Jul  5 20:27:48 2010
@@ -1,3 +1,9 @@
+libplack-perl (0.9940-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Mon, 05 Jul 2010 22:26:28 +0200
+
 libplack-perl (0.9938-1) unstable; urgency=low
 
   * New upstream release.

Modified: trunk/libplack-perl/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install.pm (original)
+++ trunk/libplack-perl/inc/Module/Install.pm Mon Jul  5 20:27:48 2010
@@ -22,7 +22,6 @@
 use Cwd        ();
 use File::Find ();
 use File::Path ();
-use FindBin;
 
 use vars qw{$VERSION $MAIN};
 BEGIN {
@@ -32,7 +31,7 @@
 	# This is not enforced yet, but will be some time in the next few
 	# releases once we can make sure it won't clash with custom
 	# Module::Install extensions.
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 
 	# Storage for the pseudo-singleton
 	$MAIN    = undef;
@@ -231,7 +230,12 @@
 sub new {
 	my ($class, %args) = @_;
 
-	FindBin->again;
+	delete $INC{'FindBin.pm'};
+	{
+		# to suppress the redefine warning
+		local $SIG{__WARN__} = sub {};
+		require FindBin;
+	}
 
 	# ignore the prefix on extension modules built from top level.
 	my $base_path = Cwd::abs_path($FindBin::Bin);

Modified: trunk/libplack-perl/inc/Module/Install/AutoInstall.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/AutoInstall.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/AutoInstall.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/AutoInstall.pm Mon Jul  5 20:27:48 2010
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -48,6 +48,14 @@
     while (my ($mod, $ver) = splice(@requires, 0, 2)) {
         $seen{$mod}{$ver}++;
     }
+    my @build_requires = map @$_, map @$_, grep ref, $self->build_requires;
+    while (my ($mod, $ver) = splice(@build_requires, 0, 2)) {
+        $seen{$mod}{$ver}++;
+    }
+    my @configure_requires = map @$_, map @$_, grep ref, $self->configure_requires;
+    while (my ($mod, $ver) = splice(@configure_requires, 0, 2)) {
+        $seen{$mod}{$ver}++;
+    }
 
     my @deduped;
     while (my ($mod, $ver) = splice(@features_require, 0, 2)) {

Modified: trunk/libplack-perl/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Base.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Base.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Base.pm Mon Jul  5 20:27:48 2010
@@ -4,7 +4,7 @@
 use strict 'vars';
 use vars qw{$VERSION};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 }
 
 # Suspend handler for "redefined" warnings

Modified: trunk/libplack-perl/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Can.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Can.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Can.pm Mon Jul  5 20:27:48 2010
@@ -9,7 +9,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libplack-perl/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Fetch.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Fetch.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Fetch.pm Mon Jul  5 20:27:48 2010
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libplack-perl/inc/Module/Install/Include.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Include.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Include.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Include.pm Mon Jul  5 20:27:48 2010
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libplack-perl/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Makefile.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Makefile.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Makefile.pm Mon Jul  5 20:27:48 2010
@@ -4,10 +4,11 @@
 use strict 'vars';
 use ExtUtils::MakeMaker   ();
 use Module::Install::Base ();
+use Fcntl qw/:flock :seek/;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -364,9 +365,9 @@
 		. ($self->postamble || '');
 
 	local *MAKEFILE;
-	open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+	open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+	eval { flock MAKEFILE, LOCK_EX };
 	my $makefile = do { local $/; <MAKEFILE> };
-	close MAKEFILE or die $!;
 
 	$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
 	$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
@@ -386,7 +387,8 @@
 	# XXX - This is currently unused; not sure if it breaks other MM-users
 	# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
 
-	open  MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+	seek MAKEFILE, 0, SEEK_SET;
+	truncate MAKEFILE, 0;
 	print MAKEFILE  "$preamble$makefile$postamble" or die $!;
 	close MAKEFILE  or die $!;
 
@@ -410,4 +412,4 @@
 
 __END__
 
-#line 539
+#line 541

Modified: trunk/libplack-perl/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Metadata.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Metadata.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Metadata.pm Mon Jul  5 20:27:48 2010
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }
@@ -616,8 +616,15 @@
 	return $v;
 }
 
-
-
+sub add_metadata {
+    my $self = shift;
+    my %hash = @_;
+    for my $key (keys %hash) {
+        warn "add_metadata: $key is not prefixed with 'x_'.\n" .
+             "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/;
+        $self->{values}->{$key} = $hash{$key};
+    }
+}
 
 
 ######################################################################

Modified: trunk/libplack-perl/inc/Module/Install/Scripts.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Scripts.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Scripts.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Scripts.pm Mon Jul  5 20:27:48 2010
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libplack-perl/inc/Module/Install/Share.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Share.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Share.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Share.pm Mon Jul  5 20:27:48 2010
@@ -8,7 +8,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libplack-perl/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/Win32.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/Win32.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/Win32.pm Mon Jul  5 20:27:48 2010
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';
+	$VERSION = '1.00';
 	@ISA     = 'Module::Install::Base';
 	$ISCORE  = 1;
 }

Modified: trunk/libplack-perl/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/inc/Module/Install/WriteAll.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/inc/Module/Install/WriteAll.pm (original)
+++ trunk/libplack-perl/inc/Module/Install/WriteAll.pm Mon Jul  5 20:27:48 2010
@@ -6,7 +6,7 @@
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-	$VERSION = '0.97';;
+	$VERSION = '1.00';
 	@ISA     = qw{Module::Install::Base};
 	$ISCORE  = 1;
 }

Modified: trunk/libplack-perl/lib/HTTP/Server/PSGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/HTTP/Server/PSGI.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/HTTP/Server/PSGI.pm (original)
+++ trunk/libplack-perl/lib/HTTP/Server/PSGI.pm Mon Jul  5 20:27:48 2010
@@ -288,10 +288,11 @@
 HTTP server implementations.
 
 This server should be great for the development and testig, but might
-not be suitable for production.
+not be suitable for a production use.
 
 Some features in HTTP/1.1, notably chunked requests, responses and
-pipeline requests are B<NOT> supported yet.
+pipeline requests are B<NOT> supported. See L<Starman> if you want
+those features.
 
 =head1 PREFORKING
 

Modified: trunk/libplack-perl/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack.pm (original)
+++ trunk/libplack-perl/lib/Plack.pm Mon Jul  5 20:27:48 2010
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9938';
+our $VERSION = '0.9940';
 $VERSION = eval $VERSION;
 
 1;
@@ -15,9 +15,10 @@
 
 =head1 DESCRIPTION
 
-Plack is a set of tools for using PSGI stack. It contains middleware
-components, a reference server and utilities for Web application
-frameworks. Plack is like Ruby's Rack or Python's Paste for WSGI.
+Plack is a set of tools for using the PSGI stack. It contains
+middleware components, a reference server and utilities for Web
+application frameworks. Plack is like Ruby's Rack or Python's Paste
+for WSGI.
 
 See L<PSGI> for the PSGI specification and L<PSGI::FAQ> to know what
 PSGI and Plack are and why we need them.
@@ -74,7 +75,7 @@
   my $app = sub { MyApp->run_psgi(@_) };
 
 It's important that the return value of C<.psgi> file is the code
-reference. See eg/dot-psgi directory for more examples of C<.psgi>
+reference. See C<eg/dot-psgi> directory for more examples of C<.psgi>
 files.
 
 =head2 plackup, Plack::Runner
@@ -158,7 +159,7 @@
 B<DO NOT USE> Plack:: namespace to build a new web application or a
 framework. It's like naming your application under CGI:: namespace if
 it's supposed to run on CGI and that is a really bad choice and
-confuse people.
+would confuse people badly.
 
 =head1 AUTHOR
 

Modified: trunk/libplack-perl/lib/Plack/Builder.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Builder.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Builder.pm (original)
+++ trunk/libplack-perl/lib/Plack/Builder.pm Mon Jul  5 20:27:48 2010
@@ -151,20 +151,30 @@
 
 In other words, you're supposed to C<add> middleware from outer to inner.
 
-Additionally, you can call C<enable> with a coderef, which would take
-C<$app> and returns a another psgi-app which consumes C<$env> in runtime.  So:
+=head1 INLINE MIDDLEWARE
+
+Plack::Builder allows you to code middleware inline using a nested
+code reference.
+
+If the first argument to C<enable> is a code reference, it will be
+passed an C<$app> and is supposed to return another code reference
+which is PSGI application that consumes C<$env> in runtime. So:
+
+  builder {
+      enable sub {
+          my $app = shift;
+          sub { my $env = shift; $app->($env) };
+      };
+      $app;
+  };
+
+is equal to:
 
   my $mw = sub {
       my $app = shift;
-      sub { my $env = shift; $app->($env) };
-  };
-
-  builder {
-      enable $mw;
-      $app;
-  };
-
-is syntactically equal to:
+          sub { my $env = shift; $app->($env) };
+      };
+  };
 
   $app = $mw->($app);
 

Modified: trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm (original)
+++ trunk/libplack-perl/lib/Plack/Middleware/AccessLog.pm Mon Jul  5 20:27:48 2010
@@ -68,7 +68,7 @@
         s => sub { $status },
         b => sub { $opts->{content_length} || $h->get('Content-Length') || "-" },
         T => sub { $opts->{time} ? int($opts->{time}) : "-" },
-        D => sub { $opts->{time} || "-" },
+        D => sub { $opts->{time} ? $opts->{time} * 1000000 : "-" },
     );
 
     my $char_handler = sub {

Modified: trunk/libplack-perl/lib/Plack/Middleware/HTTPExceptions.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Middleware/HTTPExceptions.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Middleware/HTTPExceptions.pm (original)
+++ trunk/libplack-perl/lib/Plack/Middleware/HTTPExceptions.pm Mon Jul  5 20:27:48 2010
@@ -54,9 +54,18 @@
         die $e; # rethrow
     }
 
+    my @headers = (
+         'Content-Type'   => 'text/plain',
+         'Content-Length' => length($message),
+    );
+
+    if ($code =~ /^3/ && (my $loc = eval { $e->location })) {
+        push(@headers, Location => $loc);
+    }
+
     $message ||= HTTP::Status::status_message($code);
 
-    return [ $code, [ 'Content-Type' => 'text/plain', 'Content-Length' => length($message) ], [ $message ] ];
+    return [ $code, \@headers, [ $message ] ];
 }
 
 1;
@@ -97,6 +106,10 @@
 the status message of error codes, such as I<Service Unavailable> for
 C<503>.
 
+If the code is in the 3xx range and the exception implements the 'location'
+method (HTTP::Exception::3xx does), the Location header will be set in the
+response, so you can do redirects this way.
+
 There's a CPAN module L<HTTP::Exception> and they are pefect to throw
 from your application to let this middleware catch and display, but
 you can also implement your own exception class to throw.

Modified: trunk/libplack-perl/lib/Plack/Middleware/NullLogger.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Middleware/NullLogger.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Middleware/NullLogger.pm (original)
+++ trunk/libplack-perl/lib/Plack/Middleware/NullLogger.pm Mon Jul  5 20:27:48 2010
@@ -1,5 +1,6 @@
 package Plack::Middleware::NullLogger;
 use strict;
+use parent qw/Plack::Middleware/;
 
 sub call {
     my($self, $env) = @_;

Modified: trunk/libplack-perl/lib/Plack/Middleware/XSendfile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Middleware/XSendfile.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Middleware/XSendfile.pm (original)
+++ trunk/libplack-perl/lib/Plack/Middleware/XSendfile.pm Mon Jul  5 20:27:48 2010
@@ -73,7 +73,7 @@
 You should use L<IO::File::WithPath> or L<Plack::Util>'s
 C<set_io_path> to add C<path> method to an IO object in the body.
 
-See L<http://github.com/rtomayko/rack-contrib/blob/master/lib/rack/sendfile.rb>
+See L<http://github.com/rack/rack-contrib/blob/master/lib/rack/contrib/sendfile.rb>
 for the frontend configuration.
 
 =head1 AUTHOR

Modified: trunk/libplack-perl/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Request.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Request.pm (original)
+++ trunk/libplack-perl/lib/Plack/Request.pm Mon Jul  5 20:27:48 2010
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 use 5.008_001;
-our $VERSION = '0.9938';
+our $VERSION = '0.9940';
 $VERSION = eval $VERSION;
 
 use HTTP::Headers;
@@ -208,7 +208,16 @@
 
     my $base = $self->_uri_base;
 
-    my $path = $self->env->{PATH_INFO} || '';
+    # We have to escape back PATH_INFO in case they include stuff like
+    # ? or # so that the URI parser won't be tricked. However we should
+    # preserve '/' since encoding them into %2f doesn't make sense.
+    # This means when a request like /foo%2fbar comes in, we recognize
+    # it as /foo/bar which is not ideal, but that's how the PSGI PATH_INFO
+    # spec goes and we can't do anything about it. See PSGI::FAQ for details.
+    # http://github.com/miyagawa/Plack/issues#issue/118
+    my $path_escape_class = '^A-Za-z0-9\-\._~/';
+
+    my $path = URI::Escape::uri_escape($self->env->{PATH_INFO} || '', $path_escape_class);
     $path .= '?' . $self->env->{QUERY_STRING}
         if defined $self->env->{QUERY_STRING} && $self->env->{QUERY_STRING} ne '';
 
@@ -382,7 +391,7 @@
 
 Returns the remote host (C<REMOTE_HOST>) of the client. It may be
 empty, in which case you have to get the IP address using C<address>
-method and resolve by your own.
+method and resolve on your own.
 
 =item method
 
@@ -455,7 +464,7 @@
 =item body_parameters
 
 Returns a reference to a hash containing posted parameters in the
-request body (POST). Similarly to C<query_parameters>, the hash
+request body (POST). As with C<query_parameters>, the hash
 reference is a L<Hash::MultiValue> object.
 
 =item parameters
@@ -494,7 +503,7 @@
 =item uploads
 
 Returns a reference to a hash containing uploads. The hash reference
-is L<Hash::MultiValue> object and values are L<Plack::Request::Upload>
+is a L<Hash::MultiValue> object and values are L<Plack::Request::Upload>
 objects.
 
 =item content_encoding
@@ -556,24 +565,24 @@
 
 =head2 Hash::MultiValue parameters
 
-Parameters that can take one or multiple values i.e. C<parameters>,
-C<query_parameters>, C<body_parameters> and C<uploads> store those
+Parameters that can take one or multiple values (i.e. C<parameters>,
+C<query_parameters>, C<body_parameters> and C<uploads>) store the
 hash reference as a L<Hash::MultiValue> object. This means you can use
 the hash reference as a plain hash where values are B<always> scalars
-(B<NOT> array reference), so you don't need to code ugly and unsafe
+(B<NOT> array references), so you don't need to code ugly and unsafe
 C<< ref ... eq 'ARRAY' >> anymore.
 
 And if you explicitly want to get multiple values of the same key, you
-can call the method on it, such as:
+can call the C<get_all> method on it, such as:
 
   my @foo = $req->query_parameters->get_all('foo');
 
 You can also call C<get_one> to always get one parameter independent
-of the context (unlike C<param>), and eve call C<mixed> (with
+of the context (unlike C<param>), and even call C<mixed> (with
 Hash::MultiValue 0.05 or later) to get the I<traditional> hash
 reference,
 
-  my $params = $req->prameters->mixed;
+  my $params = $req->parameters->mixed;
 
 where values are either a scalar or an array reference depending on
 input, so it might be useful if you already have the code to deal with
@@ -594,16 +603,16 @@
 based on request paths, be sure to use C<< $req->path_info >> not C<<
 $req->uri->path >>.
 
-It is because C<path_info> gives you the virtual path of the request,
+This is because C<path_info> gives you the virtual path of the request,
 regardless of how your application is mounted. If your application is
 hosted with mod_perl or CGI scripts, or even multiplexed with tools
 like L<Plack::App::URLMap>, request's C<path_info> always gives you
 the action path.
 
 Note that C<path_info> might give you an empty string, in which case
-you should assume just like C</>.
-
-You will also like to use C<< $req->base >> as a base prefix when
+you should assume that the path is C</>.
+
+You will also want to use C<< $req->base >> as a base prefix when
 building URLs in your templates or in redirections. It's a good idea
 for you to subclass Plack::Request and define methods such as:
 

Modified: trunk/libplack-perl/lib/Plack/Response.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Response.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Response.pm (original)
+++ trunk/libplack-perl/lib/Plack/Response.pm Mon Jul  5 20:27:48 2010
@@ -1,7 +1,7 @@
 package Plack::Response;
 use strict;
 use warnings;
-our $VERSION = '0.9938';
+our $VERSION = '0.9940';
 $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=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm (original)
+++ trunk/libplack-perl/lib/Plack/Server/ServerSimple.pm Mon Jul  5 20:27:48 2010
@@ -1,6 +1,6 @@
 package Plack::Server::ServerSimple;
 use strict;
-our $VERSION = '0.9938';
+our $VERSION = '0.9940';
 $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=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Test/Suite.pm (original)
+++ trunk/libplack-perl/lib/Plack/Test/Suite.pm Mon Jul  5 20:27:48 2010
@@ -614,6 +614,24 @@
             return [ 200, [ "Content-Type", "text/plain" ], [ "OK" ] ];
         },
     ],
+    [
+        'Content-Length => 0 is not set Transfer-Encoding # regression test',
+        sub {
+            my $cb = shift;
+            my $res = $cb->(GET "http://127.0.0.1/");
+            is $res->code, 200;
+            is $res->header('Client-Transfer-Encoding'), undef;
+            is $res->content, '';
+        },
+        sub {
+            my $env = shift;
+            return [
+                200,
+                [ 'Content-Length' => '0' ],
+                ['' ],
+            ];
+        },
+    ],
 );
 
 sub runtests {

Modified: trunk/libplack-perl/lib/Plack/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/lib/Plack/Util.pm?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/lib/Plack/Util.pm (original)
+++ trunk/libplack-perl/lib/Plack/Util.pm Mon Jul  5 20:27:48 2010
@@ -240,7 +240,7 @@
 
 our $AUTOLOAD;
 sub can {
-    exists $_[0]->{$_[1]};
+    $_[0]->{$_[1]};
 }
 
 sub AUTOLOAD {

Modified: trunk/libplack-perl/t/Plack-Middleware/httpexceptions.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libplack-perl/t/Plack-Middleware/httpexceptions.t?rev=60095&op=diff
==============================================================================
--- trunk/libplack-perl/t/Plack-Middleware/httpexceptions.t (original)
+++ trunk/libplack-perl/t/Plack-Middleware/httpexceptions.t Mon Jul  5 20:27:48 2010
@@ -19,12 +19,20 @@
 sub code { 403 }
 sub as_string { "blah blah blah" }
 
+package HTTP::Error::Redirect;
+use base qw(HTTP::Error);
+sub code { 302 }
+sub location { "http://somewhere/else" }
+
 package main;
 
 my $app = sub {
     my $env = shift;
     if ($env->{PATH_INFO} eq '/secret') {
         HTTP::Error::Forbidden->throw;
+    }
+    if ($env->{PATH_INFO} eq '/redirect') {
+        HTTP::Error::Redirect->throw;
     }
     HTTP::Error::InternalServerError->throw;
 };
@@ -42,6 +50,10 @@
     $res = $cb->(GET "/secret");
     is $res->code, 403;
     is $res->content, 'blah blah blah';
+
+    $res = $cb->(GET '/redirect');
+    is $res->code, 302;
+    is $res->header('Location'), 'http://somewhere/else';
 };
 
 done_testing;




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