Darin Fisher wrote:
> perhaps all you need to do is modify the code behind nsISocketProvider
> for SOCKS (which is implemented by PSM)
The socket provider for SOCKS is not in PSM, but you are right in that
the hostname and port are passed to the provider when the SOCKS IO layer
is created. I can simply store that information in the SOCKS info object
for use later, rather than pass it in via PRNetAddr.
> and disable DNS lookups for the socket transport some how (there's
> already code in doConnection that shows how to test if SOCKS is being
> used).
Yes, that was my plan. If I make mNetAddress non-null, then the DNS
resolving step will be effectively skipped. Then in the SOCKS IO layer
I can test for an "empty" (say port == 0) address, and use the hostname
and port stored earlier in its place.
> reuse of open sockets is managed at a higher level. for HTTP, see
> nsHttpHandler/nsHttpConnection.
Ok, so then this change shouldn't affect socket reuse.
This looks pretty simple, but I still don't know the best way to proceed
regarding configuration. I'm inclined to make this an app-wide switch.
The only time it would matter is with complex PAC files and a very
bizarre network (ie. it's possible to only resolve some things
internally, and some only externally). Specifying this setting in the
PAC is not currently possible (they haven't even decided how best to
specify different versions of SOCKS).
Still, it would be best to test for this option along with the other
proxy options in nsProtocolProxyService. Perhaps I can expand the
nsProxyInfo object to hold this flag and test for it in
nsSocketTransport:Init. Later when the PAC issues are resolved, it
would simply be a matter of that code setting this flag on the
proxyinfo object. Maybe just add an "extra" field, say an uint8,
which can just be proxy type specific? So creating a new proxyinfo
would look Like this:
NS_NewProxyInfo("http", "foo.bar.com", 8080, 0);
NS_NewProxyInfo("socks", "foo.bar.com", 1080, 0x01);
Justin