aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/callbacks.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/callbacks.c b/src/callbacks.c
index 3aa70fb..59c6dc2 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -28,12 +28,20 @@ set_proxy_url() {
void
set_authentication_handler() {
- if (uzbl.behave.authentication_handler == NULL || *uzbl.behave.authentication_handler == NULL)
- soup_session_add_feature_by_type
- (uzbl.net.soup_session, (GType) WEBKIT_TYPE_SOUP_AUTH_DIALOG);
- else
- soup_session_remove_feature_by_type
- (uzbl.net.soup_session, (GType) WEBKIT_TYPE_SOUP_AUTH_DIALOG);
+ /* Check if WEBKIT_TYPE_SOUP_AUTH_DIALOG feature is set */
+ GSList *flist = soup_session_get_features (uzbl.net.soup_session, (GType) WEBKIT_TYPE_SOUP_AUTH_DIALOG);
+ guint feature_is_set = g_slist_length(flist);
+ g_slist_free(flist);
+
+ if (uzbl.behave.authentication_handler == NULL || *uzbl.behave.authentication_handler == NULL) {
+ if (!feature_is_set)
+ soup_session_add_feature_by_type
+ (uzbl.net.soup_session, (GType) WEBKIT_TYPE_SOUP_AUTH_DIALOG);
+ } else {
+ if (feature_is_set)
+ soup_session_remove_feature_by_type
+ (uzbl.net.soup_session, (GType) WEBKIT_TYPE_SOUP_AUTH_DIALOG);
+ }
return;
}