diff options
author | Eric Wong <e@yhbt.net> | 2020-03-21 02:03:46 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-03-25 01:48:35 +0000 |
commit | 433f6127f648e83b8f12d7b232ff726a34a85beb (patch) | |
tree | 94bbc927430a8b7d7db1e15b27324d6a7c994927 /lib/PublicInbox/ViewVCS.pm | |
parent | 09bc262dd3b4e497cad0c0e814ff3b6664bc8444 (diff) | |
download | public-inbox-433f6127f648e83b8f12d7b232ff726a34a85beb.tar.gz |
wwwstream: introduce oneshot API to avoid ->getline
The ->getline API is only useful for limiting memory use when streaming responses containing multiple emails or log messages. However it's unnecessary complexity and overhead for callers (PublicInbox::HTTP) when there's only a single message.
Diffstat (limited to 'lib/PublicInbox/ViewVCS.pm')
-rw-r--r-- | lib/PublicInbox/ViewVCS.pm | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/PublicInbox/ViewVCS.pm b/lib/PublicInbox/ViewVCS.pm index 2f8e1c4f..6714e67c 100644 --- a/lib/PublicInbox/ViewVCS.pm +++ b/lib/PublicInbox/ViewVCS.pm @@ -31,17 +31,11 @@ my %QP_MAP = ( A => 'oid_a', B => 'oid_b', a => 'path_a', b => 'path_b' ); our $MAX_SIZE = 1024 * 1024; # TODO: configurable my $BIN_DETECT = 8000; # same as git -sub html_i { # WwwStream::getline callback - my ($nr, $ctx) = @_; - $nr == 1 ? ${delete $ctx->{obuf}} : undef; -} - sub html_page ($$$) { my ($ctx, $code, $strref) = @_; my $wcb = delete $ctx->{-wcb}; $ctx->{-upfx} = '../../'; # from "/$INBOX/$OID/s/" - $ctx->{obuf} = $strref; - my $res = PublicInbox::WwwStream->response($ctx, $code, \&html_i); + my $res = PublicInbox::WwwStream::oneshot($ctx, $code, $strref); $wcb ? $wcb->($res) : $res; } |