switch_aws_s3_profile aws_s3_profile;
char* url_dup;
+ if (!query_string) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required arg query_string.\n");
+ return headers;
+ }
+
// Get bucket and object name from url
switch_strdup(url_dup, url);
parse_url(url_dup, profile->base_domain, "s3", &aws_s3_profile.bucket, &aws_s3_profile.object);
long httpRes = 0;
int start_time_ms = switch_time_now() / 1000;
switch_CURLcode curl_status = CURLE_UNKNOWN_OPTION;
+ char *query_string = NULL;
+ char *full_url = NULL;
/* set up HTTP GET */
get_data.fd = 0;
}
if (profile && profile->append_headers_ptr) {
- headers = profile->append_headers_ptr(profile, headers, "GET", 0, "", url->url, 0, NULL);
+ headers = profile->append_headers_ptr(profile, headers, "GET", 0, "", url->url, 0, &query_string);
+ }
+
+ if (query_string) {
+ full_url = switch_mprintf("%s?%s", url->url, query_string);
+ free(query_string);
+ } else {
+ switch_strdup(full_url, url->url);
}
curl_handle = switch_curl_easy_init();
if (headers) {
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
}
- switch_curl_easy_setopt(curl_handle, CURLOPT_URL, get_data.url->url);
+ switch_curl_easy_setopt(curl_handle, CURLOPT_URL, full_url);
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, get_file_callback);
switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &get_data);
switch_curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, get_header_callback);
done:
+ switch_safe_free(full_url);
if (headers) {
switch_curl_slist_free_all(headers);
}