From 98a7f15cb2a5069cda840ec250df005bb5008665 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Tue, 7 Feb 2023 20:34:00 +0900 Subject: [PATCH] bug fix: handle empty proxy address 1. Revert e09e63a4a974ec9e6f2c094d7562bc89cb3452f8 2. Exception handling for empty proxy address Change-Id: I012edb83c505cc8c17d6078dfdaa75c291164112 --- agent/download-agent-plugin-conf.c | 5 +++++ agent/download-agent-plugin-libcurl.c | 12 +++++------- packaging/download-provider.spec | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/agent/download-agent-plugin-conf.c b/agent/download-agent-plugin-conf.c index 4d3c5c5..b6417a7 100755 --- a/agent/download-agent-plugin-conf.c +++ b/agent/download-agent-plugin-conf.c @@ -75,6 +75,11 @@ char *get_proxy_address(void) } if (proxyRet) { + if (strlen(proxyRet) == 0) { + DA_LOGE("Proxy is empty."); + free(proxyRet); + return NULL; + } DA_SECURE_LOGD("===== Proxy address[%s] =====", proxyRet); proxy = strdup(proxyRet); free(proxyRet); diff --git a/agent/download-agent-plugin-libcurl.c b/agent/download-agent-plugin-libcurl.c index 5a58df1..b1a5398 100755 --- a/agent/download-agent-plugin-libcurl.c +++ b/agent/download-agent-plugin-libcurl.c @@ -179,14 +179,12 @@ 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 && http_info->proxy_info) { - DA_LOGI("Proxy is set."); - res = curl_easy_getinfo(curl, CURLINFO_HTTP_CONNECTCODE, &status); - } - + } if (res != CURLE_OK) { DA_LOGE("Fail to get response status code"); return; diff --git a/packaging/download-provider.spec b/packaging/download-provider.spec index 4a76322..ecbd9a4 100755 --- a/packaging/download-provider.spec +++ b/packaging/download-provider.spec @@ -1,6 +1,6 @@ Name: download-provider Summary: Download the contents in background -Version: 2.3.5 +Version: 2.3.6 Release: 0 Group: Development/Libraries License: Apache-2.0 -- 2.7.4