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:[EMAIL PROTECTED]] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]