Closed Bug 155567 Opened 22 years ago Closed 20 years ago

PAC: isResolvable() does not work when executed from global scope.

Categories

(Core :: Networking, defect, P5)

defect

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: askwar, Assigned: darin.moz)

References

Details

Attachments

(2 files)

From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (WinNT; U)
BuildID:    2002061104

Our network setup requires us to use a proxy to access the internet.  This proxy 
is setup using auto proxy configuration and proxy authorization.

Reproducible: Always
Steps to Reproduce:
1. Select Automatic Proxy Configuration URL
2. Set URL to a auto proxy (for me, that is http://autoproxy2.delphiauto.net)
3. Try to access some external site (like http://mozilla.org)

Actual Results:  No proxy authorization dialog is shown. Thus I cannot access 
external sites.

Expected Results:  Proxy auth dialog should be shown.

This setup works using Netscape 4.75.  This also used to work with some 0.9.x 
releases back in December 2001.

1.0 (2002053012) also does not work.
It seems to be, that Mozilla simply doesn't read/"understand"
the autoproxy configuration as returned by the proxy server.
When I manually set the proxy to our proxy adress, Mozilla
prompts me for my username/password.

When I download the proxy configuration with wget, I get this:

[d:\temp]wget -S -Y off http://autoproxy2.delphiauto.net
--08:53:08--  http://autoproxy2.delphiauto.net/
           => `index.html'
Resolving autoproxy2.delphiauto.net... done.
Connecting to autoproxy2.delphiauto.net[130.171.205.17]:80... connected.
HTTP request sent, awaiting response...
 1 HTTP/1.1 200 OK
 2 Date: Fri, 05 Jul 2002 06:44:17 GMT
 3 Server: Apache/1.3.20 (Unix)
 4 Connection: close
 5 Content-Type: application/x-ns-proxy-autoconfig

    [ <=>                                 ] 4,028          3.84M/s

08:53:09 (3.84 MB/s) - `index.html' saved [4028]

And when I use the proxy to access an internet site, using wget I get:

Resolving inetproxy3.delphiauto.net... done.
Connecting to inetproxy3.delphiauto.net[130.171.205.13]:80... connected.
Proxy request sent, awaiting response...
 1 HTTP/1.0 407 Proxy Authentication Required
 2 Date: Fri, 05 Jul 2002 06:49:12 GMT
 3 Content-Length: 1131
 4 Content-Type: text/html
 5 Server: NetCache (NetApp/5.2.1R1D10)
 6 Connection: keep-alive
 7 Proxy-Authenticate: Basic realm="Delphi GDS UID for Internet Access"
08:49:18 ERROR 407: Proxy Authentication Required.
Any news on this bug?
Is this still a problem in 1.1 or later?

pi
The problem is still present in 1.1 on Windows.  Don't know about other
architectures.

FWIW: Opera also doesn't work...
Can I use your proxy to test this?

pi
No, you can't.  It's behind a firewall in our Intranet.

But tell me what to do and I'll supply you as much information as needed!
I've now updated to the latest Nightly - Build 2002091004 on Windows (NT). 
Problem still exists.
I've just downloaded the latest (2002-10-22) nightly for Windows, and there the
problem went away.  Right now, I'm using 1.1 on HP-UX 11.00 (Mozilla/5.0 (X11;
U; HP-UX 9000/780; en-US; rv:1.1) Gecko/20020828) and there autoproxy conf +
auth doesn't work.  Later today, or at least this week, I'll try the then
current nightly.
Any news?

pi
No.  It was a false positive in my last comment.  Proxy auth doesn't work on
Windows - and also doesn't on HPUX.
Changing Hardware and OS to All/All, as this bug is present on HPUX and Windows
NT and XP.
OS: Windows NT → All
Hardware: PC → All
Probably a dupe. Blocks bug 79893
Blocks: 79893
Status: UNCONFIRMED → NEW
Component: Networking: HTTP → Networking
Ever confirmed: true
QA Contact: tever → benc
Whiteboard: dupeme
WFM, mozilla 1.2b w/ pac that points to Netscape Proxy 3.5x w/ proxy auth on.

When this fails w/ .pac, do you get an error? What happens? If you don't get an
error page from your proxy server, something else might be wrong.

You might want to try a very simple PAC file, like:

function FindProxyForURL(url, host)
{
        return "PROXY inetproxy3.delphiauto.net:80";
} 

Save this to a file on your desktop as proxy.pac, then use the file URL in the pref:

file:///C:/WINDOWS/Desktop/proxy.pac.proxy
Summary: Proxy Authorization dialog isn't shown with autoproxy conf → PAC: proxy auth doesn't seem to show
Whiteboard: dupeme
Yipee!  I finally found it!

When I remove/comment the following lines, the auto proxy configuration works:

	if (!(isResolvable("apollo.delphiauto.com"))) {
		alert ("You are not connected to the Delphi network.")
		internet = "DIRECT";
		direct = "DIRECT";
    }

So, it seems that the problem is either in the function isResolvable or the way
that it is called.
alex: if you leave that code-bit as is, do you get any javascript exceptions
(use the javascript console to check)?  i'm curious if the fact that that code
is at global scope has anything to do with the problems you had w/ your PAC file.
Darin:

I do get an error:

Error: dnsResolve is not defined
Source File: file:///C:/Dokumente%20und%20Einstellungen/askwar.D8RJRJ0J/Eigene%
20Dateien/TEST_Mozilla_Auto-Proxykonfiguration.pac
Line: 36

When I move the offending if(!(isReolvable(.... construct into the 
FindProxyForURL function, everything works.
hmm.. i wonder if it has something to do with the JS "sandbox" in which
FindProxyForURL is executed.

maybe gagan or phil would know something about this.
isResolvable isn't implemented yet. At the very least I think we should change
the NS_OK to be NS_ERROR_NOT_IMPLEMENTED (maybe I'll add a patch soon)
gagan: hmm... nsProxyAutoConfigUtils seems to be unused, and i think
nsProxyAutoConfigUtils is just an empty implementation that should perhaps be
removed from the tree.  all of the code for isResolvable is inside
nsProxyAutoConfig.js.
Oh right! 
Hmmm... I wonder what could be then. A remote possibility is that the PAC
component is loading before rest of necko (to do the DNS resolve) and since the
top function is getting called as soon as the file is loaded it may not be
ready... shouldn't be too hard to confirm that.
Upated summary.

Bug 79057 says dnsResolve() should work. That was the only bug I could find that
mentioned a problem related to this function.
Summary: PAC: proxy auth doesn't seem to show → PAC: isResolvable() does not work.
correcting summary.  isResolvable works fine when called from FindProxyForURL...
there are simply problems calling it from global scope.

severity : minor
Severity: major → minor
Status: NEW → ASSIGNED
Priority: -- → P5
Summary: PAC: isResolvable() does not work. → PAC: isResolvable() does not work when executed from global scope.
Target Milestone: --- → Future
well, comment 18 was spot on. looking at this file at the time of this bug filing:
http://bonsai.mozilla.org/cvsblame.cgi?file=mozilla/netwerk/base/src/nsProxyAutoConfig.js&rev=1.21&mark=148,156#140
dnsResolve is only set after evaluating.

bug 246872 fixed this. marking so.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Depends on: 246872
Resolution: --- → FIXED
V/fixed, via depends.
Status: RESOLVED → VERIFIED
ACK
This works vey fine for quite some time now.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: