about summary refs log tree commit homepage
path: root/lib/PublicInbox/Cgit.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-12-25 07:50:48 +0000
committerEric Wong <e@80x24.org>2019-12-27 20:00:32 +0000
commit07d0e2d336d4697c3284fe3dd59dae0583984e23 (patch)
tree792e6477bfaa63f4ad4ebdf68ee2fa1f6f559693 /lib/PublicInbox/Cgit.pm
parenta7949988f7f8690c868d2150fe3000fcf6a6d5f4 (diff)
downloadpublic-inbox-07d0e2d336d4697c3284fe3dd59dae0583984e23.tar.gz
Make it easier to share code between our GitHTTPBackend and Cgit
packages, for now, and possibly other packages in the future.

We can avoid inline_object and anonymous subs at the same
time, reducing per-request memory overhead.
Diffstat (limited to 'lib/PublicInbox/Cgit.pm')
-rw-r--r--lib/PublicInbox/Cgit.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/Cgit.pm b/lib/PublicInbox/Cgit.pm
index 094f146e..68da9178 100644
--- a/lib/PublicInbox/Cgit.pm
+++ b/lib/PublicInbox/Cgit.pm
@@ -13,9 +13,9 @@ use PublicInbox::GitHTTPBackend;
 *input_prepare = *PublicInbox::GitHTTPBackend::input_prepare;
 *parse_cgi_headers = *PublicInbox::GitHTTPBackend::parse_cgi_headers;
 *serve = *PublicInbox::GitHTTPBackend::serve;
-*static_result = *PublicInbox::GitHTTPBackend::static_result;
 use warnings;
 use PublicInbox::Qspawn;
+use PublicInbox::WwwStatic;
 use Plack::MIME;
 
 sub locate_cgit ($) {
@@ -115,8 +115,8 @@ sub call {
         } elsif ($path_info =~ m!$self->{static}! &&
                  defined($cgit_data = $self->{cgit_data})) {
                 my $f = $1;
-                my $type = Plack::MIME->mime_type($f);
-                return static_result($env, [], $cgit_data.$f, $type);
+                return PublicInbox::WwwStatic::response($env, [], $cgit_data.$f,
+                                                Plack::MIME->mime_type($f));
         }
 
         my $cgi_env = { PATH_INFO => $path_info };