]> Sergey Matveev's repositories - public-inbox.git/commitdiff
www: root atom feed is "new.atom" and not "atom.xml"
authorEric Wong <e@80x24.org>
Tue, 1 Sep 2015 08:55:25 +0000 (08:55 +0000)
committerEric Wong <e@80x24.org>
Tue, 1 Sep 2015 08:56:06 +0000 (08:56 +0000)
The MIME type entry for Atom feed relies on "atom",
so allow properly-configured static file servers to serve
it with the correct Content-Type header.

Documentation/design_www.txt
lib/PublicInbox/Feed.pm
lib/PublicInbox/WWW.pm
t/plack.t

index d25afca3f911082de6b367da8bee061ba29de18e..a11c3896cdcccf7e754d7f9ee5f21310257e5d56 100644 (file)
@@ -3,34 +3,38 @@ URL naming
 
 ### Unstable endpoints
 /$LISTNAME/?r=$GIT_COMMIT                       -> HTML only
-/$LISTNAME/atom.xml                             -> Atom feed
+/$LISTNAME/new.atom                        -> Atom feed
 
 #### Optional, relies on Search::Xapian
-/$LISTNAME/t/$MESSAGE_ID/                       -> HTML content of thread
-/$LISTNAME/t/$MESSAGE_ID/atom                   -> Atom feed for thread
-/$LISTNAME/t/$MESSAGE_ID/mbox.gz                -> gzipped mbox of thread
+/$LISTNAME/t/$MESSAGE_ID/                  -> HTML content of thread
+/$LISTNAME/t/$MESSAGE_ID/atom              -> Atom feed for thread
+/$LISTNAME/t/$MESSAGE_ID/mbox.gz           -> gzipped mbox of thread
 
 ### Stable endpoints
-/$LISTNAME/m/$MESSAGE_ID/                       -> HTML content (short quotes)
-/$LISTNAME/m/$MESSAGE_ID                        -> 301 to above
-/$LISTNAME/m/$MESSAGE_ID/raw                    -> raw mbox
-/$LISTNAME/f/$MESSAGE_ID/                       -> HTML content (full quotes)
-/$LISTNAME/f/$MESSAGE_ID                        -> 301 to above
-/$LISTNAME/f/$MESSAGE_ID/raw (*)                -> 301 to ../m/$MESSAGE_ID/raw
+/$LISTNAME/m/$MESSAGE_ID/                  -> HTML content (short quotes)
+/$LISTNAME/m/$MESSAGE_ID                   -> 301 to above
+/$LISTNAME/m/$MESSAGE_ID/raw               -> raw mbox
+/$LISTNAME/f/$MESSAGE_ID/                  -> HTML content (full quotes)
+/$LISTNAME/f/$MESSAGE_ID                   -> 301 to above
+/$LISTNAME/f/$MESSAGE_ID/raw [1]           -> 301 to ../m/$MESSAGE_ID/raw
 
-### Legacy endpoints (may be ambiguous given Message-IDs with similar suffies)
-/$LISTNAME/m/$MESSAGE_ID.html                   -> 301 to $MESSAGE_ID/
-/$LISTNAME/m/$MESSAGE_ID.txt                    -> 301 to $MESSAGE_ID/raw
-/$LISTNAME/f/$MESSAGE_ID.html                   -> 301 to $MESSAGE_ID/
-/$LISTNAME/f/$MESSAGE_ID.txt (*)                -> 301 to ../m/$MESSAGE_ID/raw
+### Legacy endpoints (may be ambiguous given Message-IDs with similar suffixes)
+/$LISTNAME/m/$MESSAGE_ID.html              -> 301 to $MESSAGE_ID/
+/$LISTNAME/m/$MESSAGE_ID.txt               -> 301 to $MESSAGE_ID/raw
+/$LISTNAME/f/$MESSAGE_ID.html              -> 301 to $MESSAGE_ID/
+/$LISTNAME/f/$MESSAGE_ID.txt [1]           -> 301 to ../m/$MESSAGE_ID/raw
 
+/$LISTNAME/atom.xml [2]                    -> identical to /$LISTNAME/new.atom
 
 FIXME: we must refactor/cleanup/add tests for most of our CGI before
 adding more endpoints and features.
 
-(*) These URLs were never linked, but only exist as a convenience to folks
+[1] These URLs were never linked, but only exist as a convenience to folks
     who edit existing URLs
 
+[2] Do not make this into a 301 since feed readers may not follow them as well
+    as normal browsers do.
+
 Encoding notes
 --------------
 
index 1fef98491e35fc7d9426dca7cbab918eedd5e4b2..9d581935a623539d72b53c0eeee6d41a592f2de7 100644 (file)
@@ -287,11 +287,11 @@ sub get_feedopts {
                if (my $mid = $ctx->{mid}) { # per-thread feed:
                        $rv{atomurl} = "$url_base/t/$mid/atom";
                } else {
-                       $rv{atomurl} = "$url_base/atom.xml";
+                       $rv{atomurl} = "$url_base/new.atom";
                }
        } else {
                $url_base = "http://example.com";
-               $rv{atomurl} = "$url_base/atom.xml";
+               $rv{atomurl} = "$url_base/new.atom";
        }
        $rv{url} ||= "$url_base/";
        $rv{midurl} = "$url_base/m/";
index 278d786d13755242b0edc72b1e0591b3040cc047..a9cb6d713cbfab429118220edf89262fd17ed58f 100644 (file)
@@ -34,7 +34,7 @@ sub run {
                invalid_list(\%ctx, $1) || redirect_list_index($cgi);
        } elsif ($path_info =~ m!$LISTNAME_RE(?:/|/index\.html)?\z!o) {
                invalid_list(\%ctx, $1) || get_index(\%ctx);
-       } elsif ($path_info =~ m!$LISTNAME_RE/atom\.xml\z!o) {
+       } elsif ($path_info =~ m!$LISTNAME_RE/(?:atom\.xml|new\.atom)\z!o) {
                invalid_list(\%ctx, $1) || get_atom(\%ctx);
 
        # single-message pages
@@ -128,7 +128,7 @@ sub invalid_list_mid {
        $ret;
 }
 
-# /$LISTNAME/atom.xml                       -> Atom feed, includes replies
+# /$LISTNAME/new.atom                     -> Atom feed, includes replies
 sub get_atom {
        my ($ctx) = @_;
        require PublicInbox::Feed;
index b3c87642ae6ecc6217942d06b2304d09cfaa4444..50c9e6058325d03c0985d1638b28eb339cde99c0 100644 (file)
--- a/t/plack.t
+++ b/t/plack.t
@@ -83,7 +83,7 @@ EOF
 
        test_psgi($app, sub {
                my ($cb) = @_;
-               my $atomurl = 'http://example.com/test/atom.xml';
+               my $atomurl = 'http://example.com/test/new.atom';
                my $res = $cb->(GET('http://example.com/test/'));
                is(200, $res->code, 'success response received');
                like($res->content, qr!href="\Q$atomurl\E"!,