-
Notifications
You must be signed in to change notification settings - Fork 122
Add error on invalid header name characters #69
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
Conversation
Textproto should throw an error and fail to parse a header if it contains an invalid rather than preserving it as-is. References: #68
Codecov Report
@@ Coverage Diff @@
## master #69 +/- ##
==========================================
+ Coverage 62% 62.54% +0.53%
==========================================
Files 15 15
Lines 858 865 +7
==========================================
+ Hits 532 541 +9
+ Misses 280 279 -1
+ Partials 46 45 -1
Continue to review full report at Codecov.
|
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.
Thanks for you pull request! You're right, we should validate the header key against RFC 5322 here.
This code originally comes from Go's stdlib, which I guess implemented it for HTTP. This is why there are references to HTTP's RFC, although we should reference RFC 5322 instead. tl;dr historical raisins as some say.
The gist of the PR LGTM, here are a few comments.
|
I’ll address these changes as soon as I can — probably tomorrow evening. Thanks! |
Minor mostly cosmetic changes based on PR comments Restructuring test case -- removing string check
|
OK, I think I fixed everything you mentioned! :) |
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!
Textproto should throw an error and fail to parse a header if it
contains an invalid rather than preserving it as-is.
References: #68
I have very little Go experience, so let me know if there's any issues with this fix or if anything is non-idiomatic. I'm happy to clean things up :)