r76359 - in /branches/upstream/starman/current: Changes MANIFEST META.yml bin/starman lib/Starman.pm lib/Starman/Server.pm t/harakiri.t
ghedo-guest at users.alioth.debian.org
ghedo-guest at users.alioth.debian.org
Thu Jun 23 14:02:11 UTC 2011
Author: ghedo-guest
Date: Thu Jun 23 14:02:01 2011
New Revision: 76359
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76359
Log:
[svn-upgrade] new version starman (0.2012)
Added:
branches/upstream/starman/current/t/harakiri.t
Modified:
branches/upstream/starman/current/Changes
branches/upstream/starman/current/MANIFEST
branches/upstream/starman/current/META.yml
branches/upstream/starman/current/bin/starman
branches/upstream/starman/current/lib/Starman.pm
branches/upstream/starman/current/lib/Starman/Server.pm
Modified: branches/upstream/starman/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/starman/current/Changes?rev=76359&op=diff
==============================================================================
--- branches/upstream/starman/current/Changes (original)
+++ branches/upstream/starman/current/Changes Thu Jun 23 14:02:01 2011
@@ -1,4 +1,8 @@
Revision history for Perl extension Starman
+
+0.2012 Wed Jun 22 13:51:59 PDT 2011
+ - Implemented psgix.harakiri mode (audreyt)
+ - Added --error-log option (Paulo E. Castro)
0.2011 Tue May 24 09:41:52 PDT 2011
- Fix chunked response with 0-length PSGI array elements (chmrr)
Modified: branches/upstream/starman/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/starman/current/MANIFEST?rev=76359&op=diff
==============================================================================
--- branches/upstream/starman/current/MANIFEST (original)
+++ branches/upstream/starman/current/MANIFEST Thu Jun 23 14:02:01 2011
@@ -26,6 +26,7 @@
t/chunked_zero_length.t
t/findbin.psgi
t/findbin.t
+t/harakiri.t
t/rand.psgi
t/rand.t
t/suite.t
Modified: branches/upstream/starman/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/starman/current/META.yml?rev=76359&op=diff
==============================================================================
--- branches/upstream/starman/current/META.yml (original)
+++ branches/upstream/starman/current/META.yml Thu Jun 23 14:02:01 2011
@@ -36,4 +36,4 @@
resources:
license: http://dev.perl.org/licenses/
repository: git://github.com/miyagawa/Starman.git
-version: 0.2011
+version: 0.2012
Modified: branches/upstream/starman/current/bin/starman
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/starman/current/bin/starman?rev=76359&op=diff
==============================================================================
--- branches/upstream/starman/current/bin/starman (original)
+++ branches/upstream/starman/current/bin/starman Thu Jun 23 14:02:01 2011
@@ -171,6 +171,11 @@
Specify the pid file path. Use it with C<-D|--daemonize> option,
described in C<plackup -h>.
+=item --error-log
+
+Specify the pathname of a file where the error log should be written.
+This enables you to still have access to the errors when using C<--daemonize>.
+
=back
Starman passes through other options given to L<Plack::Runner>, the
Modified: branches/upstream/starman/current/lib/Starman.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/starman/current/lib/Starman.pm?rev=76359&op=diff
==============================================================================
--- branches/upstream/starman/current/lib/Starman.pm (original)
+++ branches/upstream/starman/current/lib/Starman.pm Thu Jun 23 14:02:01 2011
@@ -2,7 +2,7 @@
use strict;
use 5.008_001;
-our $VERSION = '0.2011';
+our $VERSION = '0.2012';
1;
__END__
Modified: branches/upstream/starman/current/lib/Starman/Server.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/starman/current/lib/Starman/Server.pm?rev=76359&op=diff
==============================================================================
--- branches/upstream/starman/current/lib/Starman/Server.pm (original)
+++ branches/upstream/starman/current/lib/Starman/Server.pm Thu Jun 23 14:02:01 2011
@@ -39,6 +39,10 @@
}
if (! exists $options->{keepalive_timeout}) {
$options->{keepalive_timeout} = 1;
+ }
+ # Making it prettier I guess ? We can always get rid of it if we don't mind $options->{'error-log'}
+ if ($options->{'error-log'}) {
+ $options->{error_log} = 1;
}
my($host, $port, $proto);
@@ -64,6 +68,7 @@
proto => $proto,
serialize => 'flock',
log_level => DEBUG ? 4 : 2,
+ ($options->{error_log} ? ( log_file => $options->{error_log} ) : () ),
min_servers => $options->{min_servers} || $workers,
min_spare_servers => $options->{min_spare_servers} || $workers - 1,
max_spare_servers => $options->{max_spare_servers} || $workers - 1,
@@ -156,6 +161,7 @@
'psgi.multiprocess' => Plack::Util::TRUE,
'psgix.io' => $conn,
'psgix.input.buffered' => Plack::Util::TRUE,
+ 'psgix.harakiri' => Plack::Util::TRUE,
};
# Parse headers
@@ -233,7 +239,7 @@
if ( $self->{client}->{inputbuf} ) {
if ( $self->{client}->{inputbuf} =~ /^(?:GET|HEAD)/ ) {
if ( DEBUG ) {
- warn "Pipelined GET/HEAD request in input buffer: "
+ warn "Pipelined GET/HEAD request in input buffer: "
. dump( $self->{client}->{inputbuf} ) . "\n";
}
@@ -395,6 +401,11 @@
sub _finalize_response {
my($self, $env, $res) = @_;
+
+ if ($env->{'psgix.harakiri.commit'}) {
+ $self->{client}->{keepalive} = 0;
+ $self->{client}->{harakiri} = 1;
+ }
my $protocol = $env->{SERVER_PROTOCOL};
my $status = $res->[0];
@@ -480,4 +491,11 @@
}
}
+sub post_client_connection_hook {
+ my $self = shift;
+ if ($self->{client}->{harakiri}) {
+ exit;
+ }
+}
+
1;
Added: branches/upstream/starman/current/t/harakiri.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/starman/current/t/harakiri.t?rev=76359&op=file
==============================================================================
--- branches/upstream/starman/current/t/harakiri.t (added)
+++ branches/upstream/starman/current/t/harakiri.t Thu Jun 23 14:02:01 2011
@@ -1,0 +1,42 @@
+use strict;
+use warnings;
+
+use HTTP::Request::Common;
+use Plack::Test;
+use Test::More;
+
+$Plack::Test::Impl = 'Server';
+$ENV{PLACK_SERVER} = 'Starman';
+
+test_psgi
+ app => sub {
+ my $env = shift;
+ return [ 200, [ 'Content-Type' => 'text/plain' ], [$$] ];
+ },
+ client => sub {
+ my %seen_pid;
+ my $cb = shift;
+ for (1..23) {
+ my $res = $cb->(GET "/");
+ $seen_pid{$res->content}++;
+ }
+ is keys(%seen_pid), 5, 'In non-harakiri mode, pid is reused';
+ };
+
+test_psgi
+ app => sub {
+ my $env = shift;
+ $env->{'psgix.harakiri.commit'} = 1;
+ return [ 200, [ 'Content-Type' => 'text/plain' ], [$$] ];
+ },
+ client => sub {
+ my %seen_pid;
+ my $cb = shift;
+ for (1..23) {
+ my $res = $cb->(GET "/");
+ $seen_pid{$res->content}++;
+ }
+ is keys(%seen_pid), 23, 'In Harakiri mode, each pid only used once';
+ };
+
+done_testing;
More information about the Pkg-perl-cvs-commits
mailing list