about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-03-31 08:49:36 +0000
committerEric Wong <e@yhbt.net>2020-03-31 23:41:06 +0000
commit04e4a5573de1b9ed2f6528a0de568a1693882eea (patch)
treebcc72fc932592f68c2cecd5a5c0aee3dd8091299 /t
parent14561ae19938facc8ddf5038eafed3df9519ee10 (diff)
downloadpublic-inbox-04e4a5573de1b9ed2f6528a0de568a1693882eea.tar.gz
Message-IDs can apparently contain spaces and other weird
characters.  Ensure we pass those properly to shard subprocesses
when importing messages in parallel mode.

Our NNTP request parser does not deal with spaces in the
Message-ID, yet, and I don't expect most NNTP clients to,
either.  Nor does the Net::NNTP client handle them in responses.
Diffstat (limited to 't')
-rw-r--r--t/v2writable.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/v2writable.t b/t/v2writable.t
index cdcfe4d0..66d5663e 100644
--- a/t/v2writable.t
+++ b/t/v2writable.t
@@ -109,6 +109,11 @@ if ('ensure git configs are correct') {
         @mids = $mime->header_obj->header_raw('Message-Id');
         like($mids[0], $sane_mid, 'mid was generated');
         is(scalar(@mids), 1, 'new generated');
+
+        @warn = ();
+        $mime->header_set('Message-Id', '<space@ (NXDOMAIN) >');
+        ok($im->add($mime), 'message added with space in Message-Id');
+        is_deeply([], \@warn);
 }
 
 {
@@ -175,8 +180,13 @@ EOF
                 is($uniq{$mid}++, 0, "MID for $num is unique in XOVER");
                 is_deeply($n->xhdr('Message-ID', $num),
                          { $num => $mid }, "XHDR lookup OK on num $num");
+
+                # FIXME PublicInbox::NNTP (server) doesn't handle spaces in
+                # Message-ID, but neither does Net::NNTP (client)
+                next if $mid =~ / /;
+
                 is_deeply($n->xhdr('Message-ID', $mid),
-                         { $mid => $mid }, "XHDR lookup OK on MID $num");
+                         { $mid => $mid }, "XHDR lookup OK on MID $mid ($num)");
         }
         my %nn;
         foreach my $mid (@{$n->newnews(0, $group)}) {