hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Coleman <nick.cole...@leanlogistics.com>
Subject RE: proxy and howto's and some questions.
Date Wed, 19 Feb 2003 14:09:00 GMT
Feel free to do with this code as you will.  If it was in a generic Apache
utility it would probably be better maintained in the future.

-Nick

-----Original Message-----
From: Ortwin Gl├╝ck [mailto:ortwin.glueck@nose.ch] 
Sent: Wednesday, February 19, 2003 4:27 AM
To: Commons HttpClient Project
Subject: Re: proxy and howto's and some questions.


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());
>    }
> }



---------------------------------------------------------------------
To unsubscribe, e-mail:
commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
commons-httpclient-dev-help@jakarta.apache.org

Mime
View raw message