summaryrefslogtreecommitdiff
path: root/gweb
diff options
context:
space:
mode:
authorSébastien Bianti <sebastien.bianti@linux.intel.com>2011-03-02 11:21:21 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2011-03-11 21:17:59 +0100
commit99f50b43bada3c69794e54bfb8f09f6f24da607c (patch)
tree642935d44f7e536fb9d6b7a8e99e4b9dbae2fe20 /gweb
parenta589baf3900d63bd00789a7a51114ebd5b2fa2b2 (diff)
downloadconnman-99f50b43bada3c69794e54bfb8f09f6f24da607c.tar.gz
connman-99f50b43bada3c69794e54bfb8f09f6f24da607c.tar.bz2
connman-99f50b43bada3c69794e54bfb8f09f6f24da607c.zip
gweb: Add user_agent_profile field in http header
Diffstat (limited to 'gweb')
-rw-r--r--gweb/gweb.c22
-rw-r--r--gweb/gweb.h2
2 files changed, 23 insertions, 1 deletions
diff --git a/gweb/gweb.c b/gweb/gweb.c
index 7387e7c3..f3c8a7e0 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -106,6 +106,7 @@ struct _GWeb {
char *proxy;
char *accept_option;
char *user_agent;
+ char *user_agent_profile;
char *http_version;
gboolean close_connection;
@@ -239,6 +240,7 @@ void g_web_unref(GWeb *web)
g_free(web->accept_option);
g_free(web->user_agent);
+ g_free(web->user_agent_profile);
g_free(web->http_version);
g_free(web);
@@ -343,6 +345,19 @@ gboolean g_web_set_user_agent(GWeb *web, const char *format, ...)
return result;
}
+gboolean g_web_set_ua_profile(GWeb *web, const char *profile)
+{
+ if (web == NULL)
+ return FALSE;
+
+ g_free(web->user_agent_profile);
+
+ web->user_agent_profile = g_strdup(profile);
+ debug(web, "setting user agent profile %s", web->user_agent);
+
+ return TRUE;
+}
+
gboolean g_web_set_http_version(GWeb *web, const char *version)
{
if (web == NULL)
@@ -355,7 +370,7 @@ gboolean g_web_set_http_version(GWeb *web, const char *version)
debug(web, "clearing HTTP version");
} else {
web->http_version = g_strdup(version);
- debug(web, "setting HTTP version %s", web->http_version);
+ debug(web, "setting HTTP version %s", web->http_version);
}
return TRUE;
@@ -479,6 +494,11 @@ static void start_request(struct web_session *session)
g_string_append_printf(buf, "User-Agent: %s\r\n",
session->web->user_agent);
+ if (session->web->user_agent_profile != NULL) {
+ g_string_append_printf(buf, "x-wap-profile: %s\r\n",
+ session->web->user_agent_profile);
+ }
+
if (session->web->accept_option != NULL)
g_string_append_printf(buf, "Accept: %s\r\n",
session->web->accept_option);
diff --git a/gweb/gweb.h b/gweb/gweb.h
index 2979db52..3a76778d 100644
--- a/gweb/gweb.h
+++ b/gweb/gweb.h
@@ -60,6 +60,8 @@ gboolean g_web_set_accept(GWeb *web, const char *format, ...)
__attribute__((format(printf, 2, 3)));
gboolean g_web_set_user_agent(GWeb *web, const char *format, ...)
__attribute__((format(printf, 2, 3)));
+gboolean g_web_set_ua_profile(GWeb *web, const char *profile);
+
gboolean g_web_set_http_version(GWeb *web, const char *version);
void g_web_set_close_connection(GWeb *web, gboolean enabled);