Next: , Previous: microhttpd-response create, Up: microhttpd-responses


8.3 Adding headers to a response

— Function: int MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content)

Add a header line to the response. The strings referenced by header and content must be zero-terminated and they are duplicated into memory blocks embedded in response.

Notice that the strings must not hold newlines, carriage returns or tab chars.

Return MHD_NO on error (i.e. invalid header or content format or memory allocation error).

— Function: int MHD_add_response_footer (struct MHD_Response *response, const char *footer, const char *content)

Add a footer line to the response. The strings referenced by footer and content must be zero-terminated and they are duplicated into memory blocks embedded in response.

Notice that the strings must not hold newlines, carriage returns or tab chars. You can add response footers at any time before signalling the end of the response to MHD (not just before calling 'MHD_queue_response'). Footers are useful for adding cryptographic checksums to the reply or to signal errors encountered during data generation. This call was introduced in MHD 0.9.3.

Return MHD_NO on error (i.e. invalid header or content format or memory allocation error).

— Function: int MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content)

Delete a header (or footer) line from the response. Return MHD_NO on error (arguments are invalid or no such header known).