diff options
author | Eric Wong <e@80x24.org> | 2015-08-27 04:33:59 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-08-27 06:04:51 +0000 |
commit | 6fb2cbb34be7376a24bd00e0f8fd20114c18318c (patch) | |
tree | ec874cc24a3c37b2937f332962c0b64d78b37274 /lib/PublicInbox/WWW.pm | |
parent | ded3c261112acf925567507959319a8442a3b647 (diff) | |
download | public-inbox-6fb2cbb34be7376a24bd00e0f8fd20114c18318c.tar.gz |
We will prefer URLs without suffixes for now to avoid ambiguity in case a Message-ID ends with ".html", ".txt", ".mbox.gz" or any other suffix we may use. Static file compatibility is preserved by using a trailing slash as most servers can/will fall back to an index.html file in this case. For raw text files, we will follow gmane's lead with "/raw"
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r-- | lib/PublicInbox/WWW.pm | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 527d2131..ca338fb4 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -40,12 +40,18 @@ sub run { invalid_list(\%ctx, $1) || get_atom(\%ctx); # single-message pages + } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)/\z!o) { + invalid_list_mid(\%ctx, $1, $2) || get_mid_html(\%ctx); + } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)/raw\z!o) { + invalid_list_mid(\%ctx, $1, $2) || get_mid_txt(\%ctx); } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)\.txt\z!o) { invalid_list_mid(\%ctx, $1, $2) || get_mid_txt(\%ctx); } elsif ($path_info =~ m!$LISTNAME_RE/m/(\S+)\.html\z!o) { invalid_list_mid(\%ctx, $1, $2) || get_mid_html(\%ctx); # full-message page + } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)/\z!o) { + invalid_list_mid(\%ctx, $1, $2) || get_full_html(\%ctx); } elsif ($path_info =~ m!$LISTNAME_RE/f/(\S+)\.html\z!o) { invalid_list_mid(\%ctx, $1, $2) || get_full_html(\%ctx); @@ -53,7 +59,8 @@ sub run { } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\.html\z!o) { invalid_list_mid(\%ctx, $1, $2) || get_thread(\%ctx); - } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)\.mbox(\.gz)?\z!o) { + } elsif ($path_info =~ m!$LISTNAME_RE/t/(\S+)/mbox(\.gz)?\z!ox || + $path_info =~ m!$LISTNAME_RE/t/(\S+)\.mbox(\.gz)?\z!o) { my $sfx = $3; invalid_list_mid(\%ctx, $1, $2) || get_thread_mbox(\%ctx, $sfx); @@ -325,8 +332,8 @@ sub msg_pfx { "../f/$href.html"; } -# /$LISTNAME/t/$MESSAGE_ID.mbox -> thread as mbox -# /$LISTNAME/t/$MESSAGE_ID.mbox.gz -> thread as gzipped mbox +# /$LISTNAME/t/$MESSAGE_ID/mbox -> thread as mbox +# /$LISTNAME/t/$MESSAGE_ID/mbox.gz -> thread as gzipped mbox # note: I'm not a big fan of other compression formats since they're # significantly more expensive on CPU than gzip and less-widely available, # especially on older systems. Stick to zlib since that's what git uses. |