From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.4 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9E39B1F821 for ; Mon, 17 Aug 2015 03:38:24 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 6/9] search: use raw headers without MIME decoding Date: Mon, 17 Aug 2015 03:38:14 +0000 Message-Id: <1439782697-16412-7-git-send-email-e@80x24.org> In-Reply-To: <1439782697-16412-1-git-send-email-e@80x24.org> References: <1439782697-16412-1-git-send-email-e@80x24.org> List-Id: This should be less error-prone in case somebody tries to screw with us and our thread_id mechanism or somehow waste our resources. Unfortunately Mail::Thread isn't smart enough for this, yet, so we may need to downgrade to Email::Simple objects as a workaround. Or simply not worry about the display so much if somebody is intentionally trying to make it thread badly/incorrectly. --- lib/PublicInbox/Search.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Search.pm b/lib/PublicInbox/Search.pm index 6fd46f4..051f7a5 100644 --- a/lib/PublicInbox/Search.pm +++ b/lib/PublicInbox/Search.pm @@ -74,7 +74,7 @@ sub add_message { my $db = $self->{xdb}; my $doc_id; - my $mid = mid_clean($mime->header('Message-ID')); + my $mid = mid_clean($mime->header_obj->header_raw('Message-ID')); $mid = mid_compressed($mid); my $was_ghost = 0; my $ct_msg = $mime->header('Content-Type') || 'text/plain'; @@ -341,9 +341,9 @@ sub link_message_to_parents { my $doc = $smsg->{doc}; my $mid = mid_compressed($smsg->mid); my $mime = $smsg->mime; - my $refs = $mime->header('References'); + my $refs = $mime->header_obj->header_raw('References'); my @refs = $refs ? ($refs =~ /<([^>]+)>/g) : (); - my $irt = $mime->header('In-Reply-To'); + my $irt = $mime->header_obj->header_raw('In-Reply-To'); if ($irt) { if ($irt =~ /<([^>]+)>/) { $irt = $1; @@ -498,7 +498,7 @@ sub index_blob { sub unindex_blob { my ($self, $git, $blob) = @_; my $mime = do_cat_mail($git, $blob) or return; - my $mid = $mime->header('Message-ID'); + my $mid = $mime->header_obj->header_raw('Message-ID'); eval { $self->remove_message($mid) } if defined $mid; warn "W: unindex_blob $blob: $@\n" if $@; } -- EW