Permalink
Browse files

optimization (do not reopen fake input for every request), copied fro…

…m Starman
  • Loading branch information...
1 parent ce260a8 commit 29eb1e8d0f0fb8b83621088ec011c25267d3c288 kazuho committed Aug 16, 2010
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/Starlet/Server.pm
View
@@ -20,6 +20,8 @@ use Time::HiRes qw(time);
use constant MAX_REQUEST_SIZE => 131072;
use constant MSWin32 => $^O eq 'MSWin32';
+my $null_io = do { open my $io, "<", \""; $io };
+
sub new {
my($class, %args) = @_;
@@ -168,8 +170,7 @@ sub handle_connection {
}
$env->{'psgi.input'} = $buffer->rewind;
} else {
- open my $input, "<", \$buf;
- $env->{'psgi.input'} = $input;
+ $env->{'psgi.input'} = $null_io;
}
$res = Plack::Util::run_app $app, $env;

0 comments on commit 29eb1e8

Please sign in to comment.