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

Reply via email to