From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 0BBAE1F462; Thu, 13 Jun 2019 20:46:53 +0000 (UTC) Date: Thu, 13 Jun 2019 20:46:52 +0000 From: Eric Wong To: Dave Taht Cc: meta@public-inbox.org Subject: [PATCH] nntp: ensure Message-ID is not folded for leafnode Message-ID: <20190613-204649-aaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh@horrible> References: <87tvlkbkrk.fsf@taht.net> <20190613070031.GA9743@dcvr> <87lfy5mkxy.fsf@taht.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87lfy5mkxy.fsf@taht.net> List-Id: Dave Taht wrote: > Eric Wong writes: > > However, I've also noticed leafnode (finally tried it) also > > fails if a Message-ID is too long and spans multiple lines > > (those were from outlook.com, go figure). > > Thanks! Is there a way to reformat that? Yeah, this seems to work: -----------8<------------ Subject: [PATCH] nntp: ensure Message-ID is not folded for leafnode Leafnode cannot handle Message-ID headers which are too long and require folding via Email::Simple::Header. Since there are already many of these messages in git with the header already folded, we need to handle the unfolding when emitting the message via NNTP. As far as we know, Leafnode is the only client software incapable of handling this case. --- lib/PublicInbox/NNTP.pm | 7 +++++++ t/nntpd.t | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 1d07220..d409e78 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -519,6 +519,13 @@ sub _header ($) { my $hdr = $_[0]->header_obj->as_string; utf8::encode($hdr); $hdr =~ s/(?= $t0, 'valid date after start'); ok($date <= $t1, 'valid date before stop'); } + if ('leafnode interop') { + my $for_leafnode = PublicInbox::MIME->new(<<""); +From: longheader\@example.com +To: $addr +Subject: none +Date: Fri, 02 Oct 1993 00:00:00 +0000 + + my $long_hdr = 'for-leafnode-'.('y'x200).'@example.com'; + $for_leafnode->header_set('Message-ID', "<$long_hdr>"); + $im->add($for_leafnode); + $im->done; + if ($version == 1) { + my $s = PublicInbox::SearchIdx->new($mainrepo, 1); + $s->index_sync; + } + my $hdr = $n->head("<$long_hdr>"); + my $expect = qr/\AMessage-ID: /i . qr/\Q<$long_hdr>\E/; + ok(scalar(grep(/$expect/, @$hdr)), 'Message-ID not folded'); + ok(scalar(grep(/^Path:/, @$hdr)), 'Path: header found'); + } # pipelined requests: { -- EW