From e358bd7a3833f8c5bf9db57d228888f9c5f3692e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 2 Jul 2016 07:56:34 +0000 Subject: inbox: base_url method takes PSGI env hashref instead This is lighter and we can work further towards eliminating our Plack::Request dependency entirely. --- lib/PublicInbox/WwwStream.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'lib/PublicInbox/WwwStream.pm') diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index fdab4da3..be6ce2e6 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -62,13 +62,8 @@ sub _html_end { my $obj = $ctx->{-inbox}; my $desc = ascii_html($obj->description); - # FIXME: cleanup - my $env = $ctx->{env}; - my $scheme = $env->{'psgi.url_scheme'}; - my $host_port = $env->{HTTP_HOST} || - "$env->{SERVER_NAME}:$env->{SERVER_PORT}"; - my $http = "$scheme://$host_port".($env->{SCRIPT_NAME} || '/'); - $http = URI->new($http . $obj->{name})->canonical->as_string; + my $http = $obj->base_url($ctx->{env}); + chop $http; my %seen = ( $http => 1 ); my @urls = ($http); foreach my $u (@{$obj->cloneurl}) { -- cgit v1.2.3-24-ge0c7