Skip to content

Conversation

@legionth
Copy link
Contributor

Thanks to @maciejmrozinski that found this behavior in the http-client(link to PR).

According to https://tools.ietf.org/html/rfc7230#section-4.1

chunk-size = 1*HEXDIG
last-chunk = 1*("0") [ chunk-ext ] CRLF

leading zeros are allowed as value for the header of each chunk.
So e.g. 0005 00ab and 000000 are valid values.

Currently this will lead to an error event, because hexdec and dechex will remove the leading zeros, so the assertion will fail. This PR takes care of this problem and will allow leading zeros.

@legionth legionth changed the title Leading zeros in chunked decoding are allowed Trim leading zeros of chunk headers in ChunkedDecoder Feb 28, 2017
Copy link
Member

@clue clue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Also thanks for the background links! 👍

@clue clue added the bug label Mar 1, 2017
@clue clue added this to the v0.6.0 milestone Mar 1, 2017
@WyriHaximus WyriHaximus requested a review from jsor March 1, 2017 08:17
@WyriHaximus WyriHaximus merged commit 72cb0b3 into reactphp:master Mar 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants