commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Sutton <Adrian.Sut...@Ephox.com>
Subject RE: Re[2]: [httpclient] Get through a proxy problem
Date Tue, 29 Apr 2003 23:34:04 GMT
Hi Iker,
I can't even begin to guess what the problem is without at least a debug
log.  Please take a look at
http://jakarta.apache.org/commons/httpclient/troubleshooting.html and
provide as much information from the steps listed there as you can,
particularly the wire trace log.  There is more information on logging at
http://jakarta.apache.org/commons/httpclient/logging.html

Also, you probably want to take a look at the SSL code in the contrib and/or
samples directories in CVS.

Regards,

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com 

-----Original Message-----
From: Iker Bilbao [mailto:ibc19@tid.es]
Sent: Wednesday, 30 April 2003 12:09 AM
To: Tauzell, Dave
Cc: commons-user@jakarta.apache.org
Subject: Re[2]: [httpclient] Get through a proxy problem


Hola Dave,

Yes, off course. It works perfectly with the browser. It was working
until I had to go through the proxy server. If I send the request to a
machine in my LAN it works. But, when I try to obtain a page from
outside through the proxy I always get an error. The only diference
between two examples are the lines to setup the proxy.

Tuesday, April 29, 2003, 3:22:47 PM, escribió:

TD> Have you tried submitting this request with a regular web browser and
proxies set up?  Just to verify it isn't the HTTPClient?

TD> -Dave

TD> -----Original Message-----
TD> From: Iker Bilbao [mailto:ibc19@tid.es] 
TD> Sent: Tuesday, April 29, 2003 2:40 AM
TD> To: commons-user@jakarta.apache.org
TD> Subject: [httpclient] Get through a proxy problem


TD> Hello,

TD>   IŽm totally desperated. IŽm trying to make a simple get over https.
TD>   Everythings went well until I had to pass through a proxy to make
TD>   the request. This piece of code worked perfectly:

TD>   Here is my code:
TD>   -------------------
TD>   Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
TD>   System.getProperties().put("java.protocol.handler.pkgs",
"org.apache.commons.httpclient.HttpClient");
TD>   System.setProperty("javax.net.ssl.trustStore","C:\\.keystore");
TD>   System.setProperty("javax.net.ssl.keyStore","C:\\.keystore");
TD>   System.setProperty("javax.net.ssl.keyStorePassword","password");

TD>   HttpClient client = new HttpClient();
TD>   client.getState().setCredentials("realm",new
TD>
UsernamePasswordCredentials("user","password"));

TD>   GetMethod get = new getMethod("https://server:1234" +"/index.html");
TD>   get.setDoAuthentication( true );

TD>   try
TD>   {
TD>      int status = client.executeMethod( get );
TD>      System.out.println(status + "\n" + get.getResponseBodyAsString());
TD>   }
TD>   catch (HttpRecoverableException e)
TD>   {
TD>      System.err.println("A recoverable exception occurred, retrying.  "
+ e.getMessage());
TD>   }
TD>   catch (IOException e)
TD>   {
TD>      System.err.println("Failed to download file.");
TD>      e.printStackTrace();
TD>      System.exit(-1);
TD>   }
TD>   catch (Exception e)
TD>   {
TD>      e.printStackTrace();
TD>   }
  
TD>   -------------------

TD> So I added the following lines:

TD>    HttpClient client = new HttpClient();
TD>    HostConfiguration hc = new HostConfiguration();
TD>
hc.setProxy(properties.getProperty("hostProxy"),Integer.parseInt(properties.
getProperty("portProxy")));
TD>    client.setHostConfiguration(hc);
TD>    client.getState().setCredentials("realm",new
UsernamePasswordCredentials("user","password"));

TD> And I got the following error:

TD>     HTTP/1.0 500 Server Error

TD> I have tried with every nightly drop from 19th of April to 28 of April
and I always get and error. Sometimes this or sometimes another. I think
that logical the code should be like this.

TD> I have tryed a workaround I have read I the example archive called:
CustomHttpConnection.java

TD> And I always get and error or a null response.

TD> Please, can anyone give lend a hand? How can I do this?

TD> Thanks in advance por your help.
TD> Iker


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


-- 
Saludos,
 Iker                            mailto:ibc19@tid.es


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


Mime
View raw message