Pass IP address of url domain to FindProxyForURL()

RESOLVED DUPLICATE of bug 1353510

Status

()

Toolkit
WebExtensions: Request Handling
P3
normal
RESOLVED DUPLICATE of bug 1353510
3 months ago
2 months ago

People

(Reporter: erosman, Unassigned)

Tracking

(Blocks: 1 bug)

55 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [proxy])

(Reporter)

Description

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
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDNSService#resolve() 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 https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDNSService#asyncResolve() 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]
(Reporter)

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.
Status: UNCONFIRMED → RESOLVED
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.