Dea Avner,
I assume you are talking about a file *upload*, from the client to your
HTTP server. In this case, the HTTP protocol only allows you to queue a
response either before the upload has started (after receiving the
header and before the server responds with 100 continue) or after the
upload is complete. libmicrohttpd supports returning 400 in both of
these cases. Returning 400 before the client is done with the upload is
against the specification and thus not supported.
If possible, you should see if you can detect the failure just based on
the client's HTTP header and return 400 immediately.
Happy hacking!
Christian
On 8/31/23 20:18, Avner Flesch wrote:
Hi,
I am implementing file download with libmicrohttpd.
Now I am wondering - in case I have a failure during the download, is
there an option to terminate the session with a response, or should I
wait to get all the file parts, and just then send the response
with code "400"?
When I am returning "MHD_NO" it terminates the connection, and the
response is not sent at all.
Any suggestions?
Thanks
Avner