X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=agent%2Fdownload-agent-http-msg-handler.c;h=4686809387c6f3869ef86766403428c9225ce673;hb=4ba70013052f6e65a89e10452d500de781e7b543;hp=92d54c30885a94a876a50b5e488de5a452f5cc3a;hpb=939c9c723edcea3536f5682815f60c81a3d2c3f4;p=platform%2Fframework%2Fweb%2Fdownload-provider.git diff --git a/agent/download-agent-http-msg-handler.c b/agent/download-agent-http-msg-handler.c index 92d54c3..4686809 100755 --- a/agent/download-agent-http-msg-handler.c +++ b/agent/download-agent-http-msg-handler.c @@ -461,7 +461,8 @@ http_header_options_t *__parsing_N_create_option_str(char *org_str) } DA_SECURE_LOGD("option_field = [%s], option_value = [%s]", - option_field, option_value); + option_field ? option_field : "", + option_value ? option_value : ""); if (option_field || option_value) { option = __create_http_header_option( @@ -711,8 +712,7 @@ void http_msg_response_set_content_type(http_msg_response_t *http_msg_response, b_ret = __get_http_header_for_field(http_msg_response, HTTP_FIELD_CONTENT_TYPE, &header); if (b_ret) { - if (header->raw_value && (!strncmp(header->raw_value, in_type, - strlen(header->raw_value)))) + if (header->raw_value && !strcmp(header->raw_value, in_type)) return; DA_SECURE_LOGD("exchange Content-Type to [%s] from [%s]", in_type, header->value); @@ -823,9 +823,7 @@ da_bool_t http_msg_response_get_content_disposition( if (decoded_str) { char* file_name; DA_SECURE_LOGD("Url decoded str = [%s]", decoded_str); - file_name = (char*)calloc(1, strlen(decoded_str) + 1); - strncpy(file_name, decoded_str, strlen(decoded_str)); - + file_name = strdup(decoded_str); NULL_CHECK_AND_FREE(wanted_str); curl_free(decoded_str); decoded_str = NULL; @@ -845,8 +843,7 @@ da_bool_t http_msg_response_get_content_disposition( } } -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_ETag(http_msg_response_t *http_msg_response, char **out_value) { da_bool_t b_ret = DA_FALSE; http_header_t *header = NULL; @@ -865,6 +862,55 @@ da_bool_t http_msg_response_get_ETag(http_msg_response_t *http_msg_response, return DA_TRUE; } +da_bool_t http_msg_response_get_cache_control(http_msg_response_t *http_msg_response, char **out_value) +{ + da_bool_t b_ret = DA_FALSE; + http_header_t *header = NULL; + + if (!out_value) { + DA_LOGE("[NULL CHECK] out_value"); + return DA_FALSE; + } + + b_ret = __get_http_header_for_field(http_msg_response, HTTP_FIELD_CACHE_CONTROL, + &header); + if (!b_ret) { + DA_LOGV("no cache-control"); + return DA_FALSE; + } + + if (header->value) + *out_value = strdup(header->value); + else + return DA_FALSE; + + return DA_TRUE; +} + +da_bool_t http_msg_response_get_last_modified(http_msg_response_t *http_msg_response, char **out_value) +{ + da_bool_t b_ret = DA_FALSE; + http_header_t *header = NULL; + + if (!out_value) { + DA_LOGE("[NULL CHECK] out_value"); + return DA_FALSE; + } + + b_ret = __get_http_header_for_field(http_msg_response, HTTP_FIELD_LAST_MODIFIED, + &header); + if (!b_ret) { + DA_LOGV("no last-modified"); + return DA_FALSE; + } + if (header->value) + *out_value = strdup(header->value); + else + return DA_FALSE; + + return DA_TRUE; +} + #ifdef _RAF_SUPPORT da_bool_t http_msg_response_get_RAF_mode(http_msg_response_t *http_msg_response, char **out_value)