*out_raw_encoded_str = raw_encoded_str;
return ret;
}
-
-void decode_url_encoded_str(const char *in_encoded_str, char **out_str)
-{
- CURL* curl = curl_easy_init();
-
- *out_str = curl_easy_unescape(curl, in_encoded_str, strlen(in_encoded_str), NULL);
-
- if(!*out_str){
- DA_LOGE("CURLE_OUT_OF_MEMORY");
- return;
- }
-
- curl_easy_cleanup(curl);
-}
file_info_t *file_info = DA_NULL;
req_info_t *req_info = DA_NULL;
http_msg_response_t *http_msg_response = DA_NULL;
+ http_msg_t *http_msg = DA_NULL;
da_size_t size = 0;
char *mime_type = DA_NULL;
char *etag = DA_NULL;
NULL_CHECK_RET(req_info);
NULL_CHECK_RET(raw_data);
+ http_msg = http_info->http_msg;
+ NULL_CHECK_RET(http_msg);
+
DA_MUTEX_LOCK(&(http_info->mutex_state));
http_state = http_info->state;
DA_MUTEX_UNLOCK(&(http_info->mutex_state));
http_msg_response_get_ETag(http_msg_response, &etag);
http_info->etag_from_header = etag;
http_msg_response_get_content_disposition(
- http_msg_response, DA_NULL, &file_name);
+ http_msg_response, http_msg, DA_NULL, &file_name);
http_info->file_name_from_header = file_name;
ret = __handle_http_status_code(http_info, file_info, req_info);
if (ret != DA_RESULT_OK) {
}
da_bool_t http_msg_response_get_content_disposition(
- http_msg_response_t *http_msg_response, char **out_disposition,
+ http_msg_response_t *http_msg_response, http_msg_t *http_msg, char **out_disposition,
char **out_file_name)
{
da_bool_t b_ret = DA_FALSE;
} else {
DA_LOGV("It's NOT base64 encoded-word string");
}
- decode_url_encoded_str(wanted_str, &decoded_str);
+
+ if(http_msg->curl)
+ decoded_str = curl_easy_unescape(http_msg->curl, wanted_str, wanted_str_len, NULL);
+
/* If it is url encoded string */
if (decoded_str) {
DA_SECURE_LOGD("Url decoded str = [%s]", decoded_str);
wanted_str = decoded_str;
decoded_str = NULL;
}
+ else{
+ DA_LOGE("Fail to url decode.");
+ free(wanted_str);
+ wanted_str = NULL;
+ return DA_FALSE;
+ }
*out_file_name = wanted_str;
+
DA_SECURE_LOGI("out_file_name = [%s]", *out_file_name);
return DA_TRUE;
} else {
da_bool_t is_base64_encoded_word(const char *in_str);
da_ret_t decode_base64_encoded_str(const char *in_encoded_str,
char **out_decoded_ascii_str);
-void decode_url_encoded_str(const char *in_encoded_str, char **out_str);
#endif // _Download_Agent_Encoding_H
void http_msg_response_set_content_type(http_msg_response_t *http_msg_response, const char *in_type);
da_bool_t http_msg_response_get_content_length(http_msg_response_t *http_msg_response, da_size_t *out_length);
-da_bool_t http_msg_response_get_content_disposition(http_msg_response_t *http_msg_response, char **out_disposition, char **out_file_name);
+da_bool_t http_msg_response_get_content_disposition(http_msg_response_t *http_msg_response, http_msg_t *http_msg, char **out_disposition, char **out_file_name);
da_bool_t http_msg_response_get_ETag(http_msg_response_t *http_msg_response, char **out_value);
da_bool_t http_msg_response_get_date(http_msg_response_t *http_msg_response, char **out_value);
da_bool_t http_msg_response_get_location(http_msg_response_t *http_msg_response, char **out_value);