HTTP client module header file. More...
Go to the source code of this file.
Data Structures | |
struct | http_client_send_callback_info_t |
Macros | |
#define | SSL_CERTIFICATE_TYPE_PEM "PEM" |
Typedefs | |
typedef mcl_size_t(* | http_client_read_callback) (void *buffer, mcl_size_t size, mcl_size_t count, void *user_context) |
Functions | |
E_MCL_ERROR_CODE | http_client_initialize (configuration_t *configuration, http_client_t **http_client) |
HTTP Client initializer. More... | |
E_MCL_ERROR_CODE | http_client_send (http_client_t *http_client, http_request_t *http_request, http_client_send_callback_info_t *callback_info, http_response_t **http_response) |
Send/Receive function. More... | |
void | http_client_destroy (http_client_t **http_client) |
To destroy the HTTP Client Handler. More... | |
mcl_size_t | http_client_get_callback_termination_code () |
To get the implementation specific code for returning from callback function in order to terminate the send operation. More... | |
HTTP client module header file.
Definition in file http_client.h.
#define SSL_CERTIFICATE_TYPE_PEM "PEM" |
Definition at line 24 of file http_client.h.
Referenced by http_client_initialize().
typedef mcl_size_t(* http_client_read_callback) (void *buffer, mcl_size_t size, mcl_size_t count, void *user_context) |
Definition at line 26 of file http_client.h.
void http_client_destroy | ( | http_client_t ** | http_client | ) |
To destroy the HTTP Client Handler.
Will release the resources of HTTP Request. After destroy operation, handler shouldn't be used.
[in] | http_client | HTTP Client Handler. |
Definition at line 230 of file http_client_libcurl.c.
References DEBUG_ENTRY, DEBUG_LEAVE, MCL_DEBUG, MCL_FREE, and MCL_NULL.
Referenced by http_processor_destroy().
mcl_size_t http_client_get_callback_termination_code | ( | ) |
To get the implementation specific code for returning from callback function in order to terminate the send operation.
Definition at line 220 of file http_client_libcurl.c.
References DEBUG_ENTRY, and DEBUG_LEAVE.
Referenced by _get_payload_from_file().
E_MCL_ERROR_CODE http_client_initialize | ( | configuration_t * | configuration, |
http_client_t ** | http_client | ||
) |
HTTP Client initializer.
Initializes the underlying implementation (like libcurl) with the given configuration data.
[in] | configuration | The configuration data. This is the same configuration data given to configuration_t when initializing it. |
[out] | http_client | Handle for the http client initialized. |
Definition at line 52 of file http_client_libcurl.c.
References _curl_debug_callback(), _response_header_callback(), _response_payload_callback(), _ssl_context_callback(), ASSERT_CODE_MESSAGE, string_t::buffer, curl_global_initialized, DEBUG_ENTRY, DEBUG_LEAVE, DOMAIN_SEPERATOR, configuration_t::http_request_timeout, string_t::length, MCL_DEBUG, MCL_FALSE, MCL_INITIALIZATION_FAIL, MCL_NEW, MCL_NULL, MCL_OK, MCL_OUT_OF_MEMORY, MCL_TRUE, memory_calloc(), memory_free(), memory_malloc(), memory_realloc(), configuration_t::mindsphere_certificate, configuration_t::mindsphere_port, configuration_t::proxy_domain, configuration_t::proxy_hostname, configuration_t::proxy_password, configuration_t::proxy_port, configuration_t::proxy_type, configuration_t::proxy_username, SSL_CERTIFICATE_TYPE_PEM, string_destroy(), string_initialize_new(), string_util_snprintf(), string_util_strdup(), and SUPPORTED_CIPHERS_LIST.
Referenced by http_processor_initialize().
E_MCL_ERROR_CODE http_client_send | ( | http_client_t * | http_client, |
http_request_t * | http_request, | ||
http_client_send_callback_info_t * | callback_info, | ||
http_response_t ** | http_response | ||
) |
Send/Receive function.
Using underlying implementation, it sends the given data to the pre-configured destination and returns the response. This function is blocking until response received or timeout occurred.
[in] | http_client | HTTP Client Handler. |
[in] | http_request | HTTP Request object. |
[in] | callback_info | Struct holding callback information. Refer to its definition http_client_send_callback_info_t . |
[out] | http_response | HTTP Response object. |
Definition at line 156 of file http_client_libcurl.c.
References _convert_to_mcl_error_code(), _set_request_options(), ASSERT_STATEMENT_CODE_MESSAGE, http_client_t::curl, libcurl_payload_t::data, DEBUG_ENTRY, DEBUG_LEAVE, http_response_initialize(), MCL_ERROR_RETURN, MCL_FREE, MCL_INFO, MCL_NEW, MCL_NULL, MCL_OK, libcurl_payload_t::size, string_array_destroy(), and string_array_initialize().
Referenced by http_processor_exchange(), http_processor_get_access_token(), http_processor_register(), and http_processor_stream().