Closed Bug 829646 Opened 11 years ago Closed 11 years ago

Proxy Auto Config - calling myIPAddress() in the top level (outside of FindProxyForURL) fails

Categories

(Core :: Networking: HTTP, defect)

18 Branch
x86
Windows 7
defect
Not set
major

Tracking

()

VERIFIED FIXED
mozilla21
Tracking Status
firefox18 + verified
firefox19 + verified
firefox20 + fixed
firefox21 --- fixed
firefox-esr17 --- unaffected

People

(Reporter: jdrosa, Assigned: mcmanus)

References

Details

(Keywords: regression)

Attachments

(2 files)

Attached file PAC file
User agent: Mozilla/5.0 (Windows NT 6.1; rv:18.0) Gecko/20100101 Firefox/18.0

Build ID: 20130104151925

After automatically being upgraded to Firefox 18 from Firefox 17, all connectivity to internet sites, while being connected to an intranet, was lost. My browsers (I use Firefox 99% of the time, but am forced to use IE on occasion) are all configured to use a Proxy Auto Config (PAC) script to determine how to access internal vs. external websites.

Within Firefox, I had the PAC configured in the "Automatic proxy configuration URL" field. I then changed my Firefox configuration to the "Use system proxy settings," with no change in behavior. I could access intranet sites, but received the "Server not found" response whenever attempting to connect to external sites.

I then manually configured the proxy settings to force the use of the proxy server and I regained access to external sites, but then lost connectivity to internal sites.

I then placed a copy of the PAC on my local hard drive and reconfigured Firefox  to use the PAC on my local hard drive. Once again, no external connectivity.

All the while I was able to use IE and Chrome (after downloading it, I hate IE) to access internal and external sites using the non-local PAC URL.

Attached is a copy of the PAC.
The problem is 
var index = myIpAddress().lastIndexOf(".") + 1;
var myiparray = myIpAddress().split(".");

when myIPAddress() is executed outside of the context of calling FindProxyForURL() (in this case during pac file load time) it fails.

that's my bug. sorry.

your workaround is just to move those global lines into FindProxyForURL() and life should be good.
Depends on: 769764
one other note - myIPAddress() is actually somewhat dependent on the host being looked up in FindProxyForURL().. in the case you have more than one IP address it will return the one that would be used to directly connect to that host... that's where the conflict came in.

I'll make it deal with the discrepancy, but you'll get a more accurate answer if your pac code scopes myIPAddress inside FindProxyForURL()
Attached patch patch 0Splinter Review
Attachment #701212 - Flags: review?(cbiesinger)
Component: Preferences → Networking: HTTP
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Firefox 18 - Proxy Auto Config Script - Not Working → Proxy Auto Config - calling myIPAddress() in the top level (outside of FindProxyForURL) fails
Blocks: 769764
No longer depends on: 769764
Keywords: regression
Attachment #701212 - Flags: review?(cbiesinger) → review+
I don't own the PAC script, but I will pass that recommendation on to the people that do.

Thanks for looking into this. I really hate using IE and Chrome just irritates me, so not having FF to use just ruins my day.

(In reply to Patrick McManus [:mcmanus] from comment #2)
> one other note - myIPAddress() is actually somewhat dependent on the host
> being looked up in FindProxyForURL().. in the case you have more than one IP
> address it will return the one that would be used to directly connect to
> that host... that's where the conflict came in.
> 
> I'll make it deal with the discrepancy, but you'll get a more accurate
> answer if your pac code scopes myIPAddress inside FindProxyForURL()
https://hg.mozilla.org/mozilla-central/rev/c5bb3265e36e
Assignee: nobody → mcmanus
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Patrick - please help us understand the likelihood that this is a commonly occurring bug for proxy users on FF18, and the risk of regression if uplifted.

Please also prepare uplifts to FF19/20 asap.
Flags: needinfo?(mcmanus)
(In reply to Alex Keybl [:akeybl] from comment #7)
> Patrick - please help us understand the likelihood that this is a commonly
> occurring bug for proxy users on FF18, and the risk of regression if
> uplifted.
> 

A PAC file is an arbitrary piece of javascript and this bug covers one such file.. obviously there an infinite number of possible pac configurations - its really hard to know how common this would be other than to say
 * only 1 person has reported the problem
 * the issue is with the global context and anecdotally most people just define 1 function (the required FindProxyForURL()) in their pac. But because its an arbitrary script its really hard to say

> Please also prepare uplifts to FF19/20 asap.

its the first thing I'll do after dropping my kid at school this morning. The fix is very eay to reason about in terms of safety.
Flags: needinfo?(mcmanus)
Comment on attachment 701212 [details] [diff] [review]
patch 0

[Approval Request Comment]
Regression caused by (bug #): 769764
User impact if declined: myIpAddress() PAC helper function fails when used in top lovel scope. User can work around it if and only if they control the contents of the PAC file they are using.
Testing completed (on m-c, etc.): on m-c
Risk to taking this patch (and alternatives if risky): low - small fix.
Attachment #701212 - Flags: approval-mozilla-release?
Attachment #701212 - Flags: approval-mozilla-beta?
Attachment #701212 - Flags: approval-mozilla-aurora?
Attachment #701212 - Flags: approval-mozilla-beta?
Attachment #701212 - Flags: approval-mozilla-beta+
Attachment #701212 - Flags: approval-mozilla-aurora?
Attachment #701212 - Flags: approval-mozilla-aurora+
Attachment #701212 - Flags: approval-mozilla-release? → approval-mozilla-release+
Keywords: verifyme
Checked in 18.0 on Mac OS X using the pac file here, editing the proxy addresses with a different proxy. It didn't work in 18.0. It works with 18.0.1.
This issue is verified on Firefox 19 beta 6 (Build ID: 20130212082553), on the next machines:

1) Ubuntu 12.04 64-bit
2) Windows 7 64-bit
3) Windows 8 32-bit
4) Mac OSX 10.6.8

I've verified it by changing all the proxies from the end of the attached pac file with  81.196.129.33:8080 and it works for me.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: