HTTP chunked encoding patch
Bernard Duggan
bernie@REDACTED
Fri Nov 27 10:47:48 CET 2009
Hi,
We had to make a slight modification to Erlang's handling of chunked
encoding to make it play nicely a system we have here. The problem is
this: We're using HTTP chunked encoding to implement a long term
connection where status updates are periodically sent as http chunks. My
understanding is that this is a bit of an abuse of the system (I didn't
come up with it, I swear), but that it's also not an especially uncommon
one. Each status update is a full chunk with the size and complete body.
The problem is that the HTTP library won't forward on a chunk to the
client process until the size field for the following chunk has been
received, due to it wanting to check if it's the last chunk (indicated
by the next size field being 0).
The net effect is that we can't extract a status update chunk until
the next one arrives (which won't be until some indeterminate time in
the future). The attached patch makes a small modification to forward
any full chunk received, regardless of whether the size field for the
following chunk has been received yet.
I originally submitted this back in the 12B-5 days, but never had a
response so I thought I'd give the new git system a whirl :)
My sincere apologies if I've screwed something up - I've never used git
nor github before...
Assuming I got it all right, you should be able to grab the patch
with something like:
git fetch git://github.com/bernardd/otp.git http_chunk_fix
...I hope :)
Cheers,
Bernard
More information about the erlang-patches
mailing list