Skip to content

Commit

Permalink
Revert "Fixed a corner case in calculating relaxed DKIM-Signature bod…
Browse files Browse the repository at this point in the history
…y hashes"

This reverts commit 5abf902.
  • Loading branch information
jstedfast committed Nov 9, 2015
1 parent 5abf902 commit f2906ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
11 changes: 2 additions & 9 deletions MimeKit/Cryptography/DkimRelaxedBodyFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public DkimRelaxedBodyFilter ()
lwsp = false;
}

unsafe int Filter (byte* inbuf, int length, byte* outbuf, bool flush)
unsafe int Filter (byte* inbuf, int length, byte* outbuf)
{
byte* inend = inbuf + length;
byte* outptr = outbuf;
Expand Down Expand Up @@ -110,13 +110,6 @@ unsafe int Filter (byte* inbuf, int length, byte* outbuf, bool flush)
inptr++;
}

if (flush && lwsp) {
// collapse lwsp to a single space
*outptr++ = (byte) ' ';
lwsp = false;
count++;
}

return count;
}

Expand All @@ -140,7 +133,7 @@ protected override byte[] Filter (byte[] input, int startIndex, int length, out

unsafe {
fixed (byte* inptr = input, outptr = OutputBuffer) {
outputLength = Filter (inptr + startIndex, length, outptr, flush);
outputLength = Filter (inptr + startIndex, length, outptr);
}
}

Expand Down
17 changes: 0 additions & 17 deletions UnitTests/DkimRelaxedBodyFilterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,5 @@ public void TestNonEmptyBodyEndingWithMultipleNewLines ()

Assert.AreEqual (expected, actual);
}

[Test]
public void TestTrailingLineWithOnlySpaceOrTab ()
{
const string text = "Hello!\r\n\r\n ";
const string expected = "Hello!\r\n\r\n ";
var input = Encoding.ASCII.GetBytes (text);
var filter = new DkimRelaxedBodyFilter ();
int outputIndex, outputLength;
byte[] output;
string actual;

output = filter.Flush (input, 0, input.Length, out outputIndex, out outputLength);
actual = Encoding.ASCII.GetString (output, outputIndex, outputLength);

Assert.AreEqual (expected, actual);
}
}
}

0 comments on commit f2906ed

Please sign in to comment.