Skip to content

Commit

Permalink
fix: fix header line continuation handling in mock MTA
Browse files Browse the repository at this point in the history
  • Loading branch information
d--j committed Mar 13, 2023
1 parent 29c0d61 commit 96a68dc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions integration/mta/mock/mta.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ func splitHeaders(headerBytes []byte) (fields []*field) {
nextEnd += 2
s = append(s, string(headerBytes[i:i+nextEnd]))
var peek byte
if i+nextEnd+1 < len(headerBytes) {
peek = headerBytes[i+nextEnd+1]
if i+nextEnd < len(headerBytes) {
peek = headerBytes[i+nextEnd]
}
continuation = peek == ' ' || peek == '\t'
if !continuation {
Expand Down
22 changes: 22 additions & 0 deletions integration/tests/header/add-first.testcase
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ To: <[email protected]>
Subject: test
Date: Fri, 10 Mar 2023 23:29:35 +0000 (UTC)
Message-ID: <[email protected]>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
s=20210705; t=1678734964;
bh=5/GMrdce0c+dcQGJ6MVXtmaDh+2N+HnEGwUws8QrPMQ=;
h=Message-ID:Date:MIME-Version:To:Reply-To:From:Subject:
Content-Type;
b=baodyiISY2B2f6zhm1j3Ah1ffO1UHIF7OBixrrReKYWelrcsdmynT9Gzu2i3pP+TF
Yyl0y/oiiKLgho8IDo/yposcy3LdyLD3AFfqyY+eEciaZT8S11F+cKGS37SKMJNSdC
JUV2N9q0DaawOxxiVudgfOqSosjrHKM0DfFX2vBQvhqls4j+SbqFyyOiGrylgmfALu
ZHB3pm9qoD1XdCkX/03Fce5RoTj3SLZHBdBlrd+jDcMPYlxkb22oRzUQuiMovWyo9d
kzbBbcm1ScHoDZAj7HRaaFI8G4/gCbsPePUDNZf3EPle3HUMKuGY8nhOCNRol00/6B
DUjfggp+BBAag==
.
DECISION ACCEPT
HEADER
Expand All @@ -16,4 +27,15 @@ To: <[email protected]>
Subject: test
Date: Fri, 10 Mar 2023 23:29:35 +0000 (UTC)
Message-ID: <[email protected]>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com;
s=20210705; t=1678734964;
bh=5/GMrdce0c+dcQGJ6MVXtmaDh+2N+HnEGwUws8QrPMQ=;
h=Message-ID:Date:MIME-Version:To:Reply-To:From:Subject:
Content-Type;
b=baodyiISY2B2f6zhm1j3Ah1ffO1UHIF7OBixrrReKYWelrcsdmynT9Gzu2i3pP+TF
Yyl0y/oiiKLgho8IDo/yposcy3LdyLD3AFfqyY+eEciaZT8S11F+cKGS37SKMJNSdC
JUV2N9q0DaawOxxiVudgfOqSosjrHKM0DfFX2vBQvhqls4j+SbqFyyOiGrylgmfALu
ZHB3pm9qoD1XdCkX/03Fce5RoTj3SLZHBdBlrd+jDcMPYlxkb22oRzUQuiMovWyo9d
kzbBbcm1ScHoDZAj7HRaaFI8G4/gCbsPePUDNZf3EPle3HUMKuGY8nhOCNRol00/6B
DUjfggp+BBAag==
.

0 comments on commit 96a68dc

Please sign in to comment.