From b9b12ac92230cc6807623293b93cc22e5eb33684 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 3 Mar 2017 00:55:07 +0000 Subject: repobrowse: consistently set text charset For everything with relevant content, we'll try to set UTF-8 charset and reduce duplication when generating response headers. --- lib/PublicInbox/RepoGitCommit.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/PublicInbox/RepoGitCommit.pm') diff --git a/lib/PublicInbox/RepoGitCommit.pm b/lib/PublicInbox/RepoGitCommit.pm index 8add3006..acac000e 100644 --- a/lib/PublicInbox/RepoGitCommit.pm +++ b/lib/PublicInbox/RepoGitCommit.pm @@ -135,19 +135,18 @@ sub call_git_commit { # RepoBase calls this $qsp->psgi_return($env, undef, sub { # parse header my ($r, $bref) = @_; if (!defined $r) { - my $errmsg = $git->err; - [ 500, [ 'Content-Type', 'text/html' ], [ $errmsg ] ]; + $self->rt(500, 'plain', $git->err); } elsif ($r == 0) { - git_commit_404($req); + git_commit_404($self, $req); } else { $env->{'qspawn.filter'} = git_commit_sed($self, $req); - [ 200, [ 'Content-Type', 'text/html' ] ]; + $self->rt(200, 'html'); } }); } sub git_commit_404 { - my ($req) = @_; + my ($self, $req) = @_; my $x = 'Missing commit or path'; my $pfx = "$req->{relcmd}commit"; @@ -156,7 +155,7 @@ sub git_commit_404 { $x .= "$try the latest commit in HEAD\n"; $x .= ''; - [404, ['Content-Type', 'text/html'], [ $x ]]; + $self->rt(404, 'html', $x); } # FIXME: horrifically expensive... -- cgit v1.2.3-24-ge0c7