about summary refs log tree commit homepage
path: root/lib/PublicInbox/WWW.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-01-01 10:38:59 +0000
committerEric Wong <e@80x24.org>2020-01-01 19:11:09 +0000
commit078f637c80cc33c7d29973b95fdc16205ad7bb32 (patch)
tree59f1d4e80298c522eccd026187739c797a62dd9c /lib/PublicInbox/WWW.pm
parent8c21d7dc061b5e53eb096f5e7edcb1cd16c0f959 (diff)
downloadpublic-inbox-078f637c80cc33c7d29973b95fdc16205ad7bb32.tar.gz
It's now possible to use WwwStatic as a standalone PSGI
app to serve static files and recreate the award-winning
web design of https://public-inbox.org/ :>
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r--lib/PublicInbox/WWW.pm15
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 99f9f1dc..efe7c8ca 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -22,7 +22,7 @@ use PublicInbox::MID qw(mid_escape);
 require PublicInbox::Git;
 use PublicInbox::GitHTTPBackend;
 use PublicInbox::UserContent;
-use PublicInbox::WwwStatic qw(r);
+use PublicInbox::WwwStatic qw(r path_info_raw);
 
 # TODO: consider a routing tree now that we have more endpoints:
 our $INBOX_RE = qr!\A/([\w\-][\w\.\-]*)!;
@@ -43,19 +43,6 @@ sub run {
         PublicInbox::WWW->new->call($req->env);
 }
 
-# PATH_INFO is decoded, and we want the undecoded original
-my %path_re_cache;
-sub path_info_raw ($) {
-        my ($env) = @_;
-        my $sn = $env->{SCRIPT_NAME};
-        my $re = $path_re_cache{$sn} ||= do {
-                $sn = '/'.$sn unless index($sn, '/') == 0;
-                $sn =~ s!/\z!!;
-                qr!\A(?:https?://[^/]+)?\Q$sn\E(/[^\?\#]+)!;
-        };
-        $env->{REQUEST_URI} =~ $re ? $1 : $env->{PATH_INFO};
-}
-
 sub call {
         my ($self, $env) = @_;
         my $ctx = { env => $env, www => $self };