From: Harald Nordgren via GitGitGadget Date: Tue, 27 Oct 2026 08:31:19 GMT Subject: [PATCH v4 4/4] imap-send: match header names case insensitively Message-ID: <5b4a08bbdadac95a84f9c865e697584f45bd67af.1793089879.git.gitgitgadget@gmail.com> In-Reply-To: From: Harald Nordgren imap-send says "no messages found to send" for a message whose headers are spelled "from:", "date:" or "subject:", although RFC 5322 treats header field names as case insensitive. Match the three names in any case. Signed-off-by: Harald Nordgren --- imap-send.c | 6 +++--- t/t9001-send-email.sh | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/imap-send.c b/imap-send.c index 706c517e51..b8dac92c70 100644 --- a/imap-send.c +++ b/imap-send.c @@ -1462,11 +1462,11 @@ static bool has_required_headers(const char *line) bool from = false, date = false, subject = false; while ((line = strchr(line, '\n')) && *++line != '\n') { - if (starts_with(line, "From: ")) + if (istarts_with(line, "From: ")) from = true; - else if (starts_with(line, "Date: ")) + else if (istarts_with(line, "Date: ")) date = true; - else if (starts_with(line, "Subject: ")) + else if (istarts_with(line, "Subject: ")) subject = true; } return from && date && subject; diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 1f77c14315..897473e786 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -2898,4 +2898,19 @@ test_expect_success $PREREQ '--imap-sent-folder stores a copy of the sent patch' test_grep "(1/1) done" err ' +test_expect_success $PREREQ 'imap-send matches header names in any case' ' + test_config imap.tunnel ./fake-imap-server && + cat >lowercase.mbox <<-\EOF && + From mboxrd@z Thu Jan 1 00:00:00 1970 + from: Example + date: Thu, 1 Jan 1970 00:00:00 +0000 + subject: [PATCH] lowercase headers + + body + EOF + git imap-send --folder=INBOX err && + test_grep "^Sending 1 message to INBOX folder" err && + test_grep "(1/1) done" err +' + test_done -- gitgitgadget