From: Younho Park Date: Wed, 19 Oct 2016 11:54:03 +0000 (+0900) Subject: [TBT][tizen_3.0_mobile][push][Fixed for curl proxy setting] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9ad2b9ade4f9467db3d03bec2cbfbd061b5eac52;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tizen_3.0_mobile][push][Fixed for curl proxy setting] Change-Id: I967d4ad3e1d0cd057f294c5df81e879b6eef4a1d Signed-off-by: Younho Park --- diff --git a/tbtcoreapp/src/view/tbt-push-view.c b/tbtcoreapp/src/view/tbt-push-view.c index f93b697..561eec1 100644 --- a/tbtcoreapp/src/view/tbt-push-view.c +++ b/tbtcoreapp/src/view/tbt-push-view.c @@ -31,6 +31,7 @@ #include #include +#include #include "utils/logger.h" #include "utils/config.h" @@ -444,6 +445,10 @@ static void send_push_data_to_server(void* user_data) { DBG("Inside send_push_data_to_server"); + connection_h connection; + char *proxy_address = NULL; + int ret = 0; + push_view *this = NULL; this = (push_view*)user_data; RETM_IF(NULL == this, "view is NULL"); @@ -489,12 +494,39 @@ static void send_push_data_to_server(void* user_data) char* server = push_service_get_server_address(this->reg_id); DBG("Server Address: %s", server); - curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_URL, push_service_get_server_address(this->reg_id)); + curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_URL, server); RETM_IF(curl_err != CURLE_OK, "curl_easy_setopt - Adding CURLOPT_URL Failed %d", curl_err); curl_easy_setopt(this->curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(this->curl_handle, CURLOPT_WRITEFUNCTION, _curl_response_cb); curl_easy_setopt(this->curl_handle, CURLOPT_WRITEDATA, user_data); + curl_easy_setopt(this->curl_handle, CURLOPT_CONNECTTIMEOUT_MS, 15000); + curl_easy_setopt(this->curl_handle, CURLOPT_PROXYPORT, 8090); + + ret = connection_create(&connection); + if (CONNECTION_ERROR_NONE != ret) { + DBG("fail to create conn_handle[%d]", ret); + return; + } + + ret = connection_get_proxy(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address); + if (ret != CONNECTION_ERROR_NONE) { + DBG("Fail to get proxy[%d]", ret); + if (proxy_address) { + free(proxy_address); + proxy_address = NULL; + } + } else { + if (proxy_address != NULL && strlen(proxy_address) != 0) { + DBG("Proxy Address : [%s]", proxy_address); + curl_easy_setopt(this->curl_handle, CURLOPT_PROXY, proxy_address); + } + } + + if (connection) { + connection_destroy(connection); + connection = NULL; + } // lets send curl http request curl_err = curl_easy_perform(this->curl_handle); @@ -528,25 +560,25 @@ static char* push_service_get_server_address(char* reg_id) // Determine RQM server if (strncmp(reg_id, "00", 2) == 0) { server_address = - "https://useast.push.samsungosp.com:8088/spp/pns/api/push"; + "https://useast.push.samsungosp.com:8090/spp/pns/api/push"; } else if (strncmp(reg_id, "01", 2) == 0) { server_address = - "https://uswest.push.samsungosp.com:8088/spp/pns/api/push"; + "https://uswest.push.samsungosp.com:8090/spp/pns/api/push"; } else if (strncmp(reg_id, "02", 2) == 0) { server_address = - "https://apsoutheast.push.samsungosp.com:8088/spp/pns/api/push"; + "https://apsoutheast.push.samsungosp.com:8090/spp/pns/api/push"; } else if (strncmp(reg_id, "03", 2) == 0) { server_address = - "https://euwest.push.samsungosp.com:8088/spp/pns/api/push"; + "https://euwest.push.samsungosp.com:8090/spp/pns/api/push"; } else if (strncmp(reg_id, "04", 2) == 0) { server_address = - "https://apnortheast.push.samsungosp.com:8088/spp/pns/api/push"; + "https://apnortheast.push.samsungosp.com:8090/spp/pns/api/push"; } else if (strncmp(reg_id, "05", 2) == 0) { server_address = - "https://apkorea.push.samsungosp.com:8088/spp/pns/api/push"; + "https://apkorea.push.samsungosp.com:8090/spp/pns/api/push"; } else if (strncmp(reg_id, "06", 2) == 0) { server_address = - "https://apchina.push.samsungosp.com.cn:8088/spp/pns/api/push"; + "https://apchina.push.samsungosp.com.cn:8090/spp/pns/api/push"; } else { DBG("REG_ID has a wrong prefix"); }