GNOME Bugzilla – Bug 698877
GProxyAddressEnumerator calls g_network_address_parse_uri without default port
Last modified: 2013-05-05 20:52:54 UTC
Created attachment 242444 [details] test case When libsoup tries to connect to a website via a SOCKS proxy, it uses a GProxyAddressEnumerator but then the address built has always dest_port 0 so the SOCKS proxy fails to connect to the website. It might work on some http proxies but the "ssh -D" SOCKS proxy fails. The source of the problem is calling g_network_address_parse_uri with default_port=0. Even if the uri contains well-known protocol like "http" or "https", g_network_address_parse_uri() does not default to 80 or 443 but to default_port=0. The calls are here: gio/gproxyaddressenumerator.c g_proxy_address_enumerator_set_property: > conn = g_network_address_parse_uri (uri, 0, NULL); gio/gproxyaddressenumerator.c next_enumerator > connectable = g_network_address_parse_uri (priv->proxy_uri, 0, &error); The stack of my program when libsoup gets a bad dest_port:
+ Trace 231853
The attached program shows what I would like g_network_address_parse_uri to do.
I'm not sure that GIO can be expected to maintain a big list of default ports for different URI schemes (although http and https are perhaps ubiquitous enough to make an exception). Perhaps libsoup should be decomposing the real-http-URI, re-composing just the scheme, hostname and port to which it wants to connect into a minimal URI-like thing (http://foo.example.com:80), and passing those into GSocketClient?
so, this is already fixed in libsoup; a 2.42.2 tarball went out yesterday. but I think we need to add a "default-port" property to GProxyAddressEnumerator as well, for it to pass to g_network_address_parse_uri() along with the URI.
Thanks Dan! Nicolas Dufresne (who wrote g_network_address_parse_uri) said "It's an application task to resolve the service." So I am marking this bug as duplicate of Bug #698163. I'm quoting the fix in libsoup 2.42.2 for future reference: >commit 3943610faed4922b739162f244f32e0b2393cba0 >Author: Dan Winship <danw@gnome.org> >Date: Thu Apr 18 10:30:32 2013 -0400 > > soup-address: fix proxy enumerator implementation > > When creating a GProxyAddressEnumerator, the destination URI passed to > it must include the port number, or the proxy may end up trying to > connect to port 0. libsoup was omitting the port number when it was > the default for the protocol. > > https://bugzilla.gnome.org/show_bug.cgi?id=698163 *** This bug has been marked as a duplicate of bug 698163 ***
it's an application task, but GProxyAddressEnumerator ought to let the application specify the URI and default-port separately, for the same reason that g_network_address_parse_uri() does.
fixed in master