r60093 - in /branches/upstream/libplack-perl/current: ./ 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:25:43 UTC 2010
Author: gregoa
Date: Mon Jul 5 20:25:26 2010
New Revision: 60093
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=60093
Log:
[svn-upgrade] new version libplack-perl (0.9940)
Added:
branches/upstream/libplack-perl/current/t/Plack-Request/path_info_escaped.t
Modified:
branches/upstream/libplack-perl/current/Changes
branches/upstream/libplack-perl/current/MANIFEST
branches/upstream/libplack-perl/current/META.yml
branches/upstream/libplack-perl/current/README
branches/upstream/libplack-perl/current/inc/Module/Install.pm
branches/upstream/libplack-perl/current/inc/Module/Install/AutoInstall.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Base.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Can.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Fetch.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Include.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Makefile.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Metadata.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Scripts.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Share.pm
branches/upstream/libplack-perl/current/inc/Module/Install/Win32.pm
branches/upstream/libplack-perl/current/inc/Module/Install/WriteAll.pm
branches/upstream/libplack-perl/current/lib/HTTP/Server/PSGI.pm
branches/upstream/libplack-perl/current/lib/Plack.pm
branches/upstream/libplack-perl/current/lib/Plack/Builder.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/HTTPExceptions.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/NullLogger.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/XSendfile.pm
branches/upstream/libplack-perl/current/lib/Plack/Request.pm
branches/upstream/libplack-perl/current/lib/Plack/Response.pm
branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm
branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm
branches/upstream/libplack-perl/current/lib/Plack/Util.pm
branches/upstream/libplack-perl/current/t/Plack-Middleware/httpexceptions.t
Modified: branches/upstream/libplack-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/Changes?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/Changes (original)
+++ branches/upstream/libplack-perl/current/Changes Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/MANIFEST?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/MANIFEST (original)
+++ branches/upstream/libplack-perl/current/MANIFEST Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/META.yml?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/META.yml (original)
+++ branches/upstream/libplack-perl/current/META.yml Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/README?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/README (original)
+++ branches/upstream/libplack-perl/current/README Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/AutoInstall.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/AutoInstall.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/AutoInstall.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/AutoInstall.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Base.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Base.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Base.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Can.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Can.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Can.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Fetch.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Fetch.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Fetch.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Include.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Include.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Include.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Include.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Makefile.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Makefile.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Makefile.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Metadata.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Metadata.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Metadata.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Scripts.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Scripts.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Scripts.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Scripts.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Share.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Share.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Share.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Share.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/Win32.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/Win32.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/Win32.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/inc/Module/Install/WriteAll.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/inc/Module/Install/WriteAll.pm (original)
+++ branches/upstream/libplack-perl/current/inc/Module/Install/WriteAll.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/HTTP/Server/PSGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/HTTP/Server/PSGI.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/HTTP/Server/PSGI.pm (original)
+++ branches/upstream/libplack-perl/current/lib/HTTP/Server/PSGI.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Builder.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Builder.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Builder.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Builder.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Middleware/HTTPExceptions.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/HTTPExceptions.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/HTTPExceptions.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/HTTPExceptions.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Middleware/NullLogger.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/NullLogger.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/NullLogger.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/NullLogger.pm Mon Jul 5 20:25:26 2010
@@ -1,5 +1,6 @@
package Plack::Middleware::NullLogger;
use strict;
+use parent qw/Plack::Middleware/;
sub call {
my($self, $env) = @_;
Modified: branches/upstream/libplack-perl/current/lib/Plack/Middleware/XSendfile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/XSendfile.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/XSendfile.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/XSendfile.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Request.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Request.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Request.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Response.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Response.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Response.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Response.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Test/Suite.pm Mon Jul 5 20:25:26 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: branches/upstream/libplack-perl/current/lib/Plack/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Util.pm?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Util.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Util.pm Mon Jul 5 20:25:26 2010
@@ -240,7 +240,7 @@
our $AUTOLOAD;
sub can {
- exists $_[0]->{$_[1]};
+ $_[0]->{$_[1]};
}
sub AUTOLOAD {
Modified: branches/upstream/libplack-perl/current/t/Plack-Middleware/httpexceptions.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Middleware/httpexceptions.t?rev=60093&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Middleware/httpexceptions.t (original)
+++ branches/upstream/libplack-perl/current/t/Plack-Middleware/httpexceptions.t Mon Jul 5 20:25:26 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;
Added: branches/upstream/libplack-perl/current/t/Plack-Request/path_info_escaped.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Request/path_info_escaped.t?rev=60093&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Request/path_info_escaped.t (added)
+++ branches/upstream/libplack-perl/current/t/Plack-Request/path_info_escaped.t Mon Jul 5 20:25:26 2010
@@ -1,0 +1,30 @@
+use strict;
+use Test::More;
+use Plack::Test;
+use Plack::Request;
+use HTTP::Request::Common;
+use Data::Dumper;
+
+my $path_app = sub {
+ my $req = Plack::Request->new(shift);
+ my $res = $req->new_response(200);
+ $res->content_type('text/plain');
+ $res->content('my ' . Dumper([ $req->uri, $req->parameters ]));
+ return $res->finalize;
+};
+
+test_psgi $path_app, sub {
+ my $cb = shift;
+
+ my $res = $cb->(GET "http://localhost/foo.bar-baz?a=b");
+ is_deeply eval($res->content), [ URI->new("http://localhost/foo.bar-baz?a=b"), { a => 'b' } ];
+
+ $res = $cb->(GET "http://localhost/foo%2fbar#ab");
+ is_deeply eval($res->content), [ URI->new("http://localhost/foo/bar"), {} ],
+ "%2f vs / can't be distinguished - that's alright";
+
+ $res = $cb->(GET "http://localhost/%23foo?a=b");
+ is_deeply eval($res->content), [ URI->new("http://localhost/%23foo?a=b"), { a => 'b' } ];
+};
+
+done_testing;
More information about the Pkg-perl-cvs-commits
mailing list