[erlang-questions] packet_size option of decode_packet

Benoit Chesneau bchesneau@REDACTED
Thu Jun 6 15:53:57 CEST 2013

The doc says :

{packet_size, integer()}
Sets the max allowed size of the packet body. If the packet header
indicates that the length of the packet is longer than the max allowed
length, the packet is considered invalid. Default is 0 which means no
size limit.

But I wonder what does it means for http parsing.

If I do

{ok, Data} = gen_tcp:recv(Socket, 0, infinity),
decode_packet(http_bin, Data, [{packet_size, 4096}]).

What would happen if bytes_size(Data) > 4096 but the request line
itself only take 1024 bytes ?

- benoit

More information about the erlang-questions mailing list