-
Notifications
You must be signed in to change notification settings - Fork 65
Solve #23: header with extra blank line generated in some rare cases #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solve #23: header with extra blank line generated in some rare cases #24
Conversation
978f565 to
f9aee05
Compare
dkim/header_test.go
Outdated
| } | ||
|
|
||
| func TestFoldHeaderField(t *testing.T) { | ||
| header := `DKIM-Signature: a=rsa-sha256; bh=bvW0aiEWdP0ie2rawBb+IiTxlHI9KgEIYjEYTGzMRa0=; c=simple/simple; d=test.xxxxxxxxxx.xxxxx; h=Return-Path:From:To:Subject:Message-ID:Date; s=brisbane; t=1583859773; v=1; b=IIlaZ79pLDdypX2YzJuy9EvxsbrqF360CLhkQqMqVC/GIa1K/X8p8POny7WuVuFTMHLvA1zH9YcXgEgIH+X0GgGsqqzq8ETL+QGZ9g1EKCmIg+ZEYV5JnH25Ar6bJpGra3jg6sIxKi6CthpK50kd8T0Q3K/oZGot4BkLaPqogpo=;` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment among these lines:
The header field length is a multiple of 75. See #23
So that we don't forget about the reason why we have this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! Maybe it is better to create a fake header with a minimum length that generates the issue! What do you think?
dkim/header_test.go
Outdated
| func TestFoldHeaderField(t *testing.T) { | ||
| header := `DKIM-Signature: a=rsa-sha256; bh=bvW0aiEWdP0ie2rawBb+IiTxlHI9KgEIYjEYTGzMRa0=; c=simple/simple; d=test.xxxxxxxxxx.xxxxx; h=Return-Path:From:To:Subject:Message-ID:Date; s=brisbane; t=1583859773; v=1; b=IIlaZ79pLDdypX2YzJuy9EvxsbrqF360CLhkQqMqVC/GIa1K/X8p8POny7WuVuFTMHLvA1zH9YcXgEgIH+X0GgGsqqzq8ETL+QGZ9g1EKCmIg+ZEYV5JnH25Ar6bJpGra3jg6sIxKi6CthpK50kd8T0Q3K/oZGot4BkLaPqogpo=;` | ||
| folded := foldHeaderField(header) | ||
| if strings.HasSuffix(folded, "\r\n \n") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, can we just compare the result with the expected result? (Add a string including the \r\n sequences each 75 chars)
That way, if it breaks differently, we'll know too.
|
The issue is generated when
|
99b14e1 to
83b409a
Compare
Codecov Report
@@ Coverage Diff @@
## master #24 +/- ##
=======================================
Coverage 66.50% 66.50%
=======================================
Files 7 7
Lines 827 827
=======================================
Hits 550 550
Misses 208 208
Partials 69 69
Continue to review full report at Codecov.
|
83b409a to
bf7c84c
Compare
emersion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Closes #23