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)
Index: src/daemon/connection.c
===================================================================
--- src/daemon/connection.c (revision 16871)
+++ src/daemon/connection.c (working copy)
@@ -238,7 +238,8 @@
(response == NULL) ||
(connection->response != NULL) ||
((connection->state != MHD_CONNECTION_HEADERS_PROCESSED) &&
- (connection->state != MHD_CONNECTION_FOOTERS_RECEIVED)))
+ (connection->state != MHD_CONNECTION_FOOTERS_RECEIVED) &&
+ (connection->state != MHD_CONNECTION_CONTINUE_SENT)))
return MHD_NO;
MHD_increment_response_rc (response);
connection->response = response;
signature.asc
Description: Digital signature
