Hi, I have an application which tries to call [1] MHD_queue_response(..., MHD_HTTP_PAYLOAD_TOO_LARGE, ...) when received data is deemed to large. Unfortunately MHD_queue_response() always returns MHD_NO. connection->state is MHD_CONNECTION_CONTINUE_SENT at the time of this call, so the first check in MHD_queue_response() fails. The callback function gets the error back from MHD_queue_response() and propagates that, and the whole connection is aborted with "Application reported internal error, closing connection.".
In this case waiting until the all of the input data has been read is not an attractive option (the data is potentially large and we don't want to waste sender or receiver time to pass bytes that will be discarded anyway). Is sending an error "in the middle" like this not supported at all? It would be really nice if the client would get the 413 code with the informative message. Thanks, Zbyszek [1] https://github.com/systemd/systemd/blob/master/src/journal-remote/journal-remote-main.c#L220
