r68150 - in /branches/upstream/libplack-perl/current: ./ lib/ lib/HTTP/Message/ lib/Plack/ lib/Plack/App/ lib/Plack/Middleware/ lib/Plack/Server/ t/HTTP-Message-PSGI/ t/Plack-Handler/ t/Plack-Middleware/
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Tue Feb 8 11:58:02 UTC 2011
Author: eloy
Date: Tue Feb 8 11:57:43 2011
New Revision: 68150
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=68150
Log:
[svn-upgrade] new version libplack-perl (0.9967)
Added:
branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/content_length.t
branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/path_info.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/Makefile.PL
branches/upstream/libplack-perl/current/README
branches/upstream/libplack-perl/current/lib/HTTP/Message/PSGI.pm
branches/upstream/libplack-perl/current/lib/Plack.pm
branches/upstream/libplack-perl/current/lib/Plack/App/URLMap.pm
branches/upstream/libplack-perl/current/lib/Plack/Builder.pm
branches/upstream/libplack-perl/current/lib/Plack/Component.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/SimpleLogger.pm
branches/upstream/libplack-perl/current/lib/Plack/Middleware/StackTrace.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/t/Plack-Handler/fcgi.t
branches/upstream/libplack-perl/current/t/Plack-Middleware/access_log.t
branches/upstream/libplack-perl/current/t/Plack-Middleware/stacktrace.t
Modified: branches/upstream/libplack-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/Changes?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/Changes (original)
+++ branches/upstream/libplack-perl/current/Changes Tue Feb 8 11:57:43 2011
@@ -1,6 +1,23 @@
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.9967 Tue Jan 25 14:26:37 PST 2011
+ - Fixed StackTrace to require D::ST::WithLexicals 0.08 that supports 'message' (doy)
+
+0.9966 Tue Jan 25 12:00:25 PST 2011
+ - Fixed a memory leak in SimploLogger (vti)
+ - Support %v in AccessLog (Ranguard)
+ - Force set CONTENT_LENGTH in req_to_psgi when $content is given to HTTP::Request (timbunce) #150
+ - Fixed a case where SCRIPT_NAME and PATH_INFO can both get empty in req_to_psgi (doy) #163
+
+0.9965 Mon Jan 24 23:08:04 PST 2011
+ - Requires Devel::StackTrace 0.11
+ - Fixed a regression where StackTrace wasn't able to get the thrown exception as an error message (hachi)
+
+0.9964 Mon Jan 24 16:29:08 PST 2011
+ - Various documentation improvements (miyagawa, schwern)
+ - Improved the way it eliminates Plack::Middleware::StackTrace from its own stacktrace (Jonathan Swartz)
0.9963 Mon Jan 10 16:46:33 PST 2011
- Fixed fcgi.t for lighttpd < 1.4.23 (confound)
Modified: branches/upstream/libplack-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/MANIFEST?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/MANIFEST (original)
+++ branches/upstream/libplack-perl/current/MANIFEST Tue Feb 8 11:57:43 2011
@@ -137,6 +137,8 @@
share/face.jpg
t/00_compile.t
t/FCGIUtils.pm
+t/HTTP-Message-PSGI/content_length.t
+t/HTTP-Message-PSGI/path_info.t
t/HTTP-Message-PSGI/utf8_req.t
t/HTTP-Server-PSGI/post.t
t/Plack-Builder/mount.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=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/META.yml (original)
+++ branches/upstream/libplack-perl/current/META.yml Tue Feb 8 11:57:43 2011
@@ -23,7 +23,7 @@
- xt
requires:
Devel::StackTrace: 1.23
- Devel::StackTrace::AsHTML: 0.09
+ Devel::StackTrace::AsHTML: 0.11
File::ShareDir: 1.00
Filesys::Notify::Simple: 0
HTTP::Body: 1.06
@@ -36,6 +36,8 @@
parent: 0
perl: 5.8.1
resources:
+ bugtracker: https://github.com/miyagawa/plack/issues
+ homepage: http://plackperl.org
license: http://dev.perl.org/licenses/
repository: git://github.com/miyagawa/Plack.git
-version: 0.9963
+version: 0.9967
Modified: branches/upstream/libplack-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/Makefile.PL?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/Makefile.PL (original)
+++ branches/upstream/libplack-perl/current/Makefile.PL Tue Feb 8 11:57:43 2011
@@ -17,7 +17,7 @@
requires 'parent';
requires 'Devel::StackTrace', 1.23; # Middleware::StackTrace
-requires 'Devel::StackTrace::AsHTML', 0.09; # Middleware::StackTrace
+requires 'Devel::StackTrace::AsHTML', 0.11; # Middleware::StackTrace
requires 'Filesys::Notify::Simple'; # plackup -r
@@ -36,6 +36,11 @@
auto_install;
auto_set_repository;
+
+resources
+ homepage => "http://plackperl.org",
+ bugtracker => "https://github.com/miyagawa/plack/issues";
+
WriteAll;
warn <<RECOMMENDS;
Modified: branches/upstream/libplack-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/README?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/README (original)
+++ branches/upstream/libplack-perl/current/README Tue Feb 8 11:57:43 2011
@@ -171,7 +171,13 @@
Aaron Trevena
SEE ALSO
- PSGI <http://plackperl.org/>
+ The PSGI specification upon which Plack is based.
+
+ <http://plackperl.org/>
+
+ The Plack wiki: <https://github.com/miyagawa/Plack/wiki>
+
+ The Plack FAQ: <https://github.com/miyagawa/Plack/wiki/Faq>
LICENSE
This library is free software; you can redistribute it and/or modify it
Modified: branches/upstream/libplack-perl/current/lib/HTTP/Message/PSGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/HTTP/Message/PSGI.pm?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/HTTP/Message/PSGI.pm (original)
+++ branches/upstream/libplack-perl/current/lib/HTTP/Message/PSGI.pm Tue Feb 8 11:57:43 2011
@@ -44,10 +44,12 @@
}
} else {
open $input, "<", \$content;
+ $req->content_length(length $content)
+ unless defined $req->content_length;
}
my $env = {
- PATH_INFO => URI::Escape::uri_unescape($uri->path),
+ PATH_INFO => URI::Escape::uri_unescape($uri->path || '/'),
QUERY_STRING => $uri->query || '',
SCRIPT_NAME => '',
SERVER_NAME => $uri->host,
@@ -56,7 +58,7 @@
REMOTE_ADDR => '127.0.0.1',
REMOTE_HOST => 'localhost',
REMOTE_PORT => int( rand(64000) + 1000 ), # not in RFC 3875
- REQUEST_URI => $uri->path_query, # not in RFC 3875
+ REQUEST_URI => $uri->path_query || '/', # not in RFC 3875
REQUEST_METHOD => $req->method,
'psgi.version' => [ 1, 1 ],
'psgi.url_scheme' => $uri->scheme eq 'https' ? 'https' : 'http',
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=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack.pm Tue Feb 8 11:57:43 2011
@@ -3,7 +3,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9963';
+our $VERSION = '0.9967';
$VERSION = eval $VERSION;
1;
@@ -211,7 +211,13 @@
=head1 SEE ALSO
-L<PSGI> L<http://plackperl.org/>
+The L<PSGI> specification upon which Plack is based.
+
+L<http://plackperl.org/>
+
+The Plack wiki: L<https://github.com/miyagawa/Plack/wiki>
+
+The Plack FAQ: L<https://github.com/miyagawa/Plack/wiki/Faq>
=head1 LICENSE
Modified: branches/upstream/libplack-perl/current/lib/Plack/App/URLMap.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/App/URLMap.pm?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/App/URLMap.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/App/URLMap.pm Tue Feb 8 11:57:43 2011
@@ -103,8 +103,9 @@
Plack::App::URLMap is a PSGI application that can dispatch multiple
applications based on URL path and hostnames (a.k.a "virtual hosting")
-and takes care of rewriting C<SCRIPT_NAME> and C<PATH_INFO>. This
-module is inspired by Rack::URLMap.
+and takes care of rewriting C<SCRIPT_NAME> and C<PATH_INFO> (See
+L</"HOW THIS WORKS"> for details). This module is inspired by
+Rack::URLMap.
=head1 METHODS
@@ -125,6 +126,10 @@
Mapping URL with host names is also possible, and in that case the URL
mapping works like a virtual host.
+
+Mappings will nest. If $app is already mapped to C</baz> it will
+match a request for C</foo/baz> but not C</foo>. See L</"HOW THIS
+WORKS"> for more details.
=item mount
@@ -147,6 +152,33 @@
this application matches with the incoming request host names and
paths.
+=head1 HOW THIS WORKS
+
+This application works by I<fixing> C<SCRIPT_NAME> and C<PATH_INFO>
+before dispatching the incoming request to the relocated
+applications.
+
+Say you have a Wiki application that takes C</index> and C</page/*>
+and makes a PSGI application C<$wiki_app> out of it, using one of
+supported web frameworks, you can put the whole application under
+C</wiki> by:
+
+ # MyWikiApp looks at PATH_INFO and handles /index and /page/*
+ my $wiki_app = sub { MyWikiApp->run(@_) };
+
+ use Plack::App::URLMap;
+ my $app = Plack::App::URLMap->new;
+ $app->mount("/wiki" => $wiki_app);
+
+When a request comes in with C<PATH_INFO> set to C</wiki/page/foo>,
+the URLMap application C<$app> strips the C</wiki> part from
+C<PATH_INFO> and B<appends> that to C<SCRIPT_NAME>.
+
+That way, if the C<$app> is mounted under the root
+(i.e. C<SCRIPT_NAME> is C<"">) with standalone web servers like
+L<Starman>, C<SCRIPT_NAME> is now locally set to C</wiki> and
+C<PATH_INFO> is changed to C</page/foo> when C<$wiki_app> gets called.
+
=head1 AUTHOR
Tatsuhiko Miyagawa
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=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Builder.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Builder.pm Tue Feb 8 11:57:43 2011
@@ -242,6 +242,33 @@
mount "/" => $app;
}
+Note that the C<builder> DSL returns a whole new PSGI application, which means
+
+=over 4
+
+=item *
+
+C<builder { ... }> should normally the last statement of a C<.psgi>
+file, because the return value of C<builder> is the application that
+actually is executed.
+
+=item *
+
+You can nest your C<builder> block, mixed with C<mount> (see URLMap
+support above):
+
+ builder {
+ mount "/foo" => builder {
+ mount "/bar" => $app;
+ }
+ }
+
+will locate the C<$app> under C</foo/bar> since the inner C<builder>
+block puts it under C</bar> and it results a new PSGI application
+which is located under C</foo> becuase of the outer C<builder> block.
+
+=back
+
=head1 CONDITIONAL MIDDLEWARE SUPPORT
You can use C<enable_if> to conditionally enable middleware based on
Modified: branches/upstream/libplack-perl/current/lib/Plack/Component.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Component.pm?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Component.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Component.pm Tue Feb 8 11:57:43 2011
@@ -81,9 +81,9 @@
=item call ($env)
-You are expected to implement a C<call> method in your component. This is
-where all the work gets done. It receives the PSGI C<$env> hash-ref as an
-argument and is expected to return a proper PSGI response value.
+You are expected to implement a C<call> method in your component. This
+is where all the work gets done. It receives the PSGI C<$env> hash-ref
+as an argument and is expected to return a proper PSGI response value.
=back
@@ -111,6 +111,21 @@
=back
+=head1 OBJECT LIFECYCLE
+
+Objects for the derived classes (Plack::App::* or
+Plack::Middleware::*) are created at the PSGI application compile
+phase using C<new>, C<prepare_app> and C<to_app>, and the created
+object persists during the web server lifecycle, unless it is running
+on the non-persistent environment like CGI. C<call> is invoked against
+the same object whenever a new request comes in.
+
+You can check if it is running in a persistent environment by checking
+C<psgi.run_once> key in the C<$env> being true (non-persistent) or
+false (persistent), but it is best for you to write your middleware
+safe in the persistent environment. To accomplish that, you should
+avoid saving per-request data like C<$env> in your object.
+
=head1 BACKWARDS COMPATIBILITY
The L<Plack::Middleware> module used to inherit from L<Class::Accessor::Fast>,
Modified: branches/upstream/libplack-perl/current/lib/Plack/Middleware.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware.pm?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware.pm Tue Feb 8 11:57:43 2011
@@ -60,11 +60,17 @@
=head1 DESCRIPTION
-Plack::Middleware is an utility base class to write PSGI
+Plack::Middleware is a utility base class to write PSGI
middleware. All you have to do is to inherit from Plack::Middleware
and then implement the callback C<call> method (or C<to_app> method
that would return the PSGI code reference) to do the actual work. You
can use C<< $self->app >> to call the original (wrapped) application.
+
+Your middleware object is created at a PSGI application compile time
+and is persistent during the web server life cycle (unless it is a
+non-persisten environment such as CGI), so you should never set or
+cache per-request data like C<$env> in your middleware object. See
+also L<Plack::Component/"OBJECT LIFECYCLE">.
See L<Plack::Builder> how to actually enable middlewares in your
I<.psgi> application file using the DSL. If you do not like our
@@ -79,6 +85,6 @@
=head1 SEE ALSO
-L<Plack> L<Plack::Builder>
+L<Plack> L<Plack::Builder> L<Plack::Component>
=cut
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=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/AccessLog.pm Tue Feb 8 11:57:43 2011
@@ -58,6 +58,7 @@
}
};
+
my %char_handler = (
'%' => sub { '%' },
h => sub { $env->{REMOTE_ADDR} || '-' },
@@ -70,6 +71,7 @@
b => sub { $opts->{content_length} || $h->get('Content-Length') || "-" },
T => sub { $opts->{time} ? int($opts->{time}) : "-" },
D => sub { $opts->{time} ? $opts->{time} * 1000000 : "-" },
+ v => sub { $env->{SERVER_NAME} || '-' },
);
my $char_handler = sub {
Modified: branches/upstream/libplack-perl/current/lib/Plack/Middleware/SimpleLogger.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/SimpleLogger.pm?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/SimpleLogger.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/SimpleLogger.pm Tue Feb 8 11:57:43 2011
@@ -2,7 +2,8 @@
use strict;
use parent qw(Plack::Middleware);
use Plack::Util::Accessor qw(level);
-use POSIX;
+use POSIX ();
+use Scalar::Util ();
# Should this be in Plack::Util?
my $i = 0;
@@ -13,11 +14,14 @@
my $min = $level_numbers{ $self->level || "debug" };
+ my $env_ref = $env;
+ Scalar::Util::weaken($env_ref);
+
$env->{'psgix.logger'} = sub {
my $args = shift;
if ($level_numbers{$args->{level}} >= $min) {
- $env->{'psgi.errors'}->print($self->format_message($args->{level}, $args->{message}));
+ $env_ref->{'psgi.errors'}->print($self->format_message($args->{level}, $args->{message}));
}
};
Modified: branches/upstream/libplack-perl/current/lib/Plack/Middleware/StackTrace.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/lib/Plack/Middleware/StackTrace.pm?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Middleware/StackTrace.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Middleware/StackTrace.pm Tue Feb 8 11:57:43 2011
@@ -10,7 +10,7 @@
our $StackTraceClass = "Devel::StackTrace";
# Optional since it needs PadWalker
-if (try { require Devel::StackTrace::WithLexicals; 1 }) {
+if (try { require Devel::StackTrace::WithLexicals; Devel::StackTrace::WithLexicals->VERSION(0.08); 1 }) {
$StackTraceClass = "Devel::StackTrace::WithLexicals";
}
@@ -19,7 +19,10 @@
my $trace;
local $SIG{__DIE__} = sub {
- $trace = $StackTraceClass->new(indent => 1, message => $_[0]);
+ $trace = $StackTraceClass->new(
+ indent => 1, message => munge_error($_[0], [ caller ]),
+ ignore_package => __PACKAGE__,
+ );
die @_;
};
@@ -45,6 +48,17 @@
undef $trace;
return $res;
+}
+
+sub munge_error {
+ my($err, $caller) = @_;
+ return $err if ref $err;
+
+ # Ugly hack to remove " at ... line ..." automatically appended by perl
+ # If there's a proper way to do this, please let me know.
+ $err =~ s/ at \Q$caller->[1]\E line $caller->[2]\.\n$//;
+
+ return $err;
}
sub utf8_safe {
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=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Request.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Request.pm Tue Feb 8 11:57:43 2011
@@ -2,7 +2,7 @@
use strict;
use warnings;
use 5.008_001;
-our $VERSION = '0.9963';
+our $VERSION = '0.9967';
$VERSION = eval $VERSION;
use HTTP::Headers;
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=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Response.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Response.pm Tue Feb 8 11:57:43 2011
@@ -1,7 +1,7 @@
package Plack::Response;
use strict;
use warnings;
-our $VERSION = '0.9963';
+our $VERSION = '0.9967';
$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=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm (original)
+++ branches/upstream/libplack-perl/current/lib/Plack/Server/ServerSimple.pm Tue Feb 8 11:57:43 2011
@@ -1,6 +1,6 @@
package Plack::Server::ServerSimple;
use strict;
-our $VERSION = '0.9963';
+our $VERSION = '0.9967';
$VERSION = eval $VERSION;
use parent qw(Plack::Handler::HTTP::Server::Simple);
Added: branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/content_length.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/content_length.t?rev=68150&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/content_length.t (added)
+++ branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/content_length.t Tue Feb 8 11:57:43 2011
@@ -1,0 +1,20 @@
+use strict;
+use warnings;
+use Test::More;
+use HTTP::Message::PSGI qw(req_to_psgi);
+use HTTP::Request;
+
+my $content = "{'foo':'bar'}";
+my $req = HTTP::Request->new(POST => "http://localhost/post", [ "Content-Type", "application/json" ], $content);
+
+my $env = req_to_psgi $req;
+
+is $env->{CONTENT_LENGTH}, 13;
+$env->{"psgi.input"}->read(my $buf, 13);
+
+is $buf, $content;
+
+done_testing;
+
+
+
Added: branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/path_info.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/path_info.t?rev=68150&op=file
==============================================================================
--- branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/path_info.t (added)
+++ branches/upstream/libplack-perl/current/t/HTTP-Message-PSGI/path_info.t Tue Feb 8 11:57:43 2011
@@ -1,0 +1,23 @@
+use strict;
+use Test::More;
+use HTTP::Message::PSGI qw(req_to_psgi);
+use HTTP::Request::Common;
+
+my $env = req_to_psgi GET "http://localhost/foo";
+is $env->{PATH_INFO}, "/foo";
+
+$env = req_to_psgi GET "http://localhost/";
+is $env->{SCRIPT_NAME}, "";
+is $env->{PATH_INFO}, "/";
+
+$env = req_to_psgi GET "http://localhost/0";
+is $env->{SCRIPT_NAME}, "";
+is $env->{PATH_INFO}, "/0";
+
+$env = req_to_psgi GET "http://localhost";
+is $env->{SCRIPT_NAME}, "";
+is $env->{PATH_INFO}, "/";
+is $env->{REQUEST_URI}, "/";
+
+
+done_testing;
Modified: branches/upstream/libplack-perl/current/t/Plack-Handler/fcgi.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Handler/fcgi.t?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Handler/fcgi.t (original)
+++ branches/upstream/libplack-perl/current/t/Plack-Handler/fcgi.t Tue Feb 8 11:57:43 2011
@@ -10,12 +10,12 @@
my $lighty_port;
my $fcgi_port;
-for ('', '/fastcgi') {
- $ENV{PLACK_TEST_SCRIPT_NAME} = $_;
+for my $script_name ('', '/fastcgi') {
+ $ENV{PLACK_TEST_SCRIPT_NAME} = $script_name;
test_lighty_external(
sub {
($lighty_port, $fcgi_port) = (shift, shift);
- my $needs_fix = $_ eq '' ? shift : 0;
+ my $needs_fix = $script_name eq '' ? shift : 0;
Plack::Test::Suite->run_server_tests(run_server_cb($needs_fix), $fcgi_port, $lighty_port);
}
);
Modified: branches/upstream/libplack-perl/current/t/Plack-Middleware/access_log.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Middleware/access_log.t?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Middleware/access_log.t (original)
+++ branches/upstream/libplack-perl/current/t/Plack-Middleware/access_log.t Tue Feb 8 11:57:43 2011
@@ -25,11 +25,11 @@
my $req = GET "http://example.com/";
$req->header("Host" => "example.com", "X-Forwarded-For" => "192.0.2.1");
- my $fmt = "%{Host}i %{X-Forwarded-For}i %{Content-Type}o %{%m %y}t";
+ my $fmt = "%{Host}i %{X-Forwarded-For}i %{Content-Type}o %{%m %y}t %v";
$test->($fmt)->($req);
chomp $log;
my $month_year = POSIX::strftime('%m %y', localtime);
- is $log, "example.com 192.0.2.1 text/plain [$month_year]";
+ is $log, "example.com 192.0.2.1 text/plain [$month_year] example.com";
}
{
Modified: branches/upstream/libplack-perl/current/t/Plack-Middleware/stacktrace.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libplack-perl/current/t/Plack-Middleware/stacktrace.t?rev=68150&op=diff
==============================================================================
--- branches/upstream/libplack-perl/current/t/Plack-Middleware/stacktrace.t (original)
+++ branches/upstream/libplack-perl/current/t/Plack-Middleware/stacktrace.t Tue Feb 8 11:57:43 2011
@@ -22,7 +22,7 @@
ok $res->is_error;
is_deeply [ $res->content_type ], [ 'text/html', 'charset=utf-8' ];
- like $res->content, qr/orz/;
+ like $res->content, qr/<title>Error: orz/;
};
done_testing;
More information about the Pkg-perl-cvs-commits
mailing list