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->{rv}} : undef;
+}
+
sub html_page ($$$) {
my ($ctx, $code, $strref) = @_;
my $wcb = delete $ctx->{-wcb};
$ctx->{-upfx} = '../../'; # from "/$INBOX/$OID/s/"
- my $res = PublicInbox::WwwStream->response($ctx, $code, sub {
- my ($nr, undef) = @_;
- $nr == 1 ? $$strref : undef;
- });
+ $ctx->{rv} = $strref;
+ my $res = PublicInbox::WwwStream->response($ctx, $code, \&html_i);
$wcb ? $wcb->($res) : $res;
}