HttpClient doesn't automatically grab proxy settings.  You'll have to
automatically grab them in your own code and then apply them to
HttpClient.  This FAQ should help:

http://wiki.apache.org/jakarta-httpclient/FrequentlyAskedApplicationDesignQuestions

(If only Google would pick that page up!)

If you're using "https" then there's a different problem with proxy
settings.  ("https" proxies and "http" proxies are very different
animals.)  HttpClient 3.x and 2.x are using
SSLSocketFactory.getDefault() which doesn't grab the browser's SSL
proxy settings.  To grab the browser's SSL proxy settings you have to
use HttpsURLConnection.getDefaultSSLSocketFactory().  For some reason
*that* socket factory knows how to automatically use IE's SSL proxy
settings (and client certs, too!).

Mark Claasen has a nice patch for HttpClient 3.x:

https://issues.apache.org/jira/browse/HTTPCLIENT-601

His emails were mostly to the "dev" list, though.  This email in
particular has some excellent information for working with SSL proxies
and HttpClient:

--------------------------------------------------------------------
To: 'HttpClient Project' <[email protected]>
From    Mark Claassen <[EMAIL PROTECTED]>
Subject         RE: SocketFactoryWrapper
Date    Mon, 18 Sep 2006 15:14:07 GMT
--------------------------------------------------------------------

http://mail-archives.apache.org/mod_mbox/jakarta-httpcomponents-dev/200609.mbox/[EMAIL
 PROTECTED]

Hope this helps!

yours,

Julius

On 2/9/07, Matthew Mendez <[EMAIL PROTECTED]> wrote:
All,

Having a problem that I've scoured the Internet for about a week, as well as 
looking through archives and not been able to find a solution/explanation.

Am using an applet and HttpClient for applet/servlet application.  Have 11 
clients, and 3 of them have a problem.  Basically, the applet loads, but 
doesn't allow client/servlet communication (HttpClient times out).  I am using 
port 80, so it shouldn't be a firewall issue.  One of them called me today and 
said that he went into IE Advanced tab, turned off the proxy (and turned on the 
firewall) and everything was fine.  I had reasoned through at some point that 
the proxy might be causing errors with stale data or perhaps because the applet 
is untrusted, it can only communicate with the original server which is not the 
proxy.  However, when I downloaded Squid and ran through all sorts of tests 
(including setting the proxy in IE as Squid), I didn't have any problems.  All 
my reading suggets that the JRE is supposed to grab the proxy setttings from 
the browser and that no additional code is necessary if it's an applet and not 
a application.  One other thing I considered was
 putting the ip address in the connect string instead of the url (thinking that 
the proxy didn't do DNS lookup), but that doesn't amke any sense.  Any help or 
thoughts would be appreciated.

Thanks in advance,
Matt


--
yours,

Julius Davies
416-652-0183
http://juliusdavies.ca/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to