summaryrefslogtreecommitdiff
path: root/surf.c
diff options
context:
space:
mode:
authorQuentin Rameau <quinq@fifth.space>2015-11-20 17:12:00 +0100
committerQuentin Rameau <quinq@fifth.space>2015-11-20 17:12:00 +0100
commit5bca2223399bb18bada2a48db7411d181e3186e6 (patch)
tree6b4e415d427a74a1ef2077b36fe4b2f764605a53 /surf.c
parente6cefa584e605b8a9984b1a542098df1191adcb1 (diff)
downloadsurf-5bca2223399bb18bada2a48db7411d181e3186e6.tar.gz
surf-5bca2223399bb18bada2a48db7411d181e3186e6.tar.bz2
surf-5bca2223399bb18bada2a48db7411d181e3186e6.zip
Adapt user agent handling
Now we can only append Surf version to the default WebKit user agent instead of setting the whole string (while this remains possible to do).
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/surf.c b/surf.c
index 16ec398..601887a 100644
--- a/surf.c
+++ b/surf.c
@@ -112,6 +112,7 @@ static char pagestats[2];
static GTlsDatabase *tlsdb;
static int cookiepolicy;
static char *stylefile = NULL;
+static const char *useragent;
static void addaccelgroup(Client *c);
static char *buildfile(const char *path);
@@ -899,7 +900,6 @@ newview(Client *c, WebKitWebView *rv)
WebKitSettings *settings;
WebKitUserContentManager *contentmanager;
WebKitWebContext *context;
- char *ua;
/* Webview */
if (rv) {
@@ -918,12 +918,17 @@ newview(Client *c, WebKitWebView *rv)
"enable-javascript", enablescripts,
"enable-plugins", enableplugins,
NULL);
- if (!(ua = getenv("SURF_USERAGENT")))
- ua = useragent;
- webkit_settings_set_user_agent(settings, ua);
/* Have a look at http://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html
* for more interesting settings */
+ if (strcmp(fulluseragent, "")) {
+ webkit_settings_set_user_agent(settings, fulluseragent);
+ } else if (surfuseragent) {
+ webkit_settings_set_user_agent_with_application_details(
+ settings, "Surf", VERSION);
+ }
+ useragent = webkit_settings_get_user_agent(settings);
+
contentmanager = webkit_user_content_manager_new();
context = webkit_web_context_new_with_website_data_manager(