keplerproject / wsapi

WSAPI is an API that abstracts the web server from Lua web applications.
http://keplerproject.github.io/wsapi
74 stars 33 forks source link

validate res_iter before writing to lfcgi.stdout #26

Open rafis opened 11 years ago

rafis commented 11 years ago

[Feature request] Add new parameter t.validate_before_output or t.one_chunk_output or t.complete_output_only, where t is second parameter of _M.run(). If the parameter set and equal to true this will run additional step of res_iter validation storing output in temporary table before actual sending output to lfcgi.stdout. After validation succeeded send stored table using table.concat(). If validation failed then call send_error().

This addition will prevent cases there half of page being outputted and then ======== WSAPI ERROR DURING RESPONSE PROCESSING:.

Or maybe this can be considered as PHP ob_start()/ob_end()/ob_flush() feature.