From 7d8cc28839176b7fa67c509aae2b4c050e3abbd1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 26 Feb 2016 10:38:41 +0000 Subject: repobrowse: drop CGI support We already dropped CGI from the master branch, drop it from repobrowse as well to simplify code. --- lib/PublicInbox/Repobrowse.pm | 13 ++++--------- lib/PublicInbox/RepobrowseBase.pm | 3 +-- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/Repobrowse.pm b/lib/PublicInbox/Repobrowse.pm index 219b44d6..91d0ab20 100644 --- a/lib/PublicInbox/Repobrowse.pm +++ b/lib/PublicInbox/Repobrowse.pm @@ -42,16 +42,11 @@ sub r { [ $_[0], ['Content-Type' => 'text/plain'], [ join(' ', @_, "\n") ] ] } # (e.g. curl does not follow 301 unless given "-L") my %NO_TSLASH = map { $_ => 1 } qw(Log Commit Tree Summary Tag); sub no_tslash { - my ($cgi) = @_; + my ($cgi) = @_; # Plack::Request my ($base, $uri); - if (ref($cgi) eq 'CGI') { - $base = $cgi->url(-base); - $uri = $ENV{REQUEST_URI}; - } else { # Plack::Request - $base = $cgi->base; - $base =~ s!/+\z!!; - $uri = $cgi->request_uri; - } + $base = $cgi->base; + $base =~ s!/+\z!!; + $uri = $cgi->request_uri; my $qs = ''; if ($uri =~ s/(\?.+)\z//) { $qs = $1; diff --git a/lib/PublicInbox/RepobrowseBase.pm b/lib/PublicInbox/RepobrowseBase.pm index dd854ffc..7863d6ce 100644 --- a/lib/PublicInbox/RepobrowseBase.pm +++ b/lib/PublicInbox/RepobrowseBase.pm @@ -85,8 +85,7 @@ sub r { # The goal is to be able to make redirects like we make # tags with '../' my $cgi = $req->{cgi}; - my $base; - $base = ref($cgi) eq 'CGI' ? $cgi->url(-base).'/' : $cgi->base; + my $base = $cgi->base; my ($redir) = @extra; if ($redir =~ m!\A\.\./!) { # relative redirect my @orig = split(m!/+!, $cgi->path_info, -1); -- cgit v1.2.3-24-ge0c7