user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH] mid: capitalize "ID" in "Message-ID"
@ 2020-04-29 10:43 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-04-29 10:43 UTC (permalink / raw)
  To: meta

Prefer the "ID" capitalization since it seems to to be the
preferred capitalization in RFC 5322.

In theory, this allows the interpreter to deduplicate the string
internally (I haven't checked if it does).

Unfortunately, there's too many instances of "Message-Id" in the
tests to be worth changing at this point.
---
 lib/PublicInbox/Import.pm | 2 +-
 lib/PublicInbox/MID.pm    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 95d654f6..de8ff55f 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -354,7 +354,7 @@ sub v1_mid0 ($) {
 	my $hdr = $mime->header_obj;
 	my $mids = mids($hdr);
 
-	if (!scalar(@$mids)) { # spam often has no Message-Id
+	if (!scalar(@$mids)) { # spam often has no Message-ID
 		my $mid0 = digest2mid(content_digest($mime), $hdr);
 		append_mid($hdr, $mid0);
 		return $mid0;
diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm
index dddde092..685306db 100644
--- a/lib/PublicInbox/MID.pm
+++ b/lib/PublicInbox/MID.pm
@@ -72,7 +72,7 @@ sub extract_mids {
 
 sub mids ($) {
 	my ($hdr) = @_;
-	my @mids = $hdr->header_raw('Message-Id');
+	my @mids = $hdr->header_raw('Message-ID');
 	uniq_mids(extract_mids(@mids));
 }
 
@@ -81,7 +81,7 @@ sub mids ($) {
 # import and index without relying on HTTP endpoints
 sub mids_for_index ($) {
 	my ($hdr) = @_;
-	my @mids = $hdr->header_raw('Message-Id');
+	my @mids = $hdr->header_raw('Message-ID');
 	my @alts = $hdr->header_raw('X-Alt-Message-ID');
 	uniq_mids(extract_mids(@mids, @alts));
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 10:43 [PATCH] mid: capitalize "ID" in "Message-ID" Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror http://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git