response.c File Reference

Methods for managing response objects. More...

#include "internal.h"
#include "response.h"

Include dependency graph for response.c:

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_ResponseMHD_create_response_from_callback (size_t size, unsigned int block_size, MHD_ContentReaderCallback crc, void *crc_cls, MHD_ContentReaderFreeCallback crfc)
struct MHD_ResponseMHD_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)


Detailed Description

Methods for managing response objects.

Author:
Daniel Pittman

Christian Grothoff

Definition in file response.c.


Function Documentation

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

Add a header line to the response.

Returns:
MHD_NO on error (i.e. invalid header or content format).

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().

Here is the caller graph for this function:

struct MHD_Response* MHD_create_response_from_callback ( size_t  size,
unsigned int  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.

Parameters:
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
Returns:
NULL on error (i.e. invalid arguments, out of memory)

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.

Parameters:
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
Returns:
NULL on error (i.e. invalid arguments, out of memory)

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().

Here is the caller graph for this function:

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

Delete a header line from the response.

Returns:
MHD_NO on error (no such header known)

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().

Here is the caller graph for this function:

const char* MHD_get_response_header ( struct MHD_Response response,
const char *  key 
)

Get a particular header from the response.

Parameters:
key which header to get
Returns:
NULL if header does not exist

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().

Here is the caller graph for this function:

int MHD_get_response_headers ( struct MHD_Response response,
MHD_KeyValueIterator  iterator,
void *  iterator_cls 
)

Get all of the headers added to a response.

Parameters:
iterator callback to call on each header; maybe NULL (then just count headers)
iterator_cls extra argument to iterator
Returns:
number of entries iterated over

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().

Here is the caller graph for this function:


Generated on Fri Oct 3 15:37:10 2008 for GNU libmicrohttpd by  doxygen 1.5.6