[frogr] Do not actually change libsoup's proxy configuration if not needed
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Do not actually change libsoup's proxy configuration if not needed
- Date: Mon, 2 May 2011 15:41:13 +0000 (UTC)
commit c4033c428f7657d53644338928e81193228f9615
Author: Mario Sanchez Prada <msanchez igalia com>
Date: Mon May 2 17:31:09 2011 +0200
Do not actually change libsoup's proxy configuration if not needed
src/flicksoup/fsp-session.c | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/src/flicksoup/fsp-session.c b/src/flicksoup/fsp-session.c
index 2c4ed0a..1c4cb7d 100644
--- a/src/flicksoup/fsp-session.c
+++ b/src/flicksoup/fsp-session.c
@@ -60,6 +60,7 @@ struct _FspSessionPrivate
gchar *token;
gchar *frob;
+ SoupURI *proxy_uri;
SoupSession *soup_session;
};
@@ -323,6 +324,12 @@ fsp_session_dispose (GObject* object)
self->priv->soup_session = NULL;
}
+ if (self->priv->proxy_uri)
+ {
+ soup_uri_free (self->priv->proxy_uri);
+ self->priv->proxy_uri = NULL;
+ }
+
/* Call superclass */
G_OBJECT_CLASS (fsp_session_parent_class)->dispose(object);
}
@@ -336,6 +343,7 @@ fsp_session_finalize (GObject* object)
g_free (self->priv->api_key);
g_free (self->priv->secret);
g_free (self->priv->token);
+ g_free (self->priv->frob);
/* Call superclass */
G_OBJECT_CLASS (fsp_session_parent_class)->finalize(object);
@@ -389,6 +397,8 @@ fsp_session_init (FspSession *self)
self->priv->token = NULL;
self->priv->frob = NULL;
+ self->priv->proxy_uri = NULL;
+
self->priv->soup_session = soup_session_async_new ();
}
@@ -1289,11 +1299,22 @@ fsp_session_set_http_proxy (FspSession *self,
soup_uri_set_password (proxy_uri, actual_password);
}
- /* Set/unset the proxy */
- g_object_set (G_OBJECT (self->priv->soup_session),
- SOUP_SESSION_PROXY_URI,
- proxy_uri,
- NULL);
+ /* Set/unset the proxy if needed */
+ if ((!self->priv->proxy_uri && proxy_uri)
+ || (self->priv->proxy_uri && !proxy_uri)
+ || (self->priv->proxy_uri && proxy_uri && !soup_uri_equal (self->priv->proxy_uri, proxy_uri)))
+ {
+ g_object_set (G_OBJECT (self->priv->soup_session),
+ SOUP_SESSION_PROXY_URI,
+ proxy_uri,
+ NULL);
+
+ /* Save internal reference to the proxy */
+ if (self->priv->proxy_uri)
+ soup_uri_free (self->priv->proxy_uri);
+
+ self->priv->proxy_uri = proxy_uri;
+ }
}
const gchar *
@@ -1381,6 +1402,7 @@ fsp_session_get_auth_url_finish (FspSession *self,
gchar *signed_query = NULL;
/* Save the frob */
+ g_free (priv->frob);
priv->frob = frob;
/* Build the authorization url */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]