Pass IP address of url domain to FindProxyForURL()




WebExtensions: Request Handling
3 months ago
2 months ago


(Reporter: erosman, Unassigned)


(Blocks: 1 bug)

55 Branch

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [proxy])



3 months ago
Transferred from bug 1353510

Is there any chance of providing any form of Domain to IP conversion?

It can be fresh DNS query or even grabbing the IP from the Firefox DNS cache.
Domain based proxy selection, while mostly adequate, does not cover all of the required possibilities.

The PAC implementation (direct via Network - Connections -  Settings) seems to use a C++ synchronous dnsResolve.

As mentioned in comment 7 (above bug), there is API access to asyncResolve() (and I have already prepared the code) but that may or may not work in WebExtension implementation of Proxy API.

It appears that the WebExtension Proxy API is also synchronous. 

Is there any way to pass the IP to ProxyScriptContext.jsm so that it can be retrieved by the addon?

Comment 1

3 months ago
This could be provided as one of the extended arguments to FindProxyForUrl() like the others in bug 1368559 by calling before we invoke FindProxyForUrl(). However:

"Warning this method may block the calling thread for a long period of time. It is extremely unwise to call this function on the User Interface thread of an application."

I don't know if we can use instead: FindProxyForURL() is synchronous, and we will not have called it yet, but I don't know if the calling thread is synchronous, too, nor what other possible performance implications there are. Presumably the DNS lookup has already been done or is about to be done since nsIProtocolProxyService.registerChannelFilter() hands an nsIChannel instance to nsIProtocolProxyChannelFilter.applyFilter()
Blocks: 1283639
Priority: -- → P3
Summary: Add a Method of Domain to IP conversion → Pass IP address of url domain to FindProxyForURL()
Whiteboard: [proxy]

Comment 2

3 months ago
I was thinking of using an exciting process instead of creating a new one.

It depends if the browser (not the API) checks the DNS BEFORE or AFTER processing FindProxyForURL()

If the browser checks the DNS BEFORE processing FindProxyForURL(), then we can find a way of passing the already collected IP to the function. In that case, there would be no need for a separate DNS resolve (async or sync).

If browser checks the DNS AFTER processing FindProxyForURL(), then a new IP based function could be created to pass to the browser.

The browser need to do its DNS check anyway and in both cases, the DNS checking is left to the browser without creating a new DNS check process.
Bug 1353510 provides helper functions to handle dns resolution.
Last Resolved: 2 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1353510
You need to log in before you can comment on or make changes to this bug.