libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Terminate session with response


From: Christian Grothoff
Subject: Re: [libmicrohttpd] Terminate session with response
Date: Thu, 31 Aug 2023 20:31:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]