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 DCFE61F4B9; Sat, 25 Jan 2020 19:27:59 +0000 (UTC) Date: Sat, 25 Jan 2020 19:27:59 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Re: [PATCH 4/4] wwwstatic: wire up buffer bypass for -httpd Message-ID: <20200125192759.GA45593@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 > @@ -131,6 +145,7 @@ sub response ($$$;$) { > return r(500); > } > return r(404) unless -f $in; > + binmode $in, ':unix'; # reduce syscalls for read() >8192 bytes > } > my $size = -s _; # bare "_" reuses "struct stat" from "-f" above > my $mtime = time2str((stat(_))[9]); That binmode would also lead to leaks. Will squash to workaround current/old Perls: http://nntp.perl.org/group/perl.perl5.porters/256935 diff --git a/lib/PublicInbox/WwwStatic.pm b/lib/PublicInbox/WwwStatic.pm index 174f4752..d75c0076 100644 --- a/lib/PublicInbox/WwwStatic.pm +++ b/lib/PublicInbox/WwwStatic.pm @@ -145,7 +145,6 @@ sub response ($$$;$) { return r(500); } return r(404) unless -f $in; - binmode $in, ':unix'; # reduce syscalls for read() >8192 bytes } my $size = -s _; # bare "_" reuses "struct stat" from "-f" above my $mtime = time2str((stat(_))[9]);