Merge lp:~midori/midori/proxy into lp:midori

Proposed by Cris Dywan
Status: Merged
Approved by: Cris Dywan
Approved revision: 6314
Merged at revision: 6334
Proposed branch: lp:~midori/midori/proxy
Merge into: lp:midori
Diff against target: 88 lines (+32/-15)
2 files modified
midori/midori-session.c (+22/-15)
midori/sokoke.c (+10/-0)
To merge this branch: bzr merge lp:~midori/midori/proxy
Reviewer Review Type Date Requested Status
Cris Dywan Approve
André Stösel Approve
gue5t gue5t Approve
Review via email: mp+178465@code.launchpad.net

Commit message

Use SoupProxyResolverGnome unconditionally and disable prefetching if proxy is active

To post a comment you must log in.
Revision history for this message
gue5t gue5t (gue5t) wrote :

Wireshark seems to like this, and the code looks good.

review: Approve
Revision history for this message
Cody Garver (codygarver) wrote :

Is this fix worthy of an emergency release?

Revision history for this message
André Stösel (ivaldi) wrote :

Release is next week and this is old bug - I wouldn't rush things.

lp:~midori/midori/proxy updated
6313. By André Stösel

deactive DNS prefetching when using custom proxy

Revision history for this message
André Stösel (ivaldi) wrote :

I fixed a little bug - it wasn't working if I specified the proxy in midori itself (instead of auto detection).

lp:~midori/midori/proxy updated
6314. By André Stösel

diable hosting detection when using a proxy

Revision history for this message
André Stösel (ivaldi) wrote :

The automatic proxy detection dosn't work for me so it would be nice if someone else could test if the commit 6314 turns of the host detection while using a proxy setup.

(enter "localhost/" in the url bar (without "http" and with the ending "/" - it's turned off it it's redirect to the default search engine))

Revision history for this message
gue5t gue5t (gue5t) wrote :

What exactly is the automatic proxy detection? The last commit looks good but if I'm not misunderstanding it, that commit disables prefetching in sokoke_magic_uri (parsing URIs from user input).

Revision history for this message
André Stösel (ivaldi) wrote :

"automatic proxy detection" -> preferences -> network -> proxy server -> automatic (gnome or enviroment)

yes, it does if a proxy is used
(prefetching i used to detect hostnames in the local network -> you have to type "http://localhost/" instead of "localhost/")

Revision history for this message
Cris Dywan (kalikiana) wrote :

The code in sokoke looks redundant to me - it already checks if enable-dns-prefetching is true. Given that the proxy code changes that, there should be no need for a further check.

review: Needs Fixing
Revision history for this message
André Stösel (ivaldi) wrote :

The problem is that settings is always NULL -> I could remove the enable-dns-prefetching check, but than I should remove the MidoriWebSettings* settings argument too -> the "API" would change - but right now it's only used inside sokoke and in tests

Revision history for this message
André Stösel (ivaldi) wrote :

I finished my review - looks good for the wk1 part, but I havn't tested wk2 yet.
(Right now the wk2 build isn't recommended -> I guess we can review it before next release.)

review: Approve
Revision history for this message
Cris Dywan (kalikiana) wrote :

> The problem is that settings is always NULL -> I could remove the enable-dns-
> prefetching check, but than I should remove the MidoriWebSettings* settings

I would actually prefer if we could make it have the settings to avoid that extra code. But let's keep the low profile fix for now and get onto the clean up later.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-session.c'
2--- midori/midori-session.c 2013-07-29 20:58:17 +0000
3+++ midori/midori-session.c 2013-08-07 21:27:28 +0000
4@@ -18,6 +18,7 @@
5
6 #include <glib/gi18n-lib.h>
7 #include <libsoup/soup-cookie-jar-sqlite.h>
8+#include <libsoup/soup-gnome-features.h>
9
10 #define LIBSOUP_USE_UNSTABLE_REQUEST_API
11 #include <libsoup/soup-cache.h>
12@@ -54,27 +55,22 @@
13 GParamSpec* pspec,
14 SoupSession* session)
15 {
16+ gboolean uses_proxy = TRUE;
17 MidoriProxy proxy_type = katze_object_get_enum (settings, "proxy-type");
18 if (proxy_type == MIDORI_PROXY_AUTOMATIC)
19 {
20- gboolean gnome_supported = FALSE;
21- GModule* module;
22- GType (*get_type_function) (void);
23- if (g_module_supported ())
24- if ((module = g_module_open ("libsoup-gnome-2.4.so", G_MODULE_BIND_LOCAL)))
25- {
26- if (g_module_symbol (module, "soup_proxy_resolver_gnome_get_type",
27- (void*) &get_type_function))
28- {
29- soup_session_add_feature_by_type (session, get_type_function ());
30- gnome_supported = TRUE;
31- }
32- }
33- if (!gnome_supported)
34- midori_soup_session_set_proxy_uri (session, g_getenv ("http_proxy"));
35+ soup_session_add_feature_by_type (session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
36+
37+ GProxyResolver* resolver = g_proxy_resolver_get_default ();
38+ gchar** proxies = g_proxy_resolver_lookup (resolver, "none", NULL, NULL);
39+
40+ if (!proxies || !g_strcmp0 (proxies[0], "direct://"))
41+ uses_proxy = FALSE;
42+ g_strfreev (proxies);
43 }
44 else if (proxy_type == MIDORI_PROXY_HTTP)
45 {
46+ soup_session_remove_feature_by_type (session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
47 gchar* proxy = katze_object_get_string (settings, "http-proxy");
48 GString* http_proxy = g_string_new (proxy);
49 g_string_append_printf (http_proxy, ":%d", katze_object_get_int (settings, "http-proxy-port"));
50@@ -83,7 +79,18 @@
51 g_free (proxy);
52 }
53 else
54+ {
55+ uses_proxy = FALSE;
56+ soup_session_remove_feature_by_type (session, SOUP_TYPE_PROXY_RESOLVER_GNOME);
57 midori_soup_session_set_proxy_uri (session, NULL);
58+ }
59+
60+ /* If a proxy server looks to be active, we disable prefetching, otherwise
61+ libSoup may be prefetching outside the proxy server beyond our control.
62+ */
63+
64+ if (uses_proxy)
65+ g_object_set (settings, "enable-dns-prefetching", FALSE, NULL);
66 }
67 #endif
68
69
70=== modified file 'midori/sokoke.c'
71--- midori/sokoke.c 2013-08-02 16:40:27 +0000
72+++ midori/sokoke.c 2013-08-07 21:27:28 +0000
73@@ -864,6 +864,16 @@
74 static gint host_count = G_MAXINT;
75 gchar* hostname;
76
77+
78+#ifndef HAVE_WEBKIT2
79+ SoupURI* soup_uri;
80+ SoupSession* session = webkit_get_default_session ();
81+
82+ g_object_get (G_OBJECT (session), "proxy-uri", &soup_uri, NULL);
83+ if (soup_uri)
84+ return FALSE;
85+#endif
86+
87 if (settings && !katze_object_get_boolean (settings, "enable-dns-prefetching"))
88 return FALSE;
89

Subscribers

People subscribed via source and target branches

to all changes: