HTTP request module implementation file. More...
#include "http_request.h"
#include "definitions.h"
#include "string_util.h"
#include "mcl_core/mcl_assert.h"
#include "mcl_core/mcl_memory.h"
Go to the source code of this file.
Functions | |
static void | _http_request_header_destroy (char **header) |
mcl_error_t | mcl_http_request_initialize (mcl_http_request_t **http_request) |
mcl_error_t | mcl_http_request_add_header (mcl_http_request_t *http_request, const char *header_name, const char *header_value) |
mcl_error_t | mcl_http_request_set_parameter (mcl_http_request_t *http_request, E_MCL_HTTP_REQUEST_PARAMETER parameter, const void *value) |
void | mcl_http_request_destroy (mcl_http_request_t **http_request) |
HTTP request module implementation file.
Definition in file http_request.c.
|
static |
Definition at line 170 of file http_request.c.
References MCL_FREE.
Referenced by mcl_http_request_destroy().
mcl_error_t mcl_http_request_add_header | ( | mcl_http_request_t * | http_request, |
const char * | header_name, | ||
const char * | header_value | ||
) |
This function is used to add an HTTP header to the request with its value.
[in] | http_request | HTTP request handle to be used. |
[in] | header_name | Header name. |
[in] | header_value | Header value. |
http_request
, header_name
or header_value
is NULL. Definition at line 57 of file http_request.c.
References mcl_http_request_t::header, MCL_ASSERT_CODE_MESSAGE, MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, MCL_FUNCTION_LEAVE_LABEL, mcl_list_add(), MCL_MALLOC, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, string_util_snprintf(), and string_util_strlen().
Referenced by core_processor_get_access_token(), and core_processor_register().
void mcl_http_request_destroy | ( | mcl_http_request_t ** | http_request | ) |
This function destroys HTTP request data structure.
[in] | http_request | HTTP request handle to be freed. |
Definition at line 155 of file http_request.c.
References _http_request_header_destroy(), MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FREE, mcl_list_destroy_with_content(), and MCL_NULL.
Referenced by core_processor_get_access_token(), core_processor_register(), and mcl_http_request_initialize().
mcl_error_t mcl_http_request_initialize | ( | mcl_http_request_t ** | http_request | ) |
This function creates and initializes an mcl_http_request_t.
[out] | http_request | The newly initialized HTTP request. |
uri
or http_request
is NULL. Definition at line 18 of file http_request.c.
References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_HTTP_GET, mcl_http_request_destroy(), mcl_list_initialize(), MCL_NEW, MCL_NULL, MCL_OK, and MCL_OUT_OF_MEMORY.
Referenced by core_processor_get_access_token(), and core_processor_register().
mcl_error_t mcl_http_request_set_parameter | ( | mcl_http_request_t * | http_request, |
E_MCL_HTTP_REQUEST_PARAMETER | parameter, | ||
const void * | value | ||
) |
This function is used to set a parameter of HTTP request.
[in] | http_request | HTTP request handle to be used. |
[in] | parameter | One of the parameters listed in E_MCL_HTTP_REQUEST_PARAMETER. |
[in] | value | New value of the parameter . |
http_request
or value
is NULL. parameter
is invalid. Definition at line 97 of file http_request.c.
References MCL_ASSERT_NOT_NULL, MCL_DEBUG_ENTRY, MCL_DEBUG_LEAVE, MCL_FUNCTION_LEAVE_LABEL, MCL_HTTP_END, MCL_HTTP_REQUEST_PARAMETER_BODY, MCL_HTTP_REQUEST_PARAMETER_BODY_SIZE, MCL_HTTP_REQUEST_PARAMETER_METHOD, MCL_HTTP_REQUEST_PARAMETER_STREAM_CALLBACK, MCL_HTTP_REQUEST_PARAMETER_STREAM_DATA, MCL_HTTP_REQUEST_PARAMETER_URL, MCL_INVALID_PARAMETER, MCL_NULL, MCL_OK, mcl_http_request_t::method, mcl_http_request_t::payload, mcl_http_request_t::payload_size, mcl_http_request_t::stream_callback, mcl_http_request_t::stream_data, string_util_reset(), and mcl_http_request_t::uri.
Referenced by core_processor_get_access_token(), and core_processor_register().