Dear Peter,
I suspect you're simply queueing your response too early. The API may
not be 100%-intuitive here: if you have an upload (and did not replace
the 100-CONTINUE with an error), you need to wait for MHD to call you
with an '*upload_size' of zero before giving your response. From what
you write about the state we're at, your code does not do this.
We have an extensive example for handling posts in the documentation
(src/examples/post_example.c), please look at that one first.
Happy hacking!
Christian
On 09/18/2011 04:49 AM, Peter Ross wrote:
Hi,
When responding to a POST request with application/octet-stream content I am
finding
that MHD_queue_response fails. Usage example below.
Digging inside libmicrphttpd, the queue_response fails because the
connection->state is
MHD_CONNECTION_CONTINUE_SENT. The connection in this instance does not use HTTP
100 continues.
The enclosed patch fixes the behaviour.
---
AccessHandlerCallback(...)
if (!strcmp(method,"POST")&& !partial_strcmp_left(url,"/process")) {
/* On the first callback interation, *upload_data_size is zero.
Upon second iteration, it is non-zero and contains 48-byte message
*/
if (!*upload_data_size)
return MHD_YES;
/* process upload_data.. */
rsp = MHD_create_response_from_data(sizeof(response), response,
MHD_NO, MHD_NO);
ret = MHD_queue_response(connection, MHD_HTTP_OK, rsp);
}
---
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)