Java Plug-in should try all proxies returned by auto-proxy script Engineering Specification

RFE:  4480339

Author:Xiaobin Lu
Date: Feb 25, 2002
 
 

1 Project Description

1.1 Overview

This goal of this RFE is to change the current mechanism of Java Plug-in to handle the auto proxy configuration. Currently we just return the first match of proxy server in the returned list of "FindProxyForURL" function no matter whether it is dead or alive. This RFE is to make Java Plug-in to return the first alive proxy in the list.

1.2 Project Dependencies

N/A

1.3 OS and Browser Compatibility and Interoperability

This feature will be available for all supported platforms.

1.4 Performance and Scalability

N/A

1.5 Security

N/A

1.6 Internationalization (I18N) / Localization (L10N)

N/A

1.7 Packaging

N/A

1.8 Usability

This feature enhances the usability of JRE/JPI in terms of networking.

1.9 Quality

1.9.1 Unit or Functional Tests to be Delivered
 
1.9.2 Additional Testing Notes
In order to test this, you probably need to set up a webserver which stores the proxy autoconfig file. Look at your Netscape configuartion at Unix, you will probably find a pac file. Here is the typical proxy autoconfiguration script:

function FindProxyForURL(url, host) {
    return "PROXY wcscab.SFBay.Sun.COM:8080;" +
           "PROXY wcscaa.SFBay.Sun.COM:8080;" +
           "PROXY wcmpka.Eng.Sun.COM:8080;" +
           "PROXY wcnwkc.EBay.Sun.COM:8080";
  }

// End FindProxyForURL

You can change the return value to add an invalid proxy server at the beginning of this list. Go to Java control panel, open "Proxies" tab and point the URL of the script into the Autoconfig Proxy URL field. After changing this, apply the change and open the browser and go to java.sun.com, you should be able to see the applet working after the fix of this RFE.
 

2 Technical Description

2.1 Architecture

The goal of this RFE is:

1. Find the first alive proxy server from the returned list of "FindProxyForURL".

2. If any proxy server is down, but it is up after 10 minutes, plugin may pick up and use it.

3. If any proxy server is up, but it is down after 30 minutes, plugin may ignore to use it.

4. If all the proxy server are dead, return the first proxy found.

 The second goal guarantees that if the admin shut down the proxy and turn on it later, the proxy can be used at most after 10 minutes. The third goal makes plugin be smart enough to ignore the dead proxy.  To make sure it does not have regression, we add the fourth one.

Here is the algorithm. Assume that each time the function "FindProxyForURL" return some string like p1: p2: p3:...pi...pn (pi includes host and port number, 1<=i<=n). A table Tp  which can be implemented as a hash map is used to cache the proxy information. Each entry of Tp uses proxy as a key, the status (alive and dead) plus the timestamp as the value.

For i = 1.. n
   Look up pi in Tp.
     If it is not in the cache
        Ping pi, if it is alive, store it in the cache and update the timestamp. Return.

    If pi is timeout (meaning the difference between the current time and the time recorded in the cache is greater or equal to 30 minutes/10 minutes depends on the status of the proxy).
        Ping pi, if alive, update the cache entry. Return

    If pi is alive, return
      else i = i+1, continue the loop.
// If out of the loop, all the proxy are dead
return p1.

Two notes:
1. There is a timeout value associated with the ping action. The default value is 2seconds.  The user may change this value by changing the system property "javaplugin.proxy.timeout".

2. Considering a special case. If pi is DIRECT, we need to be able to correctly handle this. So we prepopulte the table with a "DIRECT" entry and we always think "DIRECT" is alive, so it can be returned correctly.

2.2 Exported Interfaces/API

In order to make "ping timeout" configurable, we exported two methods in AutoProxyHandler.java so that it can be easly hooked with other code.

* public void setPingTimeout(int timeout);
parameter: timeout, is the ping timeout in milliseconds

* public int getPingTimeout();
return value: the current ping timeout using.

2.3 Imported Interfaces/API

N/A

2.4 User Interface

N/A
 
 
 

3 Marketing

3.1 Justification

In the Java plug-in proxy document at: http://java.sun.com/products/plugin/1.3/docs/proxies.html, it says: "the function FindProxyForURL always returns proxy information as a string. Java Plug-in extracts the setting in the following way...If 'PROXY' is in the string, it uses the first proxy setting for the connection." However, as described in the Netscape auto-proxy documentation at: http://devedge.netscape.com/docs/manuals/proxy/adminnt/autoconf.htm
the return value of FindProxyForURL is a list of entries separated by semicolons.  If the first proxy in the list cannot be contacted, the next one
should be used.

The customers are requesting that the plug-in implement the same behavior.  That is, if the attempt to contact the first proxy fails, the next proxy in the list should be used, and so on.

3.2 Customer Request

Above

3.3 Competitive Analysis


4 Management and Planning

4.1 Scope/Priority

P4/S4

4.2 Target Release

Hopper

4.3 Resources

4.3.1 Development
Xiaobin Lu
4.3.2 Quality Assurance/Testing
4.3.3 Documentation
4.3.4 Technical Support
4.3.4 Special Hardware/Software

4.4 Schedule



Start Date End Date Activity Owner Status
3/8/2002  3/15/2002     
 

         
Complete Started Not Started Difficulties Trouble

 

Appendices (as needed, suggestions below)

A. Background Information

B. Interface Specifications

C. Notes and Additional Details

D. Miscellaneous

E. Tracking

E.1 Final Webrev
E.2 Bugtraq


Bugid P S Subcategory Type Engineer Synopsis
             

 
 

Revision History



Date Version Author Description