hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: SSL & proxy question
Date Fri, 24 Jan 2003 15:59:54 GMT
Armando,
It's this bit of code in HttpClient.execute() that makes a difference.

...
if (!connection.isOpen()) {
  connection.setSoTimeout(soTimeout);
  connection.setConnectionTimeout(connectionTimeout);
  connection.open();
  if (connection.isProxied() && connection.isSecure()) {
    method = new ConnectMethod(method);
  }
}
...     

Cheers

Oleg


-----Original Message-----
From: Armando Anton [mailto:armando.anton@newknow.com]
Sent: Freitag, 24. Januar 2003 16:52
To: Commons HttpClient Project
Subject: RE: SSL & proxy question


Hi Michael,

it works perfectly! and it uses the tunnelCreated method of the HttpConnection class

do you know why the behaviour is different using the HttpClient or creating a new HttpConnection
(as i did in the first example)?

i would like to create my own HttpConnection better than using the HttpClient, so i don't
know if i must implement something in my code to manage SSL and proxies or there is a bug
in the HttpMethodBase

thanks again :)

Armando

-----Original Message-----
From: Michael Becke [mailto:becke@u.washington.edu]
Sent: viernes, 24 de enero de 2003 16:10
To: Commons HttpClient Project
Subject: Re: SSL & proxy question


Armando,

I'm not sure if this will make a difference, but just to be sure can you 
try executing using the following code:

     public static void main(String[] args) throws Exception {
         HttpClient client = new HttpClient();
         client.getHostConfiguration().setProxy( "proxy.xxx.com", 80 );

         String _uri = "https://www.pairnic.com:443/main.m";
         GetMethod method = new GetMethod( _uri );

         int status = client.executeMethod( method );

         System.out.println("Status: " + status);
         System.out.println(method.getResponseBodyAsString()); 

     }

This does essentially the same thing but internally might be subtly 
different.

Mike

Armando Anton wrote:
> hi Aaraon,
> i think the proxy works well because i can access to secure pages using web explorers
that use the proxy too
> 
> -----Original Message-----
> From: Aaron Bonner [mailto:ajbonner@netspace.net.au]
> Sent: viernes, 24 de enero de 2003 14:10
> To: Commons HttpClient Project
> Subject: Re: SSL & proxy question
> 
> 
> Heya Armando,
> Just remember not all proxy's are created equal, some proxy's are configured
> such that they do not permit SSL connections via them. If the proxy is
> returning "method/protocol not available" this generally means the proxy is
> configured such that you cannot use it for your SSL request.
> 
> To double check though attempt to use another proxy, one you are sure is
> configured to allow such SSL requests.
> 
> ----- Original Message -----
> From: "Armando Antón" <armando.anton@newknow.com>
> To: "Commons HttpClient Project (E-mail)"
> <commons-httpclient-dev@jakarta.apache.org>
> Sent: Friday, January 24, 2003 11:24 PM
> Subject: SSL & proxy question
> 
> 
> Hi!
> 
> i am trying to coonect to a secure page using a proxy and i am getting
> always the same error and i have no idea how can i solve it
> i hopes someone can open my eyes and help me to understand what i am doing
> wrong or if there is a bug :)
> 
> basically i am doing this:
> 
> import org.apache.commons.httpclient.URI;
> import org.apache.commons.httpclient.HttpConnection;
> import org.apache.commons.httpclient.HttpState;
> import org.apache.commons.httpclient.methods.GetMethod;
> 
> public class TestSSLAndProxy {
> 
>     public static void main(String[] args) throws Exception {
> 
>         String _uri = "https://www.pairnic.com:443/main.m";
>         boolean isSecure = true;
>         URI uri = new URI(_uri.toCharArray()); // i like this constructor :)
>         GetMethod method = new GetMethod( uri.toString() );
>         String host = uri.getHost();
>         int port = uri.getPort();
>         HttpConnection connection = new HttpConnection( host, port, true );
>         connection.setProxyHost("proxy.xxx.com");
>         connection.setProxyPort(80);
>         int status = method.execute(new HttpState(), connection);
>         System.out.println("Status: " + status);
>         System.out.println(method.getResponseBodyAsString());
>     }
> }
> 
> And i get this response:
> Status: 501
> And a spanish message (of the proxy i am using) about that the requested
> method and protocol are not supported
> 
> I have looked for something related in the bugzilla database and i have
> found the same problem in the bug 4502
> (http://issues.apache.org/bugzilla/show_bug.cgi?id=4502)
> 
> i have seen in the HttpConnection a method called tunnelCreated that sounds
> fantastic but i am not sure how to use it correctly
> 
> can someone help me? :)
> 
> Thanks,
> 
> Armando
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-httpclient-dev-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-httpclient-dev-help@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-httpclient-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-httpclient-dev-help@jakarta.apache.org>
> 


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


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


Mime
View raw message