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-10 20:02:34 +0000
committerEric Wong <e@80x24.org>2014-04-11 22:23:58 +0000
commitb60a668b43b0a279c2a1d621c009396bea1a4898 (patch)
tree3b4a840a97657eb4ea6e6d0d8c723c63970da71a /lib/PublicInbox/Feed.pm
parent610e07776ea454ef5b86714f14718540ab0b4dae (diff)
downloadpublic-inbox-b60a668b43b0a279c2a1d621c009396bea1a4898.tar.gz
This prevents ambiguity when switching URLs between static
file servers and CGI.

The /$LISTNAME/index.html URL appearing in the wild is inevitable
because of our static file server support.  Worst yet, there's
no easy/consistent way to get all installations detect and 301
them to the shorter /$LISTNAME/.  So we make the CGI support
/$LISTNAME/index.html.

The downside of this is the potential duplicate entry in all caches.
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r--lib/PublicInbox/Feed.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index a6c1b9c1..da4cc04a 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -116,8 +116,12 @@ sub get_feedopts {
         if ($cgi) {
                 my $cgi_url = $cgi->self_url;
                 $url_base = $cgi_url;
-                $url_base =~ s!/?(?:index|all)\.atom\.xml\z!!;
-                $rv{atomurl} = $cgi_url;
+                if ($url_base =~ s!/(?:|index\.html)?\z!!) {
+                        $rv{atomurl} = "$url_base/index.atom.xml";
+                } else {
+                        $url_base =~ s!/?(?:index|all)\.atom\.xml\z!!;
+                        $rv{atomurl} = $cgi_url;
+                }
         } else {
                 $url_base = "http://example.com";
                 $rv{atomurl} = "$url_base/index.atom.xml";