hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ortwin Gl├╝ck <ortwin.glu...@nose.ch>
Subject Re: proxy and howto's and some questions.
Date Wed, 19 Feb 2003 09:26:43 GMT
Could we provide the code below in some Utility function?
I guess this is convenient for people making Applets  - although Applets 
are generally a bad idea :-)

Nick, can we adopt this piece of code under the Apache License?

We should think about pac-proxy script parsing as well at some point.

Odi



Nick Coleman wrote:
> We detect the browser proxy settings as follows:
> 
> // Retrieve Proxy Server Settings from System if specified
> String proxyList = System.getProperty("javaplugin.proxy.config.list");
> if (proxyList!=null && !"".equals(proxyList)){
>    StringTokenizer tokenizer1 = new StringTokenizer(proxyList, ";,");
>    if (tokenizer1.countTokens()>1){
>       while (tokenizer1.hasMoreTokens()){
>          String s = tokenizer1.nextToken();
>          if (s.toLowerCase().startsWith("http")){
>             StringTokenizer tokenizer2 = new StringTokenizer(s, "=:");
>             tokenizer2.nextToken();
>             proxyHost = tokenizer2.nextToken();
>             proxyPort = Integer.parseInt(tokenizer2.nextToken());
>          }
>       }
>    }
>    else {
>       StringTokenizer tokenizer = new StringTokenizer(proxyList, ":");
>       proxyHost = tokenizer.nextToken();
>       proxyPort = Integer.parseInt(tokenizer.nextToken());
>    }
> }



Mime
View raw message