about summary refs log tree commit homepage
path: root/lib/PublicInbox/Feed.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-04-15 06:35:52 +0000
committerEric Wong <e@80x24.org>2014-04-15 06:35:52 +0000
commit165b8046310d5696a1877b267f5eb74b5a431466 (patch)
tree6730dc7ca6becbc3539e64103c2bbfbdd278c7d4 /lib/PublicInbox/Feed.pm
parent27beeb0425cd92343d3d529e37f01de8982a1078 (diff)
downloadpublic-inbox-165b8046310d5696a1877b267f5eb74b5a431466.tar.gz
Long URLs are not needed for HTML pages, but may be for feeds since
they're often resyndicated and not consumed by the browser.
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r--lib/PublicInbox/Feed.pm8
1 files changed, 5 insertions, 3 deletions
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";