diff options
author | Eric Wong <e@80x24.org> | 2017-03-03 00:55:07 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-03-03 00:55:07 +0000 |
commit | b9b12ac92230cc6807623293b93cc22e5eb33684 (patch) | |
tree | e05c029ebd6a16bbd9dd5045dcff7d2701794235 /lib/PublicInbox/RepoGitRaw.pm | |
parent | 16b1fbe36cc39a351ef9810b9018d36df833a941 (diff) | |
download | public-inbox-b9b12ac92230cc6807623293b93cc22e5eb33684.tar.gz |
For everything with relevant content, we'll try to set UTF-8 charset and reduce duplication when generating response headers.
Diffstat (limited to 'lib/PublicInbox/RepoGitRaw.pm')
-rw-r--r-- | lib/PublicInbox/RepoGitRaw.pm | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/PublicInbox/RepoGitRaw.pm b/lib/PublicInbox/RepoGitRaw.pm index f02439ad..7d2c0d22 100644 --- a/lib/PublicInbox/RepoGitRaw.pm +++ b/lib/PublicInbox/RepoGitRaw.pm @@ -22,10 +22,10 @@ sub call_git_raw { if ($type eq 'blob') { $type = git_blob_mime_type($self, $req, $cat, \$buf, \$left); } elsif ($type eq 'commit' || $type eq 'tag') { - $type = 'text/plain'; + $type = 'text/plain; charset=UTF-8'; } elsif ($type eq 'tree') { $git->cat_file_finish($left); - return git_tree_raw($req, $git, $hex); + return git_tree_raw($self, $req, $git, $hex); } else { $type = 'application/octet-stream'; } @@ -61,7 +61,7 @@ sub git_tree_sed ($) { # This should follow the cgit DOM structure in case anybody depends on it, # not using <pre> here as we don't expect people to actually view it much sub git_tree_raw { - my ($req, $git, $hex) = @_; + my ($self, $req, $git, $hex) = @_; my @ex = @{$req->{extra}}; my $rel = $req->{relcmd}; @@ -83,10 +83,10 @@ sub git_tree_raw { $qsp->psgi_return($env, undef, sub { my ($r) = @_; if (!defined $r) { - [ 500, [ 'Content-Type', 'text/plain' ], [ $git->err ]]; + $self->rt(500, 'plain', $git->err); } else { $env->{'qspawn.filter'} = git_tree_sed($req); - [ 200, [ 'Content-Type', 'text/html' ] ]; + $self->rt(200, 'html'); } }); } |