From 165b8046310d5696a1877b267f5eb74b5a431466 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 15 Apr 2014 06:35:52 +0000 Subject: HTML: use shorter URLs in indices Long URLs are not needed for HTML pages, but may be for feeds since they're often resyndicated and not consumed by the browser. --- lib/PublicInbox/Feed.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index b08bd883..92bbf92d 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -118,13 +118,15 @@ sub get_feedopts { } my $url_base; if ($cgi) { - my $cgi_url = $cgi->self_url; + my $cgi_url = $cgi->url(-path=>1, -query=>1, -relative=>1); + my $base = $cgi->url(-base); $url_base = $cgi_url; if ($url_base =~ s!/(?:|index\.html)?\z!!) { - $rv{atomurl} = "$url_base/index.atom.xml"; + $rv{atomurl} = "$base$url_base/index.atom.xml"; } else { $url_base =~ s!/?(?:index|all)\.atom\.xml\z!!; - $rv{atomurl} = $cgi_url; + $rv{atomurl} = $base . $cgi_url; + $url_base = $base . $url_base; # XXX is this needed? } } else { $url_base = "http://example.com"; -- cgit v1.2.3-24-ge0c7