From: Eric Wong Date: Wed, 6 Apr 2016 03:14:40 +0000 (+0000) Subject: repobrowse: reduce checks for response fh X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7bfc3ca1af27bccc21a43051f756a97da4f2043;p=thirdparty%2Fpublic-inbox.git repobrowse: reduce checks for response fh We should die horribly if fh is missing in some cases due to a fatal bug, do not bug from us and risk losing output data. --- diff --git a/lib/PublicInbox/RepobrowseGitDiff.pm b/lib/PublicInbox/RepobrowseGitDiff.pm index fb44c7526..02a2c5621 100644 --- a/lib/PublicInbox/RepobrowseGitDiff.pm +++ b/lib/PublicInbox/RepobrowseGitDiff.pm @@ -78,9 +78,7 @@ sub call_git_diff { utf8_html("git diff-tree -r -M -B -D ". "$id2 $id --$ex"). "\n\n"); } - if (my $fh = $req->{fh}) { - git_diff_to_html($req, $fh); - } + git_diff_to_html($req); }; if (my $async = $env->{'pi-httpd.async'}) { $req->{rpipe} = $async->($req->{rpipe}, $cb); @@ -112,7 +110,8 @@ sub git_diff_line_i { } sub git_diff_to_html { - my ($req, $fh) = @_; + my ($req) = @_; + my $fh = $req->{fh}; if (!$req->{diff_state}) { my ($stat, $buf) = split(/\0\0/, $req->{dbuf}, 2); return unless defined $buf; diff --git a/lib/PublicInbox/RepobrowseGitPatch.pm b/lib/PublicInbox/RepobrowseGitPatch.pm index a6c5aad89..b8a44e512 100644 --- a/lib/PublicInbox/RepobrowseGitPatch.pm +++ b/lib/PublicInbox/RepobrowseGitPatch.pm @@ -61,7 +61,7 @@ sub call_git_patch { $fh = $res->([200, $h]); $res = undef; } - $fh->write($buf) if $fh; + $fh->write($buf); }; if (my $async = $env->{'pi-httpd.async'}) { diff --git a/lib/PublicInbox/RepobrowseGitSnapshot.pm b/lib/PublicInbox/RepobrowseGitSnapshot.pm index 106d5651e..8bd4b0a57 100644 --- a/lib/PublicInbox/RepobrowseGitSnapshot.pm +++ b/lib/PublicInbox/RepobrowseGitSnapshot.pm @@ -112,8 +112,7 @@ sub call_git_snapshot ($$) { # invoked by PublicInbox::RepobrowseBase::call 'ETag', qq("$tree") ]; $req->{fh} = $res->([200, $h]); } - my $fh = $req->{fh} or return; - $fh->write($buf); + $req->{fh}->write($buf); }; if (my $async = $env->{'pi-httpd.async'}) { $req->{rpipe} = $async->($req->{rpipe}, $cb);