GNU libmicrohttpd
0.9.29
|
Methods for managing response objects. More...
#include "mhd_options.h"
#include "internal.h"
#include "response.h"
#include "mhd_limits.h"
#include "mhd_sockets.h"
#include "mhd_itc.h"
#include "mhd_str.h"
#include "connection.h"
#include "memorypool.h"
#include "mhd_compat.h"
Go to the source code of this file.
Macros | |
#define | MHD_NO_DEPRECATION 1 |
Functions | |
static int | add_response_entry (struct MHD_Response *response, enum MHD_ValueKind kind, const char *header, const char *content) |
int | MHD_add_response_header (struct MHD_Response *response, const char *header, const char *content) |
int | MHD_add_response_footer (struct MHD_Response *response, const char *footer, 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) |
bool | MHD_check_response_header_token_ci (const struct MHD_Response *response, const char *key, const char *token, size_t token_len) |
struct MHD_Response * | MHD_create_response_from_callback (uint64_t size, size_t block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc) |
int | MHD_set_response_options (struct MHD_Response *response, enum MHD_ResponseFlags flags,...) |
static ssize_t | file_reader (void *cls, uint64_t pos, char *buf, size_t max) |
static void | free_callback (void *cls) |
struct MHD_Response * | MHD_create_response_from_fd_at_offset (size_t size, int fd, off_t offset) |
_MHD_EXTERN struct MHD_Response * | MHD_create_response_from_fd_at_offset64 (uint64_t size, int fd, uint64_t offset) |
struct MHD_Response * | MHD_create_response_from_fd (size_t size, int fd) |
_MHD_EXTERN struct MHD_Response * | MHD_create_response_from_fd64 (uint64_t size, int fd) |
struct MHD_Response * | MHD_create_response_from_data (size_t size, void *data, int must_free, int must_copy) |
struct MHD_Response * | MHD_create_response_from_buffer (size_t size, void *buffer, enum MHD_ResponseMemoryMode mode) |
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.
#define MHD_NO_DEPRECATION 1 |
Definition at line 27 of file response.c.
|
static |
Add a header or footer line to the response.
response | response to add a header to |
kind | header or footer |
header | the header to add |
content | value to add |
Definition at line 69 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_NO, MHD_YES, MHD_HTTP_Header::next, NULL, and MHD_HTTP_Header::value.
Referenced by MHD_add_response_footer(), and MHD_add_response_header().
|
static |
Given a file descriptor, read data from the file to generate the response.
cls | pointer to the response |
pos | offset in the file to access |
buf | where to write the data |
max | number of bytes to write at most |
Definition at line 377 of file response.c.
References MHD_Response::fd, MHD_Response::fd_off, INT32_MAX, MHD_CONTENT_READER_END_OF_STREAM, and MHD_CONTENT_READER_END_WITH_ERROR.
Referenced by MHD_create_response_from_fd_at_offset64().
|
static |
Destroy file reader context. Closes the file descriptor.
cls | pointer to file descriptor |
Definition at line 461 of file response.c.
References MHD_Response::fd.
Referenced by MHD_create_response_from_fd_at_offset64().
bool MHD_check_response_header_token_ci | ( | const struct MHD_Response * | response, |
const char * | key, | ||
const char * | token, | ||
size_t | token_len | ||
) |
Check whether response header contains particular token.
Token could be surrounded by spaces and tabs and delimited by comma. Case-insensitive match used for header names and tokens.
response | the response to query |
key | header name |
token | the token to find |
token_len | the length of token, not including optional terminating null-character. |
Definition at line 265 of file response.c.
References MHD_Response::first_header, MHD_HTTP_Header::header, MHD_HTTP_Header::kind, MHD_HEADER_KIND, MHD_str_equal_caseless_(), MHD_str_has_token_caseless_(), MHD_HTTP_Header::next, NULL, and MHD_HTTP_Header::value.
void MHD_increment_response_rc | ( | struct MHD_Response * | response | ) |
Increments the reference counter for the response.
response | object to modify |
Definition at line 1090 of file response.c.
References MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, MHD_Response::mutex, and MHD_Response::reference_count.
Referenced by MHD_queue_response().
int MHD_set_response_options | ( | struct MHD_Response * | response, |
enum MHD_ResponseFlags | flags, | ||
... | |||
) |
Set special flags and options for a response.
response | the response to modify |
flags | to set for the response |
... | #MHD_RO_END terminated list of options |
Definition at line 341 of file response.c.
References MHD_Response::flags, MHD_NO, and MHD_YES.