Open
Bug 558253
Opened 13 years ago
Updated 13 days ago
Proxy Auto Config (PAC) Extended functions for multi-resolution and ipv6
Categories
(Core :: Networking, enhancement, P3)
Core
Networking
Tracking
()
People
(Reporter: aronrubin, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-backlog])
Attachments
(1 file)
1.69 KB,
patch
|
bzbarsky
:
feedback-
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTBDFff GTB7.0 Build Identifier: There are a couple of problems with the proxy auto config (PAC) API. It does not handle ipv6 and the resolve calls return only the first address. Personally I do not care about ipv6 but the single address is a real problem when it comes to myIpAddress. Virtual adapters/interfaces have addresses too so an address is chosen at random and returned. Microsoft created an extended API for PAC and I see no reason not to adopt it. I have made the necessary changes to nsProxyAutoConfig.js. See the following: http://blogs.msdn.com/wndp/articles/IPV6_PAC_Extensions_v0_9.aspx http://code.google.com/p/chromium/issues/detail?id=25407 Reproducible: Always --- nsProxyAutoConfig.js 2010-04-05 15:20:38 -0400 +++ nsProxyAutoConfig.js 2010-04-08 23:20:31 -0400 @@ -81,6 +81,9 @@ nsProxyAutoConfig.prototype = { this._sandBox.importFunction(myIpAddress); this._sandBox.importFunction(dnsResolve); this._sandBox.importFunction(proxyAlert, "alert"); + // extended predefined functions + this._sandBox.importFunction(myIpAddressEx); + this._sandBox.importFunction(dnsResolveEx); // evaluate loaded js file Components.utils.evalInSandbox(pacText, this._sandBox); @@ -136,6 +139,44 @@ function dnsResolve(host) { } } +function string_list_from_resolve_list(reslist) { + var addrs = []; + if( !reslist ) + return ""; + while( reslist.hasMore() ) + addrs.push( reslist.getNextAddrAsString() ); + return( addrs.join( ";" ) ); +} + +// extended wrapper for getting local IP address called by PAC file +function myIpAddressEx() { + try { + var reslist = dns.resolve(dns.myHostName, 0); + var strlist = string_list_from_resolve_list( reslist ); + if( strlist != "" ) + return strlist; + else + return '127.0.0.1'; + } catch (e) { + return '127.0.0.1'; + } +} + +// extended wrapper for resolving hostnames called by PAC file +function dnsResolveEx(host) { + host = XPCSafeJSObjectWrapper(host); + try { + var reslist = dns.resolve(host, 0); + var strlist = string_list_from_resolve_list( reslist ); + if( strlist != "" ) + return strlist; + else + return null; + } catch (e) { + return null; + } +} + var pacModule = new Object(); pacModule.registerSelf =
Reporter | ||
Comment 1•13 years ago
|
||
Comment 2•13 years ago
|
||
Ask for review from one of the Network module owners, http://www.mozilla.org/about/owners.html . https://developer.mozilla.org/En/Developer_Guide/How_to_Submit_a_Patch#Getting_Reviews
Reporter | ||
Comment 3•13 years ago
|
||
It would be good to get both a high level reaction as well as a consideration of the patch itself. For example is this an unreasonable standard or does the implementation need to include ipv6 before accepted?
Comment 4•13 years ago
|
||
Set the feedback review request on the patch then.
Reporter | ||
Updated•13 years ago
|
Attachment #438034 -
Flags: feedback+
Updated•13 years ago
|
Attachment #438034 -
Flags: feedback+ → feedback?(bzbarsky)
![]() |
||
Comment 5•13 years ago
|
||
Sorry for the lag here; I was on leave for a while, and am finally digging through my requests. The spec seems ok to me at first glance, though this is not exactly my area of expertise. Including ipv6 would be good if it's easy, but we can probably take it without as a first cut, I think. Unless we expect compat issues due to PACs assuming ipv6 stuff will be in these functions' return values? The attached patch doesn't implement the spec, though: the failure case return values are "127.0.0.1" and null instead of "", right? This is a difference between these functions and the ones without "Ex" that's pointed out in the Chromium bug.
Status: UNCONFIRMED → NEW
Ever confirmed: true
![]() |
||
Updated•13 years ago
|
Attachment #438034 -
Flags: feedback?(bzbarsky) → feedback-
Comment 7•12 years ago
|
||
as far as i understand, all _non_ *Ex() functions shall report / work with IPv4 addresses only. currently FFs' myIpAddress() may report ::1 or other IPv6 addresses, even if a proper IPv4 address is assigned to a NIC, depending on the OS configuration (eq /etc/hosts, /etc/nsswitch.conf on unix). the *Ex() functions, which shall be available within FindProxyforURLEx(url,host), may report / work with IPv6 and IPv4 addresses. myIpAddressEx() is very much required to get a semi-colon separated list of all IP (4 and 6) addresses of the local host. as of my knowledge this is not possible with the old FindProxyforURL(url,host) api. http://blogs.msdn.com/b/wndp/archive/2006/07/13/ipv6-pac-extensions-v0-9.aspx please let me emphasize again that IPv6 is a big topic today and workarounds like turning off IPv6 (ie via network.dns.disableIPv6) are not anymore feasable. above patch may be a good start -- it would even fit my personal requirements -- but i feel simply adding the *Ex() functions for use within FindProxyforURL(url,host) is not correct.
Comment 8•9 years ago
|
||
The proxy services was completely rewritten in bug 769764 and moved from JavaScript to C++. This was for Firefox 18. That means that this patch is no longer valid. I'm adding Patrick McManus to this bug. Maybe since he now has such detailed knowledge of the PAC service from the rewrite, it might be possible to do a patch for this.
Updated•7 years ago
|
Whiteboard: [necko-backlog]
Comment 10•6 years ago
|
||
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P1
Comment 11•6 years ago
|
||
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: P1 → P3
Comment 12•4 years ago
|
||
The updated spec is available at https://docs.microsoft.com/en-us/windows/win32/winhttp/ipv6-aware-proxy-helper-api-definitions.
Comment 13•4 years ago
|
||
So uh... I am looking into fixing this issue, but being new to the code base I have a few questions:
- It looks like
dnsResolve
is not doing anything to filter out IPv6 addresses. The upstreamnsDNSService
(I assume) is indeed capable of giving IPv6 back, and judging from the codednsResolve
might just give an IPv6 address sometime. The thing is I don't really have IPv6 here... Could anyone throw a line ofalert(dnsResolve('some.ipv6-only.domain'))
in their and confirm the hypothesis for me? [The resolver class is going to walk the wholeGetNextAddr
chain and filter by theraw.family
thing. ThednsResolveEx
spec wants us to return a list anyways so we will slways need to change that.] - Same question as (1) goes for the myIpAddress. Well, the PACResolver-dependent first step is said to be v6-safe this time, so I guess I was right about the v6 possibility? The
myIPAddressEx
spec says it wants all unicast addresses for each interface too, so that's a new thing for this module to touch on. Will I find anything useful if I digged into the RTCNetwork
handling for interfaces? (I searched DXR for "eth0".)
Updated•8 months ago
|
Severity: normal → S3
Updated•27 days ago
|
Blocks: proxy-autoconfig
Updated•13 days ago
|
status-firefox113:
--- → affected
status-firefox114:
--- → affected
status-firefox115:
--- → affected
status-firefox-esr102:
--- → affected
You need to log in
before you can comment on or make changes to this bug.
Description
•