Methods for managing response objects. More...
#include "internal.h"
#include "response.h"
Go to the source code of this file.
Functions | |
int | MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) |
int | MHD_del_response_header (struct MHD_Response *response, const char *header, const char *content) |
int | MHD_get_response_headers (struct MHD_Response *response, MHD_KeyValueIterator iterator, void *iterator_cls) |
const char * | MHD_get_response_header (struct MHD_Response *response, const char *key) |
struct MHD_Response * | MHD_create_response_from_callback (uint64_t size, size_t block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc) |
struct MHD_Response * | MHD_create_response_from_data (size_t size, void *data, int must_free, int must_copy) |
void | MHD_destroy_response (struct MHD_Response *response) |
void | MHD_increment_response_rc (struct MHD_Response *response) |
Methods for managing response objects.
Definition in file response.c.
int MHD_add_response_header | ( | struct MHD_Response * | response, | |
const char * | header, | |||
const char * | content | |||
) |
Add a header line to the response.
Definition at line 36 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_HEADER_KIND, MHD_NO, MHD_YES, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.
Referenced by add_extra_headers().
struct MHD_Response* MHD_create_response_from_callback | ( | uint64_t | size, | |
size_t | block_size, | |||
MHD_ContentReaderCallback | crc, | |||
void * | crc_cls, | |||
MHD_ContentReaderFreeCallback | crfc | |||
) | [read] |
Create a response object. The response object can be extended with header information and then be used any number of times.
size | size of the data portion of the response, -1 for unknown | |
block_size | preferred block size for querying crc (advisory only, MHD may still call crc using smaller chunks); this is essentially the buffer size used for IO, clients should pick a value that is appropriate for IO and memory performance requirements | |
crc | callback to use to obtain response data | |
crc_cls | extra argument to crc | |
crfc | callback to call to free crc_cls resources |
Definition at line 178 of file response.c.
References MHD_Response::crc, MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_buffer_size, MHD_BUF_INC_SIZE, MHD_Response::mutex, MHD_Response::reference_count, and MHD_Response::total_size.
struct MHD_Response* MHD_create_response_from_data | ( | size_t | size, | |
void * | data, | |||
int | must_free, | |||
int | must_copy | |||
) | [read] |
Create a response object. The response object can be extended with header information and then be used any number of times.
size | size of the data portion of the response | |
data | the data itself | |
must_free | libmicrohttpd should free data when done | |
must_copy | libmicrohttpd must make a copy of data right away, the data maybe released anytime after this call returns |
Definition at line 220 of file response.c.
References MHD_Response::crc, MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_size, MHD_Response::mutex, MHD_Response::reference_count, and MHD_Response::total_size.
Referenced by parse_connection_headers(), and transmit_error_response().
int MHD_del_response_header | ( | struct MHD_Response * | response, | |
const char * | header, | |||
const char * | content | |||
) |
Delete a header line from the response.
Definition at line 80 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_NO, MHD_YES, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.
void MHD_destroy_response | ( | struct MHD_Response * | response | ) |
Destroy a response object and associated resources. Note that libmicrohttpd may keep some of the resources around if the response is still in the queue for some clients, so the memory may not necessarily be freed immediatley.
Definition at line 266 of file response.c.
References MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::first_header, MHD_HTTP_Header::header, MHD_Response::mutex, MHD_HTTP_Header::next, MHD_Response::reference_count, and MHD_HTTP_Header::value.
Referenced by MHD_cleanup_connections(), MHD_connection_handle_idle(), parse_connection_headers(), and transmit_error_response().
const char* MHD_get_response_header | ( | struct MHD_Response * | response, | |
const char * | key | |||
) |
Get a particular header from the response.
key | which header to get |
Definition at line 145 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.
Referenced by add_extra_headers(), and build_header_response().
int MHD_get_response_headers | ( | struct MHD_Response * | response, | |
MHD_KeyValueIterator | iterator, | |||
void * | iterator_cls | |||
) |
Get all of the headers added to a response.
iterator | callback to call on each header; maybe NULL (then just count headers) | |
iterator_cls | extra argument to iterator |
Definition at line 119 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_YES, MHD_HTTP_Header::next, and MHD_HTTP_Header::value.
void MHD_increment_response_rc | ( | struct MHD_Response * | response | ) |
Increment response RC. Should this be part of the public API?
Definition at line 295 of file response.c.
References MHD_Response::mutex, and MHD_Response::reference_count.
Referenced by MHD_queue_response().