HTTP response module header file. More...
Go to the source code of this file.
Data Structures | |
struct | mcl_http_response_t |
Functions | |
MCL_CORE_EXPORT mcl_error_t | mcl_http_response_initialize (mcl_list_t *header, mcl_uint8_t *payload, mcl_size_t payload_size, E_MCL_HTTP_STATUS_CODE status_code, mcl_http_response_t **http_response) |
MCL_CORE_EXPORT mcl_error_t | mcl_http_response_get_header (mcl_http_response_t *http_response, const char *header_name, char **header_value) |
MCL_CORE_EXPORT mcl_error_t | mcl_http_response_get_status (mcl_http_response_t *http_response) |
MCL_CORE_EXPORT void | mcl_http_response_destroy (mcl_http_response_t **http_response) |
HTTP response module header file.
This module is used internally by other MCL modules to analyze and parse received HTTP response messages. HTTP response (mcl_http_response_t) can be initialized and prepared with mcl_http_response_initialize function. Following initialization, value of HTTP header can be reached with mcl_http_response_get_header. HTTP response has to be destroyed when it is no longer needed using mcl_http_response_destroy function.
Definition in file mcl_http_response.h.
HTTP Status Codes
Definition at line 30 of file mcl_http_response.h.
MCL_CORE_EXPORT void mcl_http_response_destroy | ( | mcl_http_response_t ** | http_response | ) |
This function destroys the HTTP response handle.
[in] | http_response | HTTP response handle. |
Definition at line 174 of file http_response.c.
References _free_string(), MCL_DEBUG, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, mcl_list_destroy_with_content(), and MCL_NULL.
Referenced by core_processor_get_access_token(), and core_processor_register().
MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_header | ( | mcl_http_response_t * | http_response, |
const char * | header_name, | ||
char ** | header_value | ||
) |
This function gets the value of a specified HTTP header.
[in] | http_response | HTTP response handle to be used. |
[in] | header_name | Name of the header whose value is requested. |
[out] | header_value | Value of the header will be stored in header_value . |
Definition at line 44 of file http_response.c.
References mcl_list_node_t::data, mcl_http_response_t::header, MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_CALLOC, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FAIL, MCL_FUNCTION_LEAVE_LABEL, mcl_list_next(), mcl_list_reset(), MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, MCL_TRUE, string_util_find(), string_util_find_case_insensitive(), string_util_strlen(), and string_util_strncpy().
Referenced by core_processor_get_access_token().
MCL_CORE_EXPORT mcl_error_t mcl_http_response_get_status | ( | mcl_http_response_t * | http_response | ) |
This function gets the status code of the http response and converts it to equivalent MCL error code.
[in] | http_response | HTTP response handle to be used. |
Definition at line 105 of file http_response.c.
References MCL_ASSERT_NOT_NULL, MCL_BAD_REQUEST, MCL_CONFLICT, MCL_CREATED, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FORBIDDEN, MCL_FUNCTION_LEAVE_LABEL, MCL_HTTP_RESULT_CODE_TOO_MANY_REQUESTS, MCL_HTTP_STATUS_CODE_BAD_REQUEST, MCL_HTTP_STATUS_CODE_CONFLICT, MCL_HTTP_STATUS_CODE_CREATED, MCL_HTTP_STATUS_CODE_FORBIDDEN, MCL_HTTP_STATUS_CODE_INTERNAL_SERVER_ERR, MCL_HTTP_STATUS_CODE_NOT_FOUND, MCL_HTTP_STATUS_CODE_PARTIAL_CONTENT, MCL_HTTP_STATUS_CODE_PAYLOAD_TOO_LARGE, MCL_HTTP_STATUS_CODE_PRECONDITION_FAILED, MCL_HTTP_STATUS_CODE_SUCCESS, MCL_HTTP_STATUS_CODE_UNAUTHORIZED, MCL_INFO, MCL_NOT_FOUND, MCL_OK, MCL_PARTIAL_CONTENT, MCL_PRECONDITION_FAIL, MCL_REQUEST_PAYLOAD_TOO_LARGE, MCL_SERVER_FAIL, MCL_TOO_MANY_REQUESTS, MCL_UNAUTHORIZED, MCL_UNEXPECTED_RESULT_CODE, and mcl_http_response_t::status_code.
Referenced by _process_registration_response(), and core_processor_get_access_token().
MCL_CORE_EXPORT mcl_error_t mcl_http_response_initialize | ( | mcl_list_t * | header, |
mcl_uint8_t * | payload, | ||
mcl_size_t | payload_size, | ||
E_MCL_HTTP_STATUS_CODE | status_code, | ||
mcl_http_response_t ** | http_response | ||
) |
This function initializes an HTTP response message.
[in] | header | List of received HTTP headers. |
[in] | payload | The received HTTP payload. |
[in] | payload_size | Size of payload . |
[in] | status_code | The received status code. |
[out] | http_response | Handle of the initialized mcl_http_response_t object. |
Definition at line 17 of file http_response.c.
References MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.
Referenced by get_response(), and mcl_http_client_send().