cesanta/mongoose — pull request #313 by xant (2014-01-31 18:16:17+00:00)
Title: bugfix: set the correct status if we still have pending data

A request handler can return MG_REQUEST_PROCESSED after writing some data
which might be still pending so 'close' should be postponed until the buffer has been emptied
(later in write_to_socket()).

This happens especially with long running connections (CONN_LONG_RUNNING) which
can queue multiple chunks of data (using either mg_write() or mg_send_data()) when providing a big response.
Returning MG_REQUEST_PROCESSED once done shouldn't immediately close the connection
if there is still data queued in the internal io buffer.