GNU libmicrohttpd 0.9.77
|
Typedefs | |
typedef void(* | MHD_ContentReaderFreeCallback) (void *cls) |
Enumerations | |
enum | MHD_ResponseMemoryMode { MHD_RESPMEM_PERSISTENT , MHD_RESPMEM_MUST_FREE , MHD_RESPMEM_MUST_COPY } |
MHD API used to generate responses.
typedef void(* MHD_ContentReaderFreeCallback) (void *cls) |
This method is called by libmicrohttpd if we are done with a content reader. It should be used to free resources associated with the content reader.
cls | closure |
Definition at line 2612 of file microhttpd.h.
Specification for how MHD should treat the memory buffer given for the response.
Enumerator | |
---|---|
MHD_RESPMEM_PERSISTENT | Buffer is a persistent (static/global) buffer that won't change for at least the lifetime of the response, MHD should just use it, not free it, not copy it, just keep an alias to it. |
MHD_RESPMEM_MUST_FREE | Buffer is heap-allocated with |
MHD_RESPMEM_MUST_COPY | Buffer is in transient memory, but not on the heap (for example, on the stack or non- |
Definition at line 3438 of file microhttpd.h.
_MHD_DEPR_FUNC | ( | "Function MHD_create_response_from_fd_at_offset() is | deprecated, |
use MHD_create_response_from_fd_at_offset64()" | |||
) |
Create a response object with the content of provided file with specified offset used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
fd | file descriptor referring to a file on disk with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
offset | offset to start reading from in the file; Be careful! off_t may have been compiled to be a 64-bit variable for MHD, in which case your application also has to be compiled using the same options! Read the MHD manual for more details. |
_MHD_DEPR_FUNC | ( | "MHD_create_response_from_data() is | deprecated, |
use MHD_create_response_from_buffer()" | |||
) |
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 may be released anytime after this call returns |
enum MHD_Result MHD_add_response_footer | ( | struct MHD_Response * | response, |
const char * | footer, | ||
const char * | content | ||
) |
Add a footer line to the response.
response | response to remove a header from |
footer | the footer to delete |
content | value to delete |
Definition at line 571 of file response.c.
References add_response_entry(), and MHD_FOOTER_KIND.
enum MHD_Result MHD_add_response_header | ( | struct MHD_Response * | response, |
const char * | header, | ||
const char * | content | ||
) |
Add a header line to the response.
When reply is generated with queued response, some headers are generated automatically. Automatically generated headers are only sent to the client, but not added back to the response object.
The list of automatic headers:
response | the response to add a header to |
header | the header name to add, no need to be static, an internal copy will be created automatically |
content | the header value to add, no need to be static, an internal copy will be created automatically |
Definition at line 493 of file response.c.
References _MHD_remove_header, add_response_entry(), add_response_header_connection(), MHD_Response::flags, MHD_Response::flags_auto, MHD_HTTP_Header::header, mhd_assert, MHD_get_response_element_n_(), MHD_HEADER_KIND, MHD_HTTP_HEADER_CONNECTION, MHD_HTTP_HEADER_CONTENT_LENGTH, MHD_HTTP_HEADER_DATE, MHD_HTTP_HEADER_TRANSFER_ENCODING, MHD_NO, MHD_RAF_HAS_DATE_HDR, MHD_RAF_HAS_TRANS_ENC_CHUNKED, MHD_RF_INSANITY_HEADER_CONTENT_LENGTH, MHD_STATICSTR_LEN_, MHD_str_equal_caseless_(), MHD_YES, NULL, and MHD_HTTP_Header::value.
Referenced by MHD_queue_auth_fail_response2(), and MHD_queue_basic_auth_fail_response().
struct MHD_Response * MHD_create_response_from_buffer | ( | size_t | size, |
void * | buffer, | ||
enum MHD_ResponseMemoryMode | mode | ||
) |
Create a response object with the content of provided buffer used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
buffer | size bytes containing the response's data portion |
mode | flags for buffer management |
Definition at line 1312 of file response.c.
References MHD_create_response_from_data(), MHD_RESPMEM_MUST_COPY, and MHD_RESPMEM_MUST_FREE.
Referenced by transmit_error_response_len().
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_buffer_with_free_callback | ( | size_t | size, |
void * | buffer, | ||
MHD_ContentReaderFreeCallback | crfc | ||
) |
Create a response object with the content of provided buffer used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
buffer | size bytes containing the response's data portion |
crfc | function to call to free the buffer |
Create a response object with the content of provided buffer used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
buffer | size bytes containing the response's data portion |
crfc | function to call to free the buffer |
Definition at line 1341 of file response.c.
References MHD_Response::crfc, MHD_create_response_from_data(), MHD_NO, MHD_YES, and NULL.
Referenced by MHD_create_response_from_buffer_with_free_callback_cls().
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_buffer_with_free_callback_cls | ( | size_t | size, |
void * | buffer, | ||
MHD_ContentReaderFreeCallback | crfc, | ||
void * | crfc_cls | ||
) |
Create a response object with the content of provided buffer used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
buffer | size bytes containing the response's data portion |
crfc | function to call to cleanup, if set to NULL then callback is not called |
crfc_cls | an argument for crfc |
Definition at line 1380 of file response.c.
References MHD_Response::crc_cls, MHD_Response::crfc, MHD_create_response_from_buffer_with_free_callback(), and NULL.
struct MHD_Response * MHD_create_response_from_callback | ( | uint64_t | size, |
size_t | block_size, | ||
MHD_ContentReaderCallback | crc, | ||
void * | crc_cls, | ||
MHD_ContentReaderFreeCallback | crfc | ||
) |
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, MHD_SIZE_UNKNOWN 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 825 of file response.c.
References MHD_Response::crc, MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_buffer_size, MHD_Response::fd, MHD_calloc_(), MHD_mutex_init_, MHD_Response::mutex, NULL, MHD_Response::reference_count, and MHD_Response::total_size.
Referenced by MHD_create_response_from_fd_at_offset64(), and MHD_create_response_from_pipe().
struct MHD_Response * MHD_create_response_from_data | ( | size_t | size, |
void * | data, | ||
int | must_free, | ||
int | must_copy | ||
) |
Create a response object with the content of provided buffer used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
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 1241 of file response.c.
References MHD_Response::crc_cls, MHD_Response::crfc, data, MHD_Response::data, MHD_Response::data_buffer_size, MHD_Response::data_size, MHD_Response::fd, MHD_calloc_(), MHD_mutex_destroy_chk_, MHD_mutex_init_, MHD_SIZE_UNKNOWN, MHD_YES, must_copy, must_free, MHD_Response::mutex, NULL, MHD_Response::reference_count, and MHD_Response::total_size.
Referenced by MHD_create_response_from_buffer(), and MHD_create_response_from_buffer_with_free_callback().
struct MHD_Response * MHD_create_response_from_fd | ( | size_t | size, |
int | fd | ||
) |
Create a response object with the content of provided file used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
fd | file descriptor referring to a file on disk with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
Create a response object with the content of provided file used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
fd | file descriptor referring to a file on disk with the data |
Definition at line 1180 of file response.c.
References fd, and MHD_create_response_from_fd_at_offset64().
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_fd64 | ( | uint64_t | size, |
int | fd | ||
) |
Create a response object with the content of provided file used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response; sizes larger than 2 GiB may be not supported by OS or MHD build; see MHD_FEATURE_LARGE_FILE |
fd | file descriptor referring to a file on disk with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
Definition at line 1210 of file response.c.
References fd, and MHD_create_response_from_fd_at_offset64().
struct MHD_Response * MHD_create_response_from_fd_at_offset | ( | size_t | size, |
int | fd, | ||
off_t | offset | ||
) |
Create a response object with the content of provided file with specified offset used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response |
fd | file descriptor referring to a file on disk with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
offset | offset to start reading from in the file; Be careful! off_t may have been compiled to be a 64-bit variable for MHD, in which case your application also has to be compiled using the same options! Read the MHD manual for more details. |
Definition at line 1060 of file response.c.
References fd, MHD_create_response_from_fd_at_offset64(), and offset.
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_fd_at_offset64 | ( | uint64_t | size, |
int | fd, | ||
uint64_t | offset | ||
) |
Create a response object with the content of provided file with specified offset used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
size | size of the data portion of the response; sizes larger than 2 GiB may be not supported by OS or MHD build; see MHD_FEATURE_LARGE_FILE |
fd | file descriptor referring to a file on disk with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
offset | offset to start reading from in the file; reading file beyond 2 GiB may be not supported by OS or MHD build; see MHD_FEATURE_LARGE_FILE |
Definition at line 1094 of file response.c.
References MHD_Response::crc_cls, fd, MHD_Response::fd, MHD_Response::fd_off, file_reader(), free_callback(), INT32_MAX, MHD_Response::is_pipe, MHD_create_response_from_callback(), MHD_FILE_READ_BLOCK_SIZE, NULL, and offset.
Referenced by MHD_create_response_from_fd(), MHD_create_response_from_fd64(), and MHD_create_response_from_fd_at_offset().
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_iovec | ( | const struct MHD_IoVec * | iov, |
unsigned int | iovcnt, | ||
MHD_ContentReaderFreeCallback | free_cb, | ||
void * | cls | ||
) |
Create a response object with an array of memory buffers used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
iov | the array for response data buffers, an internal copy of this will be made |
iovcnt | the number of elements in iov |
free_cb | the callback to clean up any data associated with iov when the response is destroyed. |
cls | the argument passed to free_cb |
Create a response object with an array of memory buffers used as the response body.
The response object can be extended with header information and then be used any number of times.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
iov | the array for response data buffers, an internal copy of this will be made |
iovcnt | the number of elements in iov |
free_cb | the callback to clean up any data associated with iov when the response is destroyed. |
cls | the argument passed to free_cb |
< Index in the copy of iov
Definition at line 1417 of file response.c.
References MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_iov, MHD_Response::data_iovcnt, MHD_Response::data_size, MHD_Response::fd, MHD_IoVec::iov_base, MHD_IoVec::iov_len, mhd_assert, MHD_calloc_(), MHD_IOV_ELMN_MAX_SIZE, MHD_mutex_destroy_chk_, MHD_mutex_init_, MHD_Response::mutex, NULL, MHD_Response::reference_count, SSIZE_MAX, and MHD_Response::total_size.
_MHD_EXTERN struct MHD_Response * MHD_create_response_from_pipe | ( | int | fd | ) |
Create a response object with the response body created by reading the provided pipe.
The response object can be extended with header information and then be used ONLY ONCE.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
fd | file descriptor referring to a read-end of a pipe with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
Create a response object with the response body created by reading the provided pipe.
The response object can be extended with header information and then be used ONLY ONCE.
If response object is used to answer HEAD request then the body of the response is not used, while all headers (including automatic headers) are used.
fd | file descriptor referring to a read-end of a pipe with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
Definition at line 1145 of file response.c.
References MHD_Response::crc_cls, fd, MHD_Response::fd, free_callback(), MHD_Response::is_pipe, MHD_create_response_from_callback(), MHD_FILE_READ_BLOCK_SIZE, MHD_SIZE_UNKNOWN, NULL, and pipe_reader().
enum MHD_Result MHD_del_response_header | ( | struct MHD_Response * | response, |
const char * | header, | ||
const char * | content | ||
) |
Delete a header (or footer) line from the response.
For "Connection" headers this function remove all tokens from existing value. Successful result means that at least one token has been removed. If all tokens are removed from "Connection" header, the empty "Connection" header removed.
response | response to remove a header from |
header | the header to delete |
content | value to delete |
Definition at line 597 of file response.c.
References _MHD_remove_header, del_response_header_connection(), MHD_Response::first_header, MHD_Response::flags_auto, MHD_HTTP_Header::header, MHD_HTTP_Header::header_size, MHD_HTTP_HEADER_CONNECTION, MHD_HTTP_HEADER_DATE, MHD_HTTP_HEADER_TRANSFER_ENCODING, MHD_NO, MHD_RAF_HAS_CONNECTION_HDR, MHD_RAF_HAS_DATE_HDR, MHD_RAF_HAS_TRANS_ENC_CHUNKED, MHD_STATICSTR_LEN_, MHD_str_equal_caseless_bin_n_(), MHD_YES, MHD_HTTP_Header::next, NULL, MHD_HTTP_Header::value, and MHD_HTTP_Header::value_size.
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 immediately.
response | response to destroy |
Definition at line 1966 of file response.c.
References MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data_iov, MHD_Response::first_header, MHD_HTTP_Header::header, MHD_mutex_destroy_chk_, MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_Response::mutex, MHD_HTTP_Header::next, NULL, MHD_Response::reference_count, and MHD_HTTP_Header::value.
Referenced by cleanup_connection(), connection_reset(), MHD_cleanup_connections(), MHD_connection_close_(), MHD_connection_handle_idle(), and transmit_error_response_len().
struct MHD_HTTP_Header * MHD_get_response_element_n_ | ( | struct MHD_Response * | response, |
enum MHD_ValueKind | kind, | ||
const char * | key, | ||
size_t | key_len | ||
) |
Get a particular header (or footer) element from the response.
Function returns the first found element.
response | response to query |
kind | the kind of element: header or footer |
key | the key which header to get |
key_len | the length of the key |
Definition at line 732 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::header_size, MHD_HTTP_Header::kind, mhd_assert, MHD_str_equal_caseless_bin_n_(), MHD_HTTP_Header::next, and NULL.
Referenced by add_response_header_connection(), del_response_header_connection(), and MHD_add_response_header().
const char * MHD_get_response_header | ( | struct MHD_Response * | response, |
const char * | key | ||
) |
Get a particular header (or footer) from the response.
response | response to query |
key | which header to get |
Definition at line 698 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::header_size, MHD_str_equal_caseless_bin_n_(), MHD_HTTP_Header::next, NULL, and MHD_HTTP_Header::value.
int MHD_get_response_headers | ( | struct MHD_Response * | response, |
MHD_KeyValueIterator | iterator, | ||
void * | iterator_cls | ||
) |
Get all of the headers (and footers) added to a response.
response | response to query |
iterator | callback to call on each header; may be NULL (then just count headers) |
iterator_cls | extra argument to iterator |
Get all of the headers (and footers) added to a response.
response | response to query |
iterator | callback to call on each header; maybe NULL (then just count headers) |
iterator_cls | extra argument to iterator |
Definition at line 666 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_NO, MHD_HTTP_Header::next, NULL, and MHD_HTTP_Header::value.
enum MHD_Result MHD_queue_response | ( | struct MHD_Connection * | connection, |
unsigned int | status_code, | ||
struct MHD_Response * | response | ||
) |
Queue a response to be transmitted to the client (as soon as possible but after MHD_AccessHandlerCallback returns).
For any active connection this function must be called only by MHD_AccessHandlerCallback callback. For suspended connection this function can be called at any moment. Response will be sent as soon as connection is resumed.
connection | the connection identifying the client |
status_code | HTTP status code (i.e. MHD_HTTP_OK) |
response | response to transmit |
Definition at line 5078 of file connection.c.
References _, MHD_Connection::daemon, MHD_Connection::discard_request, MHD_Response::fd, MHD_Response::first_header, MHD_Response::flags, MHD_Response::flags_auto, MHD_HTTP_Header::header, MHD_Connection::http_mthd, MHD_Connection::http_ver, MHD_Connection::in_idle, MHD_Response::is_pipe, MHD_ALLOW_UPGRADE, mhd_assert, MHD_CONNECTION_FULL_REQ_RECEIVED, MHD_connection_handle_idle(), MHD_CONNECTION_HEADERS_PROCESSED, MHD_CONNECTION_START_REPLY, MHD_HTTP_HEADER_CONNECTION, MHD_HTTP_MTHD_HEAD, MHD_HTTP_NO_CONTENT, MHD_HTTP_NOT_MODIFIED, MHD_HTTP_OK, MHD_HTTP_SWITCHING_PROTOCOLS, MHD_HTTP_VER_1_0, MHD_ICY_FLAG, MHD_increment_response_rc(), MHD_IS_HTTP_VER_1_1_COMPAT, MHD_NO, MHD_RAF_HAS_CONNECTION_HDR, MHD_RF_HTTP_1_0_COMPATIBLE_STRICT, MHD_RF_HTTP_1_0_SERVER, MHD_SEND_SPIPE_SUPPRESS_NEEDED, MHD_str_equal_caseless_(), MHD_str_has_s_token_caseless_, MHD_update_last_activity_(), MHD_USE_INTERNAL_POLLING_THREAD, MHD_USE_TLS, MHD_YES, NULL, MHD_Daemon::options, MHD_Connection::pid, MHD_Connection::remaining_upload_size, MHD_Connection::response, MHD_Connection::response_write_position, MHD_Connection::responseCode, MHD_Daemon::shutdown, MHD_Daemon::sigpipe_blocked, MHD_Connection::sk_spipe_suppress, MHD_Connection::state, MHD_Connection::suspended, MHD_Response::total_size, and MHD_HTTP_Header::value.
Referenced by MHD_queue_auth_fail_response2(), MHD_queue_basic_auth_fail_response(), and transmit_error_response_len().
enum MHD_Bool MHD_response_add_header | ( | struct MHD_Response * | response, |
const char * | header, | ||
const char * | content | ||
) |
Add a header line to the response.
response | response to add a header to |
header | the header to add |
content | value to add |
Definition at line 125 of file response.c.
References add_response_entry(), MHD_HTTP_Header::header, MHD_HEADER_KIND, MHD_NO, and MHD_YES.
Referenced by MHD_response_for_upgrade().
enum MHD_Bool MHD_response_add_trailer | ( | struct MHD_Response * | response, |
const char * | footer, | ||
const char * | content | ||
) |
Add a tailer line to the response.
response | response to add a footer to |
footer | the footer to add |
content | value to add |
Definition at line 147 of file response.c.
References add_response_entry(), MHD_FOOTER_KIND, MHD_NO, and MHD_YES.
enum MHD_Bool MHD_response_del_header | ( | struct MHD_Response * | response, |
const char * | header, | ||
const char * | content | ||
) |
Delete a header (or footer) line from the response.
response | response to remove a header from |
header | the header to delete |
content | value to delete |
Definition at line 168 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_NO, MHD_YES, MHD_HTTP_Header::next, NULL, MHD_HTTP_Header::prev, and MHD_HTTP_Header::value.
struct MHD_Response * MHD_response_from_buffer | ( | enum MHD_HTTP_StatusCode | sc, |
size_t | size, | ||
void * | buffer, | ||
enum MHD_ResponseMemoryMode | mode | ||
) |
Create a response object. The response object can be extended with header information and then be used any number of times.
sc | status code to use for the response; MHD_HTTP_NO_CONTENT is only valid if size is 0; |
size | size of the data portion of the response |
buffer | size bytes containing the response's data portion |
mode | flags for buffer management |
Definition at line 41 of file response_from_buffer.c.
References MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_size, MHD_Response::fd, mhd_assert, MHD_calloc_(), MHD_mutex_destroy_chk_, MHD_mutex_init_, MHD_RESPMEM_MUST_COPY, MHD_RESPMEM_PERSISTENT, MHD_Response::mutex, NULL, MHD_Response::reference_count, MHD_Response::status_code, and MHD_Response::total_size.
Referenced by parse_request_headers(), and transmit_error_response().
struct MHD_Response * MHD_response_from_callback | ( | enum MHD_HTTP_StatusCode | sc, |
uint64_t | size, | ||
size_t | block_size, | ||
MHD_ContentReaderCallback | crc, | ||
void * | crc_cls, | ||
MHD_ContentReaderFreeCallback | crfc | ||
) |
Create a response action. The response object can be extended with header information and then be used any number of times.
sc | status code to return |
size | size of the data portion of the response, MHD_SIZE_UNKNOWN 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 46 of file response_from_callback.c.
References MHD_Response::crc, MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::data, MHD_Response::data_buffer_size, MHD_Response::fd, mhd_assert, MHD_calloc_(), MHD_mutex_init_, MHD_Response::mutex, NULL, MHD_Response::reference_count, MHD_Response::status_code, and MHD_Response::total_size.
Referenced by MHD_response_from_fd().
struct MHD_Response * MHD_response_from_fd | ( | enum MHD_HTTP_StatusCode | sc, |
int | fd, | ||
uint64_t | offset, | ||
uint64_t | size | ||
) |
Create a response object based on an fd from which data is read. The response object can be extended with header information and then be used any number of times.
sc | status code to return |
fd | file descriptor referring to a file on disk with the data; will be closed when response is destroyed; fd should be in 'blocking' mode |
offset | offset to start reading from in the file; reading file beyond 2 GiB may be not supported by OS or MHD build; see MHD_FEATURE_LARGE_FILE |
size | size of the data portion of the response; sizes larger than 2 GiB may be not supported by OS or MHD build; see MHD_FEATURE_LARGE_FILE |
Definition at line 176 of file response_from_fd.c.
References MHD_Response::crc_cls, fd, MHD_Response::fd, MHD_Response::fd_off, file_reader(), free_callback(), INT32_MAX, mhd_assert, MHD_FILE_READ_BLOCK_SIZE, MHD_response_from_callback(), NULL, and offset.
const char * MHD_response_get_header | ( | struct MHD_Response * | response, |
const char * | key | ||
) |
Get a particular header (or footer) from the response.
response | response to query |
key | which header to get |
Definition at line 243 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_str_equal_caseless_(), MHD_HTTP_Header::next, NULL, and MHD_HTTP_Header::value.
Referenced by build_header_response().
unsigned int MHD_response_get_headers | ( | struct MHD_Response * | response, |
MHD_KeyValueIterator | iterator, | ||
void * | iterator_cls | ||
) |
Get all of the headers (and footers) added to a response.
response | response to query |
iterator | callback to call on each header; maybe NULL (then just count headers) |
iterator_cls | extra argument to iterator |
Definition at line 211 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_YES, MHD_HTTP_Header::next, NULL, and MHD_HTTP_Header::value.
void MHD_response_queue_for_destroy | ( | struct MHD_Response * | response | ) |
Explicitly decrease reference counter of a response object. If the counter hits zero, destroys a response object and associated resources. Usually, this is implicitly done by converting a response to an action and returning the action to MHD.
response | response to decrement RC of |
Definition at line 88 of file response.c.
References MHD_Response::crc_cls, MHD_Response::crfc, MHD_Response::first_header, MHD_HTTP_Header::header, MHD_mutex_destroy_chk_, MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_Response::mutex, MHD_HTTP_Header::next, NULL, MHD_Response::reference_count, and MHD_HTTP_Header::value.
Referenced by cleanup_connection(), MHD_connection_cleanup_(), MHD_connection_close_(), MHD_request_handle_idle_(), MHD_response_for_upgrade(), thread_main_handle_connection(), and transmit_error_response().