Revert manifest to default one
[profile/ivi/download-provider.git] / src / agent / download-agent-http-misc.c
1 /*
2  * Download Agent
3  *
4  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jungki Kwak <jungki.kwak@samsung.com>, Keunsoon Lee <keunsoon.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * @file                download-agent-http-misc.c
21  * @brief               Including miscellaneous functions for http
22  * @author              Keunsoon Lee(keunsoon.lee@samsung.com)
23  * @author              Jungki Kwak(jungki.kwak@samsung.com)
24  ***/
25
26 #include "download-agent-http-misc.h"
27 #include "download-agent-debug.h"
28 #include "download-agent-dl-mgr.h"
29 #include "download-agent-plugin-conf.h"
30 #include "download-agent-client-mgr.h"
31
32 #define DEFAULT_HTTP_ACCEPT_HEADERS \
33                 "Accept-Language: en\r\n" \
34                 "Accept-Charset: utf-8\r\n" \
35
36
37 char* get_user_agent()
38 {
39         char *uagent_str = DA_NULL;
40
41         DA_LOG_FUNC_START(Default);
42
43         uagent_str = get_client_user_agent_string();
44         if (uagent_str) {
45                 return uagent_str;
46         } else {
47                 return GET_USER_AGENT;
48         }
49 }
50
51 da_bool_t is_supporting_protocol(const char* protocol)
52 {
53         if((protocol == NULL) || (1 > strlen(protocol)))
54         {
55                 return DA_FALSE;
56         }
57
58         if(!strcasecmp(protocol, "http"))
59         {
60                 return DA_TRUE;
61         }
62         else if(!strcasecmp(protocol, "https"))
63         {
64                 return DA_TRUE;
65         }
66         else
67         {
68                 return DA_FALSE;
69         }
70
71 }