Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Return an error rather than panicking when HeaderName is too long #433
Conversation
Fixes #432. This eliminates an undocumented panic from the `HeaderName` creation functions, returning instead an `InvalidHeaderName` when the name length exceeds `MAX_HEADER_NAME_LEN`. I considered making `InvalidHeaderName` a richer error type, but since it was already used for another type of length error (rejecting zero-length names) I figured it was okay to reuse. I also redefined `MAX_HEADER_NAME_LEN` slightly, so that it is equal to the largest allowed header length, rather than one past that value. This was motivated by discovering a bug in my comparison logic when I went to write the new test exercising the wrong-length error conditions.
|
Seems fine to me, thanks! |
Fixes #432.
This eliminates an undocumented panic from the
HeaderNamecreation functions, returning instead anInvalidHeaderNamewhen the name length exceedsMAX_HEADER_NAME_LEN.I considered making
InvalidHeaderNamea richer error type, but since it was already used for another type of length error (rejecting zero-length names) I figured it was okay to reuse.I also redefined
MAX_HEADER_NAME_LENslightly, so that it is equal to the largest allowed header length, rather than one past that value. This was motivated by discovering a bug in my comparison logic when I went to write the new test exercising the wrong-length error conditions.