[erlang-patches] fix for OTP-9389 "Allow longer lines in http packet protocol with gen_tcp"

Henrik Nord <>
Mon Nov 28 15:59:55 CET 2011


On 11/25/2011 11:08 PM, Steve Vinoski wrote:
> git fetch git://github.com/vinoski/otp.git sv-OTP-9389
>
> You can see the diffs here:
>
> https://github.com/vinoski/otp/commit/7a923ed4b89db4ebce31dedd83cb156907196598
>
> This patch fixes OTP-9389 by allowing an application to set
> packet_size to control the length of HTTP header lines it's willing to
> accept. Without this fix, applications trying to receive long HTTP
> header lines get unexpected errors, as described in this
> erlang-questions thread:
>
> http://erlang.org/pipermail/erlang-questions/2011-June/059563.html
>
> This patch leaves the original default behavior in place, so as not to
> break backward compatibility. With this change, if an app sets
> packet_size while in http, httph, http_bin, or httph_bin packet
> parsing mode, and an HTTP header line is received that exceeds the
> default TCP buffer size (1460 bytes), the packet parser tells the TCP
> code to realloc the buffer to a larger size to receive the longer
> header line. As long as the line in question does not exceed the
> packet_size setting, it will be received and parsed properly. If it's
> too long, the caller gets an error. Note that realloc occurs only when
> needed.
>
> Also fix the http parsing code to honor line_length, which is
> documented under erlang:decode_packet but was not fully implemented.
>
> Also add support for packet_size for line parsing mode, for consistency.
>
> Add regression tests.
>
> You can read more details in the commit message.
>
> Many thanks to Sverker Eriksson for his guidance on creating this
> patch and for reviewing several patch attempts prior to this one.
>
> --steve
> _______________________________________________
> erlang-patches mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-patches
Thank you for the contribution!

I have included this in 'pu', and sofar no issues

-- 
/Henrik Nord Erlang/OTP



More information about the erlang-patches mailing list