From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 120881F4B9; Sat, 25 Jan 2020 19:34:15 +0000 (UTC) Date: Sat, 25 Jan 2020 19:34:13 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Re: [PATCH 4/4] wwwstatic: wire up buffer bypass for -httpd Message-ID: <20200125193413.GA45625@dcvr> References: <20200124094352.19437-1-e@yhbt.net> <20200124094352.19437-5-e@yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200124094352.19437-5-e@yhbt.net> List-Id: Eric Wong wrote: > diff --git a/lib/PublicInbox/WwwStatic.pm b/lib/PublicInbox/WwwStatic.pm > index e1f536f3..174f4752 100644 > --- a/lib/PublicInbox/WwwStatic.pm > +++ b/lib/PublicInbox/WwwStatic.pm > @@ -51,7 +51,24 @@ sub r ($;$) { > [ $msg ] ] > } > > -sub prepare_range { > +sub getline_response ($$$$$) { > + my ($env, $in, $off, $len, $path) = @_; > + my $r = bless {}, __PACKAGE__; > + if ($env->{'pi-httpd.async'}) { # public-inbox-httpd-only mode > + $env->{'psgix.no-compress'} = 1; # do not chunk response > + %$r = ( bypass => [$in, $off, $len, $env->{'psgix.io'}] ); > + } else { > + %$r = ( in => $in, off => $off, len => $len, path => $path ); > + } > + $r; > +} > + > +sub getline_generic ($$$$) { > + my ($in, $off, $len, $p) = @_; > + bless { in => $in, off => $off, len => $len, path => $p }, __PACKAGE__; > +} Oops, getline_generic isn't used anywhere, since I inlined it into getline_response. Going to squash the following in: diff --git a/lib/PublicInbox/WwwStatic.pm b/lib/PublicInbox/WwwStatic.pm index d75c0076..60a71d8d 100644 --- a/lib/PublicInbox/WwwStatic.pm +++ b/lib/PublicInbox/WwwStatic.pm @@ -63,11 +63,6 @@ sub getline_response ($$$$$) { $r; } -sub getline_generic ($$$$) { - my ($in, $off, $len, $p) = @_; - bless { in => $in, off => $off, len => $len, path => $p }, __PACKAGE__; -} - sub setup_range { my ($env, $in, $h, $beg, $end, $size) = @_; my $code = 200;