Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: src/net.c
- ===================================================================
- --- src/net.c (revisiĆ³n: 4603)
- +++ src/net.c (copia de trabajo)
- @@ -40,6 +40,7 @@
- static SoupSession *session_no_proxy;
- static SoupSession *session_no_cookies;
- static SoupSession *session_no_cookies_no_proxy;
- +static SoupURI *proxy;
- static gchar *proxyname = NULL;
- static gchar *proxyusername = NULL;
- @@ -190,9 +191,13 @@
- cookies = soup_cookie_jar_text_new (filename, FALSE);
- g_free (filename);
- + /* conf_init() calls network_set_proxy(), and it's called before net_init() */
- + g_assert (proxy);
- +
- /* Initialize libsoup */
- session = soup_session_async_new_with_options (SOUP_SESSION_USER_AGENT, useragent,
- SOUP_SESSION_IDLE_TIMEOUT, 30,
- + SOUP_SESSION_PROXY_URI, proxy,
- SOUP_SESSION_ADD_FEATURE, cookies,
- NULL);
- @@ -206,6 +211,7 @@
- * Once GNOME #574571 is fixed, we will be able to use the normal session */
- session_no_cookies = soup_session_async_new_with_options (SOUP_SESSION_USER_AGENT, useragent,
- SOUP_SESSION_IDLE_TIMEOUT, 30,
- + SOUP_SESSION_PROXY_URI, proxy,
- NULL);
- /* And this one is for cases where we need to use our own cookies, and bypass the proxy, e.g.
- @@ -220,24 +226,6 @@
- soup_session_add_feature (session, SOUP_SESSION_FEATURE (logger));
- }
- - /* Set the initial proxy */
- - if (proxyname) {
- - proxy = soup_uri_new (proxyname);
- - if (proxy) {
- - soup_uri_set_port (proxy, proxyport);
- - soup_uri_set_user (proxy, proxyusername);
- - soup_uri_set_password (proxy, proxypassword);
- -
- - g_object_set (session,
- - SOUP_SESSION_PROXY_URI, proxy,
- - NULL);
- -
- - g_object_set (session_no_cookies,
- - SOUP_SESSION_PROXY_URI, proxy,
- - NULL);
- - }
- - }
- -
- g_free (useragent);
- }
- @@ -280,33 +268,22 @@
- proxyname = newProxyName;
- proxyport = newProxyPort;
- - /* If session is NULL, network_init() hasn't been called yet
- - * and when it's called it will set the proxy */
- - if (session) {
- - SoupURI *proxy;
- - g_object_get (G_OBJECT (session),
- - SOUP_SESSION_PROXY_URI, &proxy,
- - NULL);
- + /* This is only the case upon startup, when conf_init() calls network_set_proxy() */
- + if (!proxy) {
- + proxy = soup_uri_new (proxyname);
- + }
- - if (!proxy) {
- - proxy = soup_uri_new (proxyname);
- - }
- + soup_uri_set_host (proxy, proxyname);
- + soup_uri_set_port (proxy, proxyport);
- - /* If newProxyName was "", soup_uri_new will return NULL */
- - if (proxy) {
- - soup_uri_set_host (proxy, proxyname);
- - soup_uri_set_port (proxy, proxyport);
- - }
- + g_object_set (session,
- + SOUP_SESSION_PROXY_URI, proxy,
- + NULL);
- - g_object_set (session,
- - SOUP_SESSION_PROXY_URI, proxy,
- - NULL);
- + g_object_set (session_no_cookies,
- + SOUP_SESSION_PROXY_URI, proxy,
- + NULL);
- - g_object_set (session_no_cookies,
- - SOUP_SESSION_PROXY_URI, proxy,
- - NULL);
- - }
- -
- liferea_htmlview_update_proxy ();
- }
- @@ -318,28 +295,17 @@
- proxyusername = newProxyUsername;
- proxypassword = newProxyPassword;
- - /* If session is NULL, network_init() hasn't been called yet
- - * and when it's called it will set the proxy */
- - if (session) {
- - SoupURI *proxy;
- - g_object_get (session,
- - SOUP_SESSION_PROXY_URI, &proxy,
- - NULL);
- + g_assert (proxy);
- - /* There may be no proxy if there was no proxy before we went
- - * to the proxy tab and clicked on "proxy auth" */
- - if (proxy) {
- - soup_uri_set_user (proxy, proxyusername);
- - soup_uri_set_password (proxy, proxypassword);
- + soup_uri_set_user (proxy, proxyusername);
- + soup_uri_set_password (proxy, proxypassword);
- - g_object_set (session,
- - SOUP_SESSION_PROXY_URI, proxy,
- - NULL);
- - g_object_set (session_no_cookies,
- - SOUP_SESSION_PROXY_URI, proxy,
- - NULL);
- - }
- - }
- + g_object_set (session,
- + SOUP_SESSION_PROXY_URI, proxy,
- + NULL);
- + g_object_set (session_no_cookies,
- + SOUP_SESSION_PROXY_URI, proxy,
- + NULL);
- liferea_htmlview_update_proxy ();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement