Closed Xxproner closed 2 months ago
I dived into sources and find what I wanted purely. MHD_RF_HEAD_ONLY_RESPONSE
- MHD_ResponseFlags. It works. But it was not listed in releases decribtion. Thx for improving the library.
Best wishes, Xxproner
I dived into sources and find what I wanted purely.
MHD_RF_HEAD_ONLY_RESPONSE
- MHD_ResponseFlags. It works. But it was not listed in releases decribtion.
That's absolutely correct.
You need an empty (zero length) response to be able to set MHD_RF_HEAD_ONLY_RESPONSE
.
This feature was recently added to the lib and not yet documented in examples and the manual.
However, it is fully documented in the doxy:
https://github.com/Karlson2k/libmicrohttpd/blob/v1.0.1/src/include/microhttpd.h#L3720-L3728
https://github.com/Karlson2k/libmicrohttpd/blob/v1.0.1/src/include/microhttpd.h#L3872-L3887
You can even use a shortcut, like
response = MHD_create_response_empty(MHD_RF_HEAD_ONLY_RESPONSE);
Unfortunately, non-doxy documentation is not fully updated. I suggest using doxy in the headers for the latest information.
Thx for improving the library.
You are welcome. The best is yet to come! :)
If I should answer to HEAD method. It is not possible to prevent setting Content-Length header. MHD considers that "it is possible and allowed" (src: https://www.gnu.org/software/libmicrohttpd/manual/libmicrohttpd.html#microhttpd_002dresponse-headers). I will be grateful if you help me with it. Or add new functional to MHD. For example.
MHD_USE_SUPPRESS_CONTENT_LENGTH
MHD_FLAG that prevent setting the header by MHD at all or MHD_ResponseOptions -MHD_SUPPRESS_CONTENT_LENGTH
- for a response. If it takes care, I can do it.Thank you)