about summary refs log tree commit homepage
path: root/lib/PublicInbox/Mbox.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-12-10 22:38:47 +0000
committerEric Wong <e@80x24.org>2020-12-11 03:40:20 +0000
commit1bf653ad139bf7bb3d853ab0b5eae3eaa1b13a95 (patch)
tree389bacf02a9e80bcb445c59fafad8159f63f3610 /lib/PublicInbox/Mbox.pm
parentac4f951e03eaf635c8dd20a6f42bfc71b0011412 (diff)
downloadpublic-inbox-1bf653ad139bf7bb3d853ab0b5eae3eaa1b13a95.tar.gz
These headers can conflict with headers in the DKIM signature;
and parsing the DKIM-Signature header to determine whether or
not we can safely add a header would be more code and CPU
cycles.

Since IMAP seems fine without these headers (and JMAP will
likely be, too), there's likely no need to continue appending
these to every message.  Nowadays, developers seem sufficiently
trained to use URLs with Message-IDs in them.  So drop the
headers and save some cycles and bandwidth all around.
Diffstat (limited to 'lib/PublicInbox/Mbox.pm')
-rw-r--r--lib/PublicInbox/Mbox.pm32
1 files changed, 6 insertions, 26 deletions
diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm
index c88350c9..c8e4b406 100644
--- a/lib/PublicInbox/Mbox.pm
+++ b/lib/PublicInbox/Mbox.pm
@@ -20,7 +20,7 @@ sub getline {
         my $ibx = $ctx->{ibx};
         my $eml = $ibx->smsg_eml($smsg) or return;
         my $n = $ctx->{smsg} = $ibx->over->next_by_mid(@{$ctx->{next_arg}});
-        $ctx->zmore(msg_hdr($ctx, $eml, $smsg->{mid}));
+        $ctx->zmore(msg_hdr($ctx, $eml));
         if ($n) {
                 $ctx->translate(msg_body($eml));
         } else { # last message
@@ -46,7 +46,7 @@ sub async_eml { # for async_blob_cb
         # next message
         $ctx->{smsg} = $ctx->{ibx}->over->next_by_mid(@{$ctx->{next_arg}});
 
-        $ctx->zmore(msg_hdr($ctx, $eml, $smsg->{mid}));
+        $ctx->zmore(msg_hdr($ctx, $eml));
         $ctx->{http_out}->write($ctx->translate(msg_body($eml)));
 }
 
@@ -74,7 +74,7 @@ sub no_over_raw ($) {
         my $mref = $ctx->{ibx}->msg_by_mid($ctx->{mid}) or return;
         my $eml = PublicInbox::Eml->new($mref);
         [ 200, res_hdr($ctx, $eml->header_str('Subject')),
-                [ msg_hdr($ctx, $eml, $ctx->{mid}) . msg_body($eml) ] ]
+                [ msg_hdr($ctx, $eml) . msg_body($eml) ] ]
 }
 
 # /$INBOX/$MESSAGE_ID/raw
@@ -90,8 +90,8 @@ sub emit_raw {
         $ctx->psgi_response(200, $res_hdr);
 }
 
-sub msg_hdr ($$;$) {
-        my ($ctx, $eml, $mid) = @_;
+sub msg_hdr ($$) {
+        my ($ctx, $eml) = @_;
         my $header_obj = $eml->header_obj;
 
         # drop potentially confusing headers, ssoma already should've dropped
@@ -99,31 +99,11 @@ sub msg_hdr ($$;$) {
         foreach my $d (qw(Lines Bytes Content-Length Status)) {
                 $header_obj->header_set($d);
         }
-        my $ibx = $ctx->{ibx};
-        my $base = $ctx->{base_url};
-        $mid = $ctx->{mid} unless defined $mid;
-        $mid = mid_escape($mid);
-        my @append = (
-                'Archived-At', "<$base$mid/>",
-                'List-Archive', "<$base>",
-        );
         my $crlf = $header_obj->crlf;
         my $buf = $header_obj->as_string;
         # fixup old bug from import (pre-a0c07cba0e5d8b6a)
         $buf =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
-        $buf = "From mboxrd\@z Thu Jan  1 00:00:00 1970" . $crlf . $buf;
-
-        for (my $i = 0; $i < @append; $i += 2) {
-                my $k = $append[$i];
-                my $v = $append[$i + 1];
-                my @v = $header_obj->header_raw($k);
-                $buf .= "$k: $v$crlf" if !grep(/\A\Q$v\E\z/, @v);
-        }
-        my $post_addr = $ibx->{-primary_address};
-        if ($post_addr && $header_obj->header_raw('List-Post')) {
-                $buf .= "List-Post: <mailto:$post_addr>$crlf";
-        }
-        $buf .= $crlf;
+        "From mboxrd\@z Thu Jan  1 00:00:00 1970" . $crlf . $buf . $crlf;
 }
 
 sub msg_body ($) {