You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Matthew Mendez <ma...@yahoo.com> on 2007/02/09 17:24:35 UTC

Applets + Proxies Problem...

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

Re: Applets + Proxies Problem...

Posted by Roland Weber <ht...@dubioso.net>.
Hello Matthew,

the Applet grabs the proxy settings from the browser
when using the built-in HttpURLConnection. HttpClient
can not access the browser proxy settings, since Java
1.2 does not provide any such functionality. See the
discussion in the Application Design FAQ:
http://wiki.apache.org/jakarta-httpclient/FrequentlyAskedApplicationDesignQuestions

hope that helps,
  Roland


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


Re: Applets + Proxies Problem...

Posted by Julius Davies <ju...@gmail.com>.
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' <ht...@jakarta.apache.org>
>From  	Mark Claassen <mc...@ocie.net>
Subject 	RE: SocketFactoryWrapper
Date 	Mon, 18 Sep 2006 15:14:07 GMT
--------------------------------------------------------------------

http://mail-archives.apache.org/mod_mbox/jakarta-httpcomponents-dev/200609.mbox/%3c021601c6db35$16283040$19c909c0@K9%3e

Hope this helps!

yours,

Julius

On 2/9/07, Matthew Mendez <ma...@yahoo.com> 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: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org