]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WWW.pm
treewide: run update-copyrights from gnulib for 2019
[public-inbox.git] / lib / PublicInbox / WWW.pm
index efe7c8ca0064427e3425bb99190e41c373837a94..1e7d3c1efef1a84833f36c945a85c22dd1a2f29c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2019 all contributors <meta@public-inbox.org>
+# Copyright (C) 2014-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Main web interface for mailing list archives
@@ -70,7 +70,7 @@ sub call {
                        return invalid_inbox($ctx, $1) || mbox_results($ctx);
                }
        }
-       elsif ($method !~ /\AGET|HEAD\z/) {
+       elsif ($method !~ /\A(?:GET|HEAD)\z/) {
                return r(405);
        }
 
@@ -85,6 +85,8 @@ sub call {
                invalid_inbox($ctx, $1) || get_atom($ctx);
        } elsif ($path_info =~ m!$INBOX_RE/new\.html\z!o) {
                invalid_inbox($ctx, $1) || get_new($ctx);
+       } elsif ($path_info =~ m!$INBOX_RE/description\z!o) {
+               get_description($ctx, $1);
        } elsif ($path_info =~ m!$INBOX_RE/(?:(?:git/)?([0-9]+)(?:\.git)?/)?
                                ($PublicInbox::GitHTTPBackend::ANY)\z!ox) {
                my ($epoch, $path) = ($2, $3);
@@ -621,4 +623,13 @@ sub get_css ($$$) {
        [ 200, $h, [ $css ] ];
 }
 
+sub get_description {
+       my ($ctx, $inbox) = @_;
+       invalid_inbox($ctx, $inbox) || do {
+               my $d = $ctx->{-inbox}->description . "\n";
+               [ 200, [ 'Content-Length', bytes::length($d),
+                       'Content-Type', 'text/plain' ], [ $d ] ];
+       };
+}
+
 1;