From: Anjali Nijhara Date: Wed, 1 Feb 2023 06:58:50 +0000 (+0530) Subject: Get status code using CURLINFO_HTTP_CONNECTCODE when using proxy X-Git-Tag: accepted/tizen/7.0/unified/20230216.140333~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17e801f1a412166e8f9e173b7688a49dfa04bad4;p=platform%2Fframework%2Fweb%2Fdownload-provider.git Get status code using CURLINFO_HTTP_CONNECTCODE when using proxy Change-Id: I93309e8c3ba38e0e7c70b389ac8c6e6caa80b258 --- diff --git a/agent/download-agent-plugin-libcurl.c b/agent/download-agent-plugin-libcurl.c index 4d015ed..b1a5398 100755 --- a/agent/download-agent-plugin-libcurl.c +++ b/agent/download-agent-plugin-libcurl.c @@ -179,12 +179,17 @@ void __store_header(void *msg, da_info_t *da_info, size_t header_size, CURL *curl; http_raw_data_t *raw_data = DA_NULL; curl = http_info->http_msg->curl; + if (http_info->proxy_info) { + DA_LOGI("Proxy is set."); + res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &status); + } else { res = curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status); + } if (res != CURLE_OK) { DA_LOGE("Fail to get response status code"); return; } - DA_LOGV("status code[%d]", (int)status); + DA_LOGI("status code[%d]", (int)status); if (http_info->http_msg_response) http_info->http_msg_response->status_code = (int)status; raw_data = (http_raw_data_t *)calloc(1, sizeof(http_raw_data_t)); @@ -307,6 +312,7 @@ da_ret_t __set_proxy_on_soup_session(proxy_info_t *proxy_info, CURL *curl) if (proxy_info && strlen(proxy_info->addr) > 0) { if (!strstr(proxy_info->addr, "0.0.0.0")) { curl_easy_setopt(curl, CURLOPT_PROXY, proxy_info->addr); + DA_LOGI("proxy[%s] is used.", proxy_info->addr); if (proxy_info->user_name || proxy_info->password) curl_easy_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY); if (proxy_info->user_name)