[erlang-questions] gen_tcp, {packet, http}, and recieve buffer size

Eric Merritt <>
Fri Sep 29 03:08:03 CEST 2006

> You can set the recbuf option when creating the TCP port to more than
> 1024 by including e.g. {recbuf, 8192} in the gen_tcp:connect options.
> This allows lines of up to 8K in the HTTP Headers. The problem you've
> seen not only affects the Request URI, but any long line in the HTTP
> header. (e.g. I've hit this limit with large cookies).
> Note: This doesn't work for SSL (since the ssl module dis-allows
> 'recbuf'). If you think this may be a problem, here is one fix:
> In the Erlang/OTP source directory, edit the file:
> ./erts/emulator/drivers/common/inet_drv.c
> Change
>    #define INET_DEF_BUFFER     1024        /* default buffer size */
> To:
>    #define INET_DEF_BUFFER     (1024*8)        /* default buffer size */
> Then recompile Erlang/OTP and re-install.

  Does it not seem problematic though that parsing should fail when
you run out of data instead of simply attempting to get more data to
parse. This seems pretty broken to me.

More information about the erlang-questions mailing list