After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 605065 - Make soup_session_prepare_for_uri handle proxies (patch attached)
Make soup_session_prepare_for_uri handle proxies (patch attached)
Status: RESOLVED WONTFIX
Product: libsoup
Classification: Core
Component: HTTP Transport
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2009-12-20 15:06 UTC by José Millán Soto
Modified: 2012-03-13 16:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for making soup_session_prepare_for_uri handle proxies (2.19 KB, patch)
2009-12-20 15:06 UTC, José Millán Soto
needs-work Details | Review
Patch for making soup_session_prepare_for_uri handle proxies (new version) (9.16 KB, patch)
2009-12-23 19:12 UTC, José Millán Soto
none Details | Review
soup_session_prepare_for_uri: do proxy lookup as well (9.72 KB, patch)
2010-06-08 15:49 UTC, Dan Winship
none Details | Review

Description José Millán Soto 2009-12-20 15:06:29 UTC
Created attachment 150110 [details] [review]
Patch for making soup_session_prepare_for_uri handle proxies

This patch makes soup_session_prepare_for_uri checking if an URI should use a proxy, and in that case it prefetchs the proxy address.
Comment 1 Dan Winship 2009-12-20 18:21:32 UTC
Comment on attachment 150110 [details] [review]
Patch for making soup_session_prepare_for_uri handle proxies

>+		udata = g_slice_alloc(2*sizeof(gpointer));
>+		udata[0] = session;
>+		udata[1] = soup_uri_copy(uri);

no. use a real struct.

>+		soup_proxy_uri_resolver_get_proxy_uri_async (proxy_uri_resolver, uri, priv->async_context,
>+							     NULL, soup_session_prepare_for_uri_proxy_cb,
>+							     udata);

ok, unlike in the address case, you actually have to save the result somewhere. You could store the last-prefetched URI and its corresponding proxy-URI in SoupSessionPrivate, and then when the next request comes in, if it's the one you have a proxy-URI cached for, use that proxy-uri right away rather than re-resolving it.
Comment 2 José Millán Soto 2009-12-23 19:12:03 UTC
Created attachment 150316 [details] [review]
 Patch for making soup_session_prepare_for_uri handle proxies (new version)

I think this patch solves the problems commented by Dan.

This patch makes SoupSession have a hashtable which acts as a proxy URIs cache. If one proxy URI is to be resolved, SoupSession search for it in that hash table, and if it was added a proxy URI for the original URI in the last 30 seconds (defined in soup-session-private.h), then it will use the cached value.

It also prefetchs the IP of the proxy host.
Comment 3 Dan Winship 2010-06-08 15:49:47 UTC
Created attachment 163075 [details] [review]
soup_session_prepare_for_uri: do proxy lookup as well

Here's a new version (which requires the very latest libsoup git master).
Rather than adding API to SoupSession to do caching, this just does the
caching within SoupProxyResolverGNOME. It only caches a single URI, but
that should generally be enough; the idea is mostly just to look up the
proxy as soon as the user mouses over the link, and to have finished
before they click it.

does this work for you?
Comment 4 Dan Winship 2010-06-19 20:10:57 UTC
ugh, this patch won't work; I was thinking we only did prepare_for_uri on mouseover, but it appears that webkit is calling it for every link it sees on the page.

I'm not convinced we want to be doing proxy pre-resolution on every single link; in the PAC case that will require running some unknown amount of javascript on each one. What would be better would be to tie this into the hovering-over-a-link signal.
Comment 5 Dan Winship 2012-03-13 16:23:58 UTC
This isn't happening, qv https://bugs.webkit.org/show_bug.cgi?id=80997