forked from hyperium/hyper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix chunk size parsing: handle invalid chunk sizes
Currently, when the chunk size was an invalid hex number (i.e. contained a non-HEX octet), hyper would halt its parsing at the last valid hex digit and report this as the chunk size. For example, the following would be the chunk sizes reported for some strings: "X" => 0 "1X" => 1 "aY" => 10 "a;a" => 10 (only this should be correct!) This fix makes it so that any chunk size, which cannot be parsed as a valid hex number, causes an IoError. Additionally, the case where the chunk size is followed by a chunk extension is also handled (since the ";" token is a valid delimiter between the chunk size and, as such, along with a LWS octet, represents a valid terminal character of the chunk size). Regression tests for the `get_chunk_size` function and included.
- Loading branch information
Showing
1 changed file
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters