From 54f318f413d0fdf8a9d488a19c66b85697312ca0 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Mon, 19 Mar 2018 08:14:47 +0000 Subject: import: switch to URL-safe Base64 for Message-IDs Hexdigests are too long and shorter Message-IDs are easier to deal with. --- lib/PublicInbox/Import.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/Import.pm') diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 4c007b61..77e74c13 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -401,7 +401,16 @@ sub atfork_child { sub digest2mid ($) { my ($dig) = @_; - $dig->clone->hexdigest . '@localhost'; + my $b64 = $dig->clone->b64digest; + # Make our own URLs nicer: + # See "Base 64 Encoding with URL and Filename Safe Alphabet" in RFC4648 + $b64 =~ tr!+/=!-_!d; + + # We can make this more meaningful with a date prefix or other things, + # but this is only needed for crap that fails to generate a Message-ID + # or reuses one. In other words, it's usually spammers who hit this + # so they don't deserve nice Message-IDs :P + $b64 . '@localhost'; } 1; -- cgit v1.2.3-24-ge0c7