From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 08/11] www: root atom feed is "new.atom" and not "atom.xml"
Date: Tue, 1 Sep 2015 08:55:25 +0000 [thread overview]
Message-ID: <1441097728-31950-8-git-send-email-e@80x24.org> (raw)
In-Reply-To: <1441097728-31950-1-git-send-email-e@80x24.org>
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 | 36 ++++++++++++++++++++----------------
lib/PublicInbox/Feed.pm | 4 ++--
lib/PublicInbox/WWW.pm | 4 ++--
t/plack.t | 2 +-
4 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/Documentation/design_www.txt b/Documentation/design_www.txt
index d25afca..a11c389 100644
--- a/Documentation/design_www.txt
+++ b/Documentation/design_www.txt
@@ -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
--------------
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 1fef984..9d58193 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -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/";
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 278d786..a9cb6d7 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -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;
diff --git a/t/plack.t b/t/plack.t
index b3c8764..50c9e60 100644
--- 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"!,
--
EW
next prev parent reply other threads:[~2015-09-01 8:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-01 8:55 [PATCH 01/11] search: reduce redundant doc data Eric Wong
2015-09-01 8:55 ` [PATCH 02/11] search: allow querying all mail with '' Eric Wong
2015-09-01 8:55 ` [PATCH 03/11] search: show newest results first Eric Wong
2015-09-01 8:55 ` [PATCH 04/11] feed: use updated date based on git commit date Eric Wong
2015-09-01 8:55 ` [PATCH 05/11] feed: extract atom header generation Eric Wong
2015-09-01 8:55 ` [PATCH 06/11] implement per-thread Atom feeds Eric Wong
2015-09-01 9:30 ` [13/11 PATCH] feed: fix <updated> tag in Atom feed Eric Wong
2015-09-01 8:55 ` [PATCH 07/11] www: compile mbox regexp only once Eric Wong
2015-09-01 8:55 ` Eric Wong [this message]
2015-09-01 8:55 ` [PATCH 09/11] completely revamp URL structure to shorten permalinks Eric Wong
2015-09-01 8:55 ` [PATCH 10/11] view: drop extra '</a>' tag Eric Wong
2015-09-01 8:55 ` [PATCH 11/11] view: more robust link generation Eric Wong
2015-09-01 9:08 ` [PATCH 12/11] view: add missing space Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441097728-31950-8-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).