GNOME Bugzilla – Bug 680273
The static proxy resolver should bypass the proxy for localhost
Last modified: 2013-07-13 15:21:33 UTC
Created attachment 219262 [details] [review] Patch The static proxy resolver currently returns the proxy URI no matter what the destination URI is. This means that when accessing localhost or 127.0.0.0/8, the proxy will be used, which is not usually expected. There is no way to set exceptions for the static proxy resolver either. I'm proposing a patch that checks the destination URI in soup-proxy-resolver-static.c so that the proxy URI is not returned for localhost or 127.0.0.0/8. Keep in mind that my patch breaks "proxy-test" test since the test HTTP server used is on 127.0.0.1.
(In reply to comment #0) > Keep in mind that my patch breaks "proxy-test" test since the test HTTP server > used is on 127.0.0.1. As we'd discussed on IRC a while back, this is what has kept this patch out... I've finally come up with a solution I'm happy with, which involves adding support to glib for being able to override the GProxyResolver it uses, and adding a "GSimpleProxyResolver" implementation which you can easily use to get the behavior you want. That's in bug 691105. Then the libsoup side of this is to let you pass a GProxyResolver to your SoupSession...
Created attachment 234755 [details] [review] Internal renamings for clarity The GSocketClient::event signal gets proxied from GSocketClient to SoupSocket to SoupConnection to SoupSession to SoupMessage (!) via signal handlers that used to have "proxy" in their names. But that made it sound like they had something to do with network proxies. So rename them all (to "re_emit").
Created attachment 234756 [details] [review] SoupSession: remove some dead code, fix proxy error messages SoupMessageQueueItem's proxy_addr and proxy_uri fields were no longer being used, but they were still there, and SoupSession was trying to use item->proxy_uri to provide clarifying information on SOUP_STATUS_CANT_RESOLVE_PROXY / SOUP_STATUS_CANT_CONNECT_PROXY. Remove the unused fields, and fix SoupSession to get the proxy name from the SoupConnection instead.
Created attachment 234757 [details] [review] Use GProxyResolver for all proxy resolving Now that GSocketClient lets you override its proxy resolver, we can use GProxyResolver for all proxy resolution. Remove all the non-GProxyResolver proxy code from SoupSocket and SoupConnection, and add :proxy-resolver properties that can be passed down to the GSocketClient. Add a :proxy-resolver property to SoupSession, and reimplement :proxy-uri in terms of that and GSimpleProxyResolver. If the user adds a SoupProxyResolverDefault (which is now deprecated) to the session, just use its GProxyResolver directly instead. If the user adds any other kind of SoupProxyURIResolver to the session, use the new SoupProxyResolverWrapper, which is a GProxyResolver that talks to SoupProxyURIResolvers. Among other things, this allows for: - More complex static proxies than SoupSession:proxy-uri allows - Using SOCKS or other non-http proxy types in SoupSession:proxy-uri - Using a static proxy with some exceptions (ignore-hosts)
I committed a simplified version of the final patch: it introduces SoupSession:proxy-resolver but doesn't yet deprecate any of the old proxy stuff. Leaving this bug open to remind me to do that post-2.42.
committed