[erlang-patches] fix for OTP-9389 "Allow longer lines in http packet protocol with gen_tcp"
Fri Nov 25 23:08:53 CET 2011
git fetch git://github.com/vinoski/otp.git sv-OTP-9389
You can see the diffs here:
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
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
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.
More information about the erlang-patches