[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] Problems using PATCH method

From: Conor Lennon
Subject: [libmicrohttpd] Problems using PATCH method
Date: Wed, 22 Jan 2020 16:44:49 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2


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_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,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]