On 04/16/15 16:38, [email protected] wrote:
> HI,
> 
> May I suggest two other fixes related to that issue:
> 1) When the loop info is set to MHD_EVENT_LOOP_INFO_CLEANUP, we should
> not wait for the timeout as we want to release the thread and the
> ressources ASAP.
> I suggest to add
>         /* When a connection needs clean up, we have to do it now */
>         timeout = 0;
> at daemon.c:2417 (SVN 35535)

Sure, this makes sense.
=> SVN 35538.

> 2) When the MHD has determined that the connections has timed out, we
> should send 408 to the client
> I suggest to add
>       transmit_error_response (connection, MHD_HTTP_REQUEST_TIMEOUT, "");
>       connection->write_handler (connection);
> at connection.c:2646 (SVN 35532)

That's not quite OK in my view. MHD timeout semantic is to close the
connection. Just queuing a reply doesn't work as we then need to spend
extra time to send the timeout reply, and it is quite conceivable that
the issue was client-side anyway.

If you want to send a timeout like this, my suggestion would be to
configure the MHD timeout at X and queue this reply in the application
logic at X-1s if you find out that your application is too slow to
produce the reply in a timely fashion.  That'll also enable sending a
more detailed timeout response with a more reasonable body.


Happy hacking!

Christian

Reply via email to