[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] MHD_queue_response return error
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] MHD_queue_response return error |
Date: |
Mon, 22 May 2023 22:07:22 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 |
Yes, you MUST NOT queue a response while *upload_data_size is non-null
when you are being called (as the upload may still continue)! MHD will
call you one "final" time with a zero *upload_data_size, and *then* you
should queue your response.
To summarize, you MAY queue a response either:
1) on the very first call when *upload_data_size is 0 to return an error
and NOT have the client to the upload (e.g. 4xx/5xx), or
2) on the very last call when *upload_data_size is again 0 to return a
successful reply.
If you attempt to queue a response when you were called with a non-zero
*upload_data_size, MHD will not be happy. And yes, you should update
*upload_data_size to reflect the number of bytes left to process, but
setting it to 0 does not permit you to immediately queue a response.
I hope this helps!
Happy hacking!
Christian
On 5/22/23 22:01, Avner Flesch wrote:
Hi,
Maybe someone can help me:
When I am getting a "POST" request without content - everything is okay,
but when I am putting some content in the request, the
MHD_queue_response return MHD_NO (and I set *upload_data_size to 0)
Any advice?
Thanks
Avner