2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <glib-object.h>
23 #include <vconf-keys.h>
24 #include <net_connection.h>
25 #endif /* _EFL_PLATFORM */
27 #include "download-agent-plugin-conf.h"
28 #include "download-agent-debug.h"
29 #include "download-agent-file.h"
31 #define DEFAULT_UA_STR "Mozilla/5.0 (Linux; U; Tizen 1.0; en-us) AppleWebKit/534.46 (KHTML, like Gecko) Mobile Tizen Browser/1.0"
33 da_result_t __get_conf_string(const char *key, char **out_string);
35 da_result_t __get_conf_string(const char *key, char **out_string)
38 if (!key || !out_string) {
39 DA_LOG_ERR(Default,"Invalid Argument");
40 return DA_ERR_INVALID_ARGUMENT;
43 *out_string = vconf_get_str(key);
53 da_result_t get_user_agent_string(char **uagent_str)
55 da_result_t ret = DA_RESULT_OK;
60 DA_LOG_FUNC_LOGV(Default);
63 DA_LOG_ERR(Default,"Invalid Argument");
64 return DA_ERR_INVALID_ARGUMENT;
68 key = VCONFKEY_BROWSER_USER_AGENT;
69 ret = __get_conf_string(key, uagent_str);
70 if(ret == DA_RESULT_OK) {
72 DA_SECURE_LOGD("getting uagent_str = \n%s", *uagent_str);
76 DA_LOG_ERR(Default,"No UA information from vconf !!");
77 *uagent_str = strdup(DEFAULT_UA_STR);
78 DA_LOG(Default,"Set default UA");
80 *uagent_str = strdup(DEFAULT_UA_STR);
85 char *get_proxy_address(void)
89 char *proxyRet = NULL;
90 connection_h handle = NULL;
91 connection_address_family_e family = CONNECTION_ADDRESS_FAMILY_IPV4;
93 DA_LOG_FUNC_LOGV(Default);
94 if (connection_create(&handle) < 0) {
95 DA_LOG_ERR(Default,"Fail to create connection handle");
99 if (connection_get_proxy(handle, family, &proxyRet) < 0) {
100 DA_LOG_ERR(Default,"Fail to get proxy address");
101 connection_destroy(handle);
106 DA_SECURE_LOGD("===== Proxy address[%s] =====", proxyRet);
107 proxy = strdup(proxyRet);
110 connection_destroy(handle);
114 if (connection_destroy(handle) < 0) {
115 DA_LOG_ERR(Default,"Fail to desctory connection handle");