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 680273 - The static proxy resolver should bypass the proxy for localhost
The static proxy resolver should bypass the proxy for localhost
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: Misc
2.39.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2012-07-19 19:16 UTC by Christophe Dumez
Modified: 2013-07-13 15:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (2.06 KB, patch)
2012-07-19 19:16 UTC, Christophe Dumez
rejected Details | Review
Internal renamings for clarity (4.72 KB, patch)
2013-01-29 15:43 UTC, Dan Winship
committed Details | Review
SoupSession: remove some dead code, fix proxy error messages (3.96 KB, patch)
2013-01-29 15:43 UTC, Dan Winship
committed Details | Review
Use GProxyResolver for all proxy resolving (41.10 KB, patch)
2013-01-29 15:43 UTC, Dan Winship
none Details | Review

Description Christophe Dumez 2012-07-19 19:16:39 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.
Comment 1 Dan Winship 2013-01-29 15:43:12 UTC
(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...
Comment 2 Dan Winship 2013-01-29 15:43:41 UTC
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").
Comment 3 Dan Winship 2013-01-29 15:43:44 UTC
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.
Comment 4 Dan Winship 2013-01-29 15:43:46 UTC
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)
Comment 5 Dan Winship 2013-03-07 15:09:45 UTC
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.
Comment 6 Dan Winship 2013-07-13 15:21:33 UTC
committed