[erlang-questions] gen_tcp and large HTTP headers

Max Lapshin max.lapshin@REDACTED
Fri Jun 24 22:22:51 CEST 2011

I have just thought, that proper web server should always use
packet_decode, rather than {mode, http}.

I'm currently trying to implement input of POST body as a stream and
understood very bad thing:
if client send second request very fast after sending first, it may
happens so, that post body will come to
us in the same packet with beginning of next header.

If Content-Length is 2900 bytes, it may be such situation:

1400 bytes of post body
1400 bytes of post body
100 bytes of post body + 1000 bytes of next request.

The only way to parse it is to keep buffer in web-server process and
use erlang:decode_packet, because the second way is to do blocking

More information about the erlang-questions mailing list