Hi Conor, I've tried to test this, and could not find an issue. You can find a new test case for MHD's PATCH handling in Git, as per change b8a0f698..2d4289dc. However, as the test worked instantly, I could not find any bug with it.
The special handling of PUT/POST you mention likely refers to MHD's handling for "100 CONTINUE". So sure, if you rely on "100 CONTINUE" that likely only works with PUT/POST. My main idea as to what you might be doing wrong is queuing a response before the upload is complete. With PUT/POST and "Expect: 100- continue", this is supported by MHD. For other methods, you must wait until you have received the full upload (if there is one) and only then queue the response. I suggest you look at the new 'test_patch.c', and if that doesn't help, please send us some running minimal example to reproduce your issue. Happy hacking! Christian On Wed, 2020-01-22 at 16:44 +0000, Conor Lennon via libmicrohttpd wrote: > Hi, > > I'm using libmicrohttpd 0.9.63. > > Looking at the libmicrohttpd code, I don't think the behaviour has > changed since then. > > I'm investigating a problem that I'm having with a PATCH request. > > It's being handled differently from a PUT request. > > I'm using the following to send a response to the request: > > #define FORBIDDEN "{\"error_text\": \"Permission Denied\"}" > struct MHD_Response *response=NULL; > response = MHD_create_response_from_buffer(strlen (FORBIDDEN), > (void *) FORBIDDEN, > MHD_RESPMEM_PERSISTENT); > MHD_add_response_header(response, "Content-Type", > "application/json"); > ret = MHD_queue_response (connection, MHD_HTTP_FORBIDDEN, response); > MHD_destroy_response (response); > > For a PUT request, the client is getting the response. > > However, with a PATCH request, the client is not getting a response. > > I'm using curl as the HTTP client. > > Looking at the MHD_connection_handle_idle function > src/microhttpd/connection.c I can see that the POST and PUT methods > are > handled differently to everything else (e.g. when the state is > MHD_CONNECTION_HEADERS_PROCESSED) > > Is there a reason for that? > > Should I be calling some other function to better handle the PATCH > method? > > I get similar behaviour with a random method when I send data. > > Looking at the examples that libmicrohttpd comes with, I don't see > any methods being used other than GET, HEAD and POST. > > Thanks in advance, > > Conor >