hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: SSL Site
Date Fri, 20 Apr 2007 08:55:27 GMT
On Thu, 2007-04-19 at 22:33 -0700, RossW wrote:
> 
> 
> Hi,
> 
> I think i have found the problem...kind of...i dont think it is with SSL
> now...i think it is with the authentication.  I tried another SSL site that
> doesnt need authent to access it and it worked fine.  Here is my code:
> 
> 	        HttpClient client = new HttpClient();
>  
> 	        client.getParams().setParameter("http.useragent", "Mozilla/4.0
> (compatible; MSIE 5.5; Windows NT 5.0)");
> 
> 	        client.getParams().setParameter("http.connection.timeout", 0);
> 	        client.getParams().setParameter("http.socket.timeout", 0);
> 
> 	        HostConfiguration host = client.getHostConfiguration();
> 	        
> 	        try{
> 	        host.setHost(new URI("https://www.securesite.com", true));
> 	        }
> 	        catch(Exception e)
> 	        {
> 	            
> 	        }
> 	      
> 	        client.getState().setCredentials(
> 	                new AuthScope("www.securesite.com", 443, null),
> 	                new UsernamePasswordCredentials("uname", "passwd")
> 	            );
> 
> 	        
> 	        client.getParams().setAuthenticationPreemptive(true);
> 	        
> 	        GetMethod get = new GetMethod("/");
> 	        
> 	        get.getParams().setParameter("http.useragent","Mozilla/4.0
> (compatible; MSIE 5.5; Windows NT 5.0)");
> 	        get.getParams().setParameter("http.connection.timeout",new
> Integer(0));
> 	        get.getParams().setParameter("http.socket.timeout", new
> Integer(0));
> 
> 	        
> 	        System.err.println("Authorization required by server");
> 	        
> 	        get.setDoAuthentication( true );
> 
> 	        
> 	        try {
> 
> 	            int statusCode = client.executeMethod(host, get);
> 	            
> 	            System.out.println(get.getResponseBodyAsString());
> 
> 	        } 
> 	        catch(IOException e)
> 	        {
> 	            e.printStackTrace();
> 	        }
> 	        finally {
> 
> 	            get.releaseConnection();
> 	        }
> 
> And this is the response i get:
> 
> 20/04/2007 15:28:48 org.apache.commons.httpclient.HttpMethodDirector
> executeWithRetry
> INFO: I/O exception (java.net.ConnectException) caught when processing
> request: Connection timed out: connect
> 20/04/2007 15:28:48 org.apache.commons.httpclient.HttpMethodDirector
> executeWithRetry
> INFO: Retrying request
> 
> java.net.ConnectException: Connection timed out: connect
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(Unknown Source)
> 

Ross,

(1) What is the version of JRE you are using?  

(2) Please post a _complete_ wire log of the HTTP session. Feel free to
obfuscate whatever details you deem sensitive. The information given so
far is simply not sufficient to identify the cause of the problem.

Oleg


> 


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


Mime
View raw message