]> Sergey Matveev's repositories - public-inbox.git/commitdiff
http: error check for sysseek on input
authorEric Wong <e@80x24.org>
Mon, 29 Feb 2016 00:11:23 +0000 (00:11 +0000)
committerEric Wong <e@80x24.org>
Mon, 29 Feb 2016 00:27:41 +0000 (00:27 +0000)
Just in case we screwed up somewhere, we need to match up
syswrite to sysseek and we also favor procedural calls for
native types.

lib/PublicInbox/HTTP.pm

index 928c0f22469ca8bd73b74646b3d40d789ad587bf..4d771f2bfcdcee160c17e2743e85c58a96a04c2e 100644 (file)
@@ -109,7 +109,7 @@ sub app_dispatch ($) {
                $host =~ s/:(\d+)\z// and $env->{SERVER_PORT} = $1;
                $env->{SERVER_NAME} = $host;
        }
-       $env->{'psgi.input'}->seek(0, SEEK_SET);
+       sysseek($env->{'psgi.input'}, 0, SEEK_SET) or die "input seek failed: $!";
        my $res = Plack::Util::run_app($self->{httpd}->{app}, $env);
        eval {
                if (ref($res) eq 'CODE') {
@@ -204,7 +204,7 @@ sub event_write {
        if ($self->{rbuf} eq '') {
                $self->watch_read(1);
        } else {
-               # avoid recursion
+               # avoid recursion for pipelined requests
                Danga::Socket->AddTimer(0, sub { rbuf_process($self) });
        }
 }