about summary refs log tree commit homepage
path: root/lib/PublicInbox/WWW.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-09-02 02:37:23 +0000
committerEric Wong <e@80x24.org>2015-09-02 06:51:27 +0000
commitb872759b28cd4726b9f16f5214d042fdc50b1e93 (patch)
treef26f6f4a668df384ba6e4722d7eedef4058d013b /lib/PublicInbox/WWW.pm
parent1151816fc42c7d69c2417d58abb31d214ad06780 (diff)
downloadpublic-inbox-b872759b28cd4726b9f16f5214d042fdc50b1e93.tar.gz
Currently, this looks at other public-inbox configurations
served in the same process.  In the future, it will generate
links to other Message-ID lookup endpoints.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r--lib/PublicInbox/WWW.pm15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 9ae7f7be..16fd16aa 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -88,7 +88,14 @@ sub preload {
 
 # private functions below
 
-sub r404 { r(404, 'Not Found') }
+sub r404 {
+        my ($ctx) = @_;
+        if ($ctx && $ctx->{mid}) {
+                require PublicInbox::ExtMsg;
+                return PublicInbox::ExtMsg::ext_msg($ctx);
+        }
+        r(404, 'Not Found');
+}
 
 # simple response for errors
 sub r { [ $_[0], ['Content-Type' => 'text/plain'], [ join(' ', @_, "\n") ] ] }
@@ -151,7 +158,7 @@ sub mid2blob {
 # /$LISTNAME/$MESSAGE_ID/raw                    -> raw mbox
 sub get_mid_txt {
         my ($ctx) = @_;
-        my $x = mid2blob($ctx) or return r404();
+        my $x = mid2blob($ctx) or return r404($ctx);
         require PublicInbox::Mbox;
         PublicInbox::Mbox::emit1($x);
 }
@@ -159,7 +166,7 @@ sub get_mid_txt {
 # /$LISTNAME/$MESSAGE_ID/                   -> HTML content (short quotes)
 sub get_mid_html {
         my ($ctx) = @_;
-        my $x = mid2blob($ctx) or return r404();
+        my $x = mid2blob($ctx) or return r404($ctx);
 
         require PublicInbox::View;
         my $foot = footer($ctx);
@@ -173,7 +180,7 @@ sub get_mid_html {
 # /$LISTNAME/$MESSAGE_ID/f/                   -> HTML content (fullquotes)
 sub get_full_html {
         my ($ctx) = @_;
-        my $x = mid2blob($ctx) or return r404();
+        my $x = mid2blob($ctx) or return r404($ctx);
 
         require PublicInbox::View;
         my $foot = footer($ctx);