-
Notifications
You must be signed in to change notification settings - Fork 381
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
V1F: Read end-of-chunk as part of the chunk #3811
base: master
Are you sure you want to change the base?
Conversation
I'm pretty sure we implemented it the current way to cater to some bogus implementation of chunked, but that would be more than 14 years ago, so one would hope that it no longer applies. |
cb42ca1
to
464962a
Compare
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.
Could you maybe split this change into two commits? One to move the end-of-chunk parsing to its own function, and one to use that function in another code path (with the test case update).
e06adf8
to
0c85ddc
Compare
phk OK via bugwash |
martin said -1 |
@mbgrydeland raised the concern that waiting for the chunk end [CR]LF could increase latency, in particular if that final byte was sent in another packet. |
Until now, we read the (CR)?LF at the end of a chunk as part of the next chunk header (see: /* Skip leading whitespace */). For a follow up commit, we are going to want to know if the next chunk header is available for read, so we now consume the chunk end as part of the chunk itself. This also fixes a corner case: We previously accepted chunks with a missing end-of-chunk (see fix of r01729.vtc). Ref: https://datatracker.ietf.org/doc/html/rfc7230#section-4.1
0c85ddc
to
4c1aa2a
Compare
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.
I don't like the change of behaviour this patch brings with it. Up to now we have always passed on the bytes as soon as we receive them. With this patch, we will change behaviour at the chunk boundries and require to see the chunk end before passing the last byte on up the VFP stack.
This will possibly have a minor latency increase in some corner cases (last chunk byte and chunk end in different packets). But more importantly, for (silly?) backends not sending the end chunk bytes right away in a long-polling scenario appear as a stuck connection.
Also for an outside observer, and where there may be proxies outside of their control involved, the difference in behaviour at different byte boundries will make for hard debugging.
I think a cleaner way to achieve the wanted outcome would be to introduce a new state for the chunked VFP. Ie priv2 == -2
, we are waiting for the chunk end, and only after having received that do we set priv2 == -1
to indicate we are to parse the next chunked header. With this the VFP wouldn't have to block waiting for the chunk end, but know to require it first on the next call.
@mbgrydeland thank you for your constructive suggestion, something like this seems sensible to require the [CR]LF at the end of the chunk for the case where As laid out in #3811 (comment), I think we do need a way to get @mbgrydeland what do you think about this?
|
Taken from #3809 as requested by @bsdphk
Until now, we read the (CR)?LF at the end of a chunk as part of the next chunk header (see:
/* Skip leading whitespace */
).For a follow up commit, we are going to want to know if the next chunk header is available for read, so we now consume the chunk end as part of the chunk itself.
This also fixes a corner case: We previously accepted chunks with a missing end-of-chunk (see fix of r01729.vtc).
Ref: https://datatracker.ietf.org/doc/html/rfc7230#section-4.1