Browse files

support psgix.harakiri

  • Loading branch information...
1 parent c94e53b commit 4ca60a3e731688eba6b61e36375f7df1451724dd @miyagawa committed Jun 22, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/Fastpass/Server.pm
View
16 lib/Fastpass/Server.pm
@@ -178,6 +178,7 @@ sub handle_request {
'psgi.streaming' => 1,
'psgi.nonblocking' => 0,
'psgix.input.buffered' => 1,
+ 'psgix.harakiri' => 1,
};
delete $env->{HTTP_CONTENT_TYPE};
@@ -194,6 +195,11 @@ sub handle_request {
} else {
die "Bad response $res";
}
+
+ if ($env->{'psgix.harakiri.commit'}) {
+ $self->{client}{keep_conn} = 0;
+ $self->{client}{harakiri} = 1;
+ }
}
sub _handle_response {
@@ -228,6 +234,16 @@ sub _handle_response {
}
}
+sub post_client_connection_hook {
+ my $self = shift;
+
+ if ($self->{client}{harakiri}) {
+ warn "Committing harakiri ($$)\n" if DEBUG;
+ exit(0);
+ }
+}
+
+
1;
__END__

0 comments on commit 4ca60a3

Please sign in to comment.