Turbo is a framework built for LuaJIT 2 to simplify the task of building fast and scalable network applications. It uses a event-driven, non-blocking, no thread design to deliver excellent performance and minimal footprint to high-load applications while also providing excellent support for embedded uses.
When we are expecting next request (Connection: keep-alive) it is
possible '_initial_read()' will not gather any data because they are not
in the socket yet so expected HTTP header will not be found. Hence data
will be read to buffer from event handler. But in '_handle_read()' data
are read to buffer until EWOULDBLOCK appears before it calls
'_read_from_buffer()' again. So when request body is big it is possible
it will not fit into buffer which is prepared just for header size
(1024*18).
The solution is to call '_read_from_buffer()' every time when new data
are pushed to buffer.
When we are expecting next request (Connection: keep-alive) it is possible '_initial_read()' will not gather any data because they are not in the socket yet so expected HTTP header will not be found. Hence data will be read to buffer from event handler. But in '_handle_read()' data are read to buffer until EWOULDBLOCK appears before it calls '_read_from_buffer()' again. So when request body is big it is possible it will not fit into buffer which is prepared just for header size (1024*18).
The solution is to call '_read_from_buffer()' every time when new data are pushed to buffer.