Asterisk - The Open Source Telephony Project GIT-master-0bf3178
|
Functions | |
long | curl_download_to_file (const char *url, char *filename) |
Really simple document retrieval to file. More... | |
long | curl_download_to_memory (const char *url, size_t *returned_length, char **returned_data, struct ast_variable **headers) |
Really simple document retrieval to memory. More... | |
long | curler (const char *url, int request_timeout, struct curl_write_data *write_data, struct curl_header_data *header_data, struct curl_open_socket_data *open_socket_data) |
Perform a curl request. More... | |
long curl_download_to_file | ( | const char * | url, |
char * | filename | ||
) |
Really simple document retrieval to file.
url | The URL to retrieve. |
filename | The filename to save it to. |
An | HTTP response code. |
-1 | for internal error. |
Definition at line 321 of file curl_utils.c.
References ast_free, ast_log, ast_strdup, ast_strlen_zero(), curler(), curl_write_data::debug_info, errno, LOG_ERROR, NULL, curl_write_data::output, and url.
long curl_download_to_memory | ( | const char * | url, |
size_t * | returned_length, | ||
char ** | returned_data, | ||
struct ast_variable ** | headers | ||
) |
Really simple document retrieval to memory.
url | The URL to retrieve |
returned_length | Pointer to a size_t to hold document length. |
returned_data | Pointer to a buffer which will be updated to point to the data. Must be freed with ast_std_free() after use. |
headers | Pointer to an ast_variable * that will contain the response headers. Must be freed with ast_variables_destroy() Set to NULL if you don't need the headers. |
An | HTTP response code. |
-1 | for internal error. |
Definition at line 300 of file curl_utils.c.
References ast_strdupa, curler(), curl_header_data::debug_info, curl_write_data::debug_info, curl_header_data::headers, NULL, curl_write_data::stream_buffer, curl_write_data::stream_bytes_downloaded, and url.
Referenced by as_check_common_config().
long curler | ( | const char * | url, |
int | request_timeout, | ||
struct curl_write_data * | write_data, | ||
struct curl_header_data * | header_data, | ||
struct curl_open_socket_data * | open_socket_data | ||
) |
Perform a curl request.
url | The URL to request. |
request_timeout | If > 0, timeout after this number of seconds. |
curl_write_data | A pointer to a curl_write_data structure. If curl_write_data.output is NULL, open_memstream will be called to provide one and the resulting data will be available in curl_write_data.stream_buffer with the number of bytes retrieved in curl_write_data.stream_bytes_downloaded. You must free curl_write_data.stream_buffer yourself with ast_std_free() when you no longer need it. |
curl_header_data | A pointer to a ast_curl_header_data structure. The headers read will be in the curl_header_data.headers ast_variable list which you must free with ast_variables_destroy() when you're done with them. |
curl_open_socket_data | A pointer to an curl_open_socket_data structure or NULL if you don't need it. |
An | HTTP response code. |
-1 | for internal error. |
Definition at line 232 of file curl_utils.c.
References curl_write_data::_internal_memstream, AST_CURL_USER_AGENT, ast_strdupa, ast_strlen_zero(), curl_header_cb(), curl_open_socket_cb(), curl_write_cb(), LOG_ERROR, NULL, curl_write_data::output, RAII_VAR, SCOPE_ENTER, SCOPE_EXIT_LOG_RTN_VALUE, SCOPE_EXIT_RTN_VALUE, and url.
Referenced by curl_download_to_file(), curl_download_to_memory(), and retrieve_cert_from_url().