GNU libmicrohttpd 1.0.2
Loading...
Searching...
No Matches
response.h File Reference

Methods for managing response objects. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void MHD_increment_response_rc (struct MHD_Response *response)
 
enum MHD_Result MHD_response_execute_upgrade_ (struct MHD_Response *response, struct MHD_Connection *connection)
 
struct MHD_HTTP_Res_HeaderMHD_get_response_element_n_ (struct MHD_Response *response, enum MHD_ValueKind kind, const char *key, size_t key_len)
 
bool MHD_add_response_entry_no_check_ (struct MHD_Response *response, enum MHD_ValueKind kind, const char *header, size_t header_len, const char *content, size_t content_len)
 
bool MHD_add_response_entry_no_alloc_ (struct MHD_Response *response, enum MHD_ValueKind kind, char *header, size_t header_len, char *content, size_t content_len)
 

Detailed Description

Methods for managing response objects.

Author
Daniel Pittman
Christian Grothoff
Karlson2k (Evgeny Grin)

Definition in file response.h.

Function Documentation

◆ MHD_add_response_entry_no_alloc_()

bool MHD_add_response_entry_no_alloc_ ( struct MHD_Response * response,
enum MHD_ValueKind kind,
char * header,
size_t header_len,
char * content,
size_t content_len )

Add preallocated strings a header or footer line to the response without checking.

Header/footer strings are not checked and assumed to be correct.

The string must not be statically allocated! The strings must be malloc()'ed and zero terminated. The strings will be free()'ed when the response is destroyed.

Parameters
responseresponse to add a header to
kindheader or footer
headerthe header string to add, must be malloc()'ed and zero-terminated
header_lenthe length of the header
contentthe value string to add, must be malloc()'ed and zero-terminated
content_lenthe length of the content

Definition at line 167 of file response.c.

References _MHD_insert_header_last, MHD_HTTP_Res_Header::header, MHD_HTTP_Res_Header::header_size, MHD_HTTP_Res_Header::kind, mhd_assert, MHD_calloc_(), NULL, MHD_HTTP_Res_Header::value, and MHD_HTTP_Res_Header::value_size.

Referenced by MHD_add_response_entry_no_check_(), queue_auth_required_response3_inner(), and transmit_error_response_len().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_add_response_entry_no_check_()

bool MHD_add_response_entry_no_check_ ( struct MHD_Response * response,
enum MHD_ValueKind kind,
const char * header,
size_t header_len,
const char * content,
size_t content_len )

Add a header or footer line to the response without checking.

It is assumed that parameters are correct.

Parameters
responseresponse to add a header to
kindheader or footer
headerthe header to add, does not need to be zero-terminated
header_lenthe length of the header
contentvalue to add, does not need to be zero-terminated
content_lenthe length of the content
Returns
false on error (like out-of-memory), true if succeed

Definition at line 207 of file response.c.

References MHD_HTTP_Res_Header::header, MHD_HTTP_Res_Header::kind, MHD_add_response_entry_no_alloc_(), mhd_assert, and NULL.

Referenced by add_response_entry_n().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MHD_increment_response_rc()

void MHD_increment_response_rc ( struct MHD_Response * response)

Increments the reference counter for the response.

Parameters
responseobject to modify

Definition at line 2335 of file response.c.

References MHD_mutex_lock_chk_, MHD_mutex_unlock_chk_, and MHD_Response::reference_count.

Referenced by MHD_queue_response().

Here is the caller graph for this function:

◆ MHD_response_execute_upgrade_()

enum MHD_Result MHD_response_execute_upgrade_ ( struct MHD_Response * response,
struct MHD_Connection * connection )

We are done sending the header of a given response to the client. Now it is time to perform the upgrade and hand over the connection to the application.

Remarks
To be called only from thread that process connection's recv(), send() and response. Must be called right after sending response headers.
Parameters
responsethe response that was created for an upgrade
connectionthe specific connection we are upgrading
Returns
MHD_YES on success, MHD_NO on failure (will cause connection to be closed)

Referenced by MHD_connection_handle_idle().

Here is the caller graph for this function: