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: javax.net.ssl.SSLException: Unrecognized SSL handshake.
Date Mon, 20 Jun 2005 08:28:35 GMT
On Mon, Jun 20, 2005 at 04:23:25PM +0800, pavan kumar wrote:
> Hi Oleg,
> 
> Nice talking to you..
> 
> I dont understand correctly, is there a way from HttpClient code to get an object of
HttpURLConnection or HttpsURLConnection..
> 

There's not. What I can't understand is why you want HttpURLConnection in
the first place? The HttpUrlConnection framework is competely broken for
anything but the most trivial HTTP GET and POST

Oleg


> 
> Thanks in advance.
> Pavan
> 
> ----- Original Message -----
> From: "Oleg Kalnichevski" <olegk@apache.org>
> To: httpclient-user@jakarta.apache.org
> Subject: Re: javax.net.ssl.SSLException: Unrecognized SSL handshake.
> Date: Mon, 20 Jun 2005 10:07:09 +0200
> 
> > 
> > Pavan,
> > 
> > Why on earth do you want to be using Http(s)URLConnection to implement
> > the secure tunneling?
> > 
> > Oleg
> > 
> > 
> > On Mon, Jun 20, 2005 at 03:52:20PM +0800, pavan kumar wrote:
> > > Hi Dennis and others,
> > >
> > > I am also having the same problem. I too have a custom
> > > SSLTunnelSocketFactory code and I want to get a connection to a secured
> > > website authenticating the Proxy with NTLM mechanism.
> > >
> > > I am not sure how do I go about it ? I am using JDK1.3_x with JCE and
> > > JSSE integrated, commons-httpclient-3.0-rc2.
> > >
> > > Authentication is not a problem for me. But how do I tunneling to a
> > > secured site. After authentication, I am looking for a piece of code that
> > > returns a HttpURLConnection or HttpsURLConnection or an URL connection
> > > atleast to do the SSL Tunnelling.
> > >
> > > Can some one seriously take this into concern and answer my problem,
> > > currently this is an important issue in our team.
> > >
> > > Thanks In Advance
> > >
> > > Pavan
> > >
> > >
> > >
> > >   ----- Original Message -----
> > >   From: Dennis.Sharpe@rich.frb.org
> > >   To: httpclient-user@jakarta.apache.org
> > >   Subject: javax.net.ssl.SSLException: Unrecognized SSL handshake.
> > >   Date: Thu, 16 Jun 2005 13:20:12 -0400
> > >
> > >   >
> > >   > I am having trouble connecting to a secure website through a proxy
> > >   server
> > >   > using httpclient. I have some manual code that works using
> > >   > SSLTunnelSocketFactory and I'm wondering if maybe I am missing an
> > >   API call
> > >   > or something like that. For testing, I am just using the etrade
> > >   website.
> > >   > I changed the name of the proxy server in my code snippet for
> > >   security
> > >   > reasons. Any ideas would be greatly appreciated.
> > >   >
> > >   > Thanks,
> > >   > Dennis
> > >   >
> > >   > Here is the trace output:
> > >   >
> > >   > 2005/06/16 13:11:16:730 EDT [TRACE] GetMethod - -enter
> > >   GetMethod(String)
> > >   > 2005/06/16 13:11:16:824 EDT [TRACE] ConnectMethod - -enter
> > >   > ConnectMethod(HttpMethod)
> > >   > 2005/06/16 13:11:16:824 EDT [TRACE] ConnectMethod - -enter
> > >   > ConnectMethod.execute(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:16:824 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.execute(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:16:824 EDT [DEBUG] HttpMethodBase - -Execute loop
> > >   try 1
> > >   > 2005/06/16 13:11:16:824 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.processRequest(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:16:840 EDT [TRACE] HttpMethodBase - -Attempt
> > >   number 1 to
> > >   > process request
> > >   > 2005/06/16 13:11:16:840 EDT [DEBUG] HttpMethodBase - -Opening the
> > >   > connection.
> > >   > 2005/06/16 13:11:16:840 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.open()
> > >   > 2005/06/16 13:11:16:918 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.writeRequest(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:16:918 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.printLine(String)
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.writeLine(byte[])
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.writeLine()
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:16:949 EDT [DEBUG] header - ->> "CONNECT
> > >   > us.etrade.com:443 HTTP/1.1"
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection)
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] ConnectMethod - -enter
> > >   > ConnectMethod.addRequestHeaders(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addUserAgentRequestHeaders(HttpState,
> > >   HttpConnection)
> > >   > 2005/06/16 13:11:16:949 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addHostRequestHeader(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:16:949 EDT [DEBUG] HttpMethodBase - -Adding Host
> > >   request
> > >   > header
> > >   > 2005/06/16 13:11:16:965 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addProxyAuthorizationRequestHeader(HttpState,
> > >   > HttpConnection)
> > >   > 2005/06/16 13:11:16:965 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addProxyConnectionHeader(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:16:965 EDT [DEBUG] header - ->> "User-Agent:
> > >   Jakarta
> > >   > Commons-HttpClient/2.0.2[\r][\n]"
> > >   > 2005/06/16 13:11:16:965 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.print(String)
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:16:996 EDT [DEBUG] header - ->> "Host:
> > >   > us.etrade.com[\r][\n]"
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.print(String)
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:16:996 EDT [DEBUG] header - ->> "Proxy-Connection:
> > >   > Keep-Alive[\r][\n]"
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.print(String)
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.writeLine()
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:16:996 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:17:011 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.flushRequestOutputStream()
> > >   > 2005/06/16 13:11:17:011 EDT [DEBUG] header - ->> "[\r][\n]"
> > >   > 2005/06/16 13:11:17:011 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.flushRequestOutputStream()
> > >   > 2005/06/16 13:11:17:011 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.readResponse(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:17:011 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.readStatusLine(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:17:011 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.readLine()
> > >   > 2005/06/16 13:11:17:011 EDT [TRACE] HttpParser - -enter
> > >   > HttpParser.readLine()
> > >   > 2005/06/16 13:11:17:011 EDT [TRACE] HttpParser - -enter
> > >   > HttpParser.readRawLine()
> > >   > 2005/06/16 13:11:17:058 EDT [DEBUG] header - -<< "HTTP/1.1 200
> > >   Connection
> > >   > established[\r][\n]"
> > >   > 2005/06/16 13:11:17:058 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.readResponseHeaders(HttpState,HttpConnection)
> > >   > 2005/06/16 13:11:17:058 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.getResponseInputStream()
> > >   > 2005/06/16 13:11:17:058 EDT [TRACE] HttpParser - -enter
> > >   > HeaderParser.parseHeaders(HttpConnection, HeaderGroup)
> > >   > 2005/06/16 13:11:17:058 EDT [TRACE] HttpParser - -enter
> > >   > HttpParser.readLine()
> > >   > 2005/06/16 13:11:17:058 EDT [TRACE] HttpParser - -enter
> > >   > HttpParser.readRawLine()
> > >   > 2005/06/16 13:11:17:058 EDT [TRACE] HttpParser - -enter
> > >   > HttpParser.readLine()
> > >   > 2005/06/16 13:11:17:058 EDT [TRACE] HttpParser - -enter
> > >   > HttpParser.readRawLine()
> > >   > 2005/06/16 13:11:17:058 EDT [DEBUG] header - -<< "Proxy-agent:
> > >   > BlueCoat-Security-Appliance[\r][\n]"
> > >   > 2005/06/16 13:11:17:074 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.processResponseHeaders(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:17:121 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.readResponseBody(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:17:121 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.readResponseBody(HttpConnection)
> > >   > 2005/06/16 13:11:17:121 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.getResponseInputStream()
> > >   > 2005/06/16 13:11:17:121 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.canResponseHaveBody(int)
> > >   > 2005/06/16 13:11:17:121 EDT [INFO] HttpMethodBase - -Response
> > >   content
> > >   > length is not known
> > >   > 2005/06/16 13:11:17:121 EDT [DEBUG] HttpMethodBase - -Force-close
> > >   > connection: true
> > >   > 2005/06/16 13:11:17:136 EDT [DEBUG] ConnectMethod - -CONNECT status
> > >   code
> > >   > 200
> > >   > 2005/06/16 13:11:17:136 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.tunnelCreated()
> > >   > 2005/06/16 13:11:22:808 EDT [DEBUG] HttpConnection - -Secure tunnel
> > >   > created
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.execute(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [DEBUG] HttpMethodBase - -Execute loop
> > >   try 1
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.processRequest(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -Attempt
> > >   number 1 to
> > >   > process request
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.writeRequest(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.writeRequestLine(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.generateRequestLine(HttpConnection, String, String,
> > >   String,
> > >   > String)
> > >   > 2005/06/16 13:11:22:808 EDT [DEBUG] header - ->> "GET /e/t/home
> > >   > HTTP/1.1[\r][\n]"
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.print(String)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addRequestHeaders(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addUserAgentRequestHeaders(HttpState,
> > >   HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addHostRequestHeader(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [DEBUG] HttpMethodBase - -Adding Host
> > >   request
> > >   > header
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addCookieRequestHeader(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:808 EDT [TRACE] HttpState - -enter
> > >   > HttpState.getCookies()
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] CookieSpec - -enter
> > >   > CookieSpecBase.match(String, int, String, boolean, Cookie[])
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addAuthorizationRequestHeader(HttpState,
> > >   HttpConnection)
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addProxyAuthorizationRequestHeader(HttpState,
> > >   > HttpConnection)
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addProxyConnectionHeader(HttpState, HttpConnection)
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpMethodBase - -enter
> > >   > HttpMethodBase.addContentLengthRequestHeader(HttpState,
> > >   HttpConnection)
> > >   > 2005/06/16 13:11:22:824 EDT [DEBUG] header - ->> "User-Agent:
> > >   Jakarta
> > >   > Commons-HttpClient/2.0.2[\r][\n]"
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.print(String)
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:22:824 EDT [DEBUG] header - ->> "Host:
> > >   > us.etrade.com[\r][\n]"
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.print(String)
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.writeLine()
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[])
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.write(byte[], int, int)
> > >   > 2005/06/16 13:11:22:824 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.flushRequestOutputStream()
> > >   > 2005/06/16 13:11:22:839 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.close()
> > >   > 2005/06/16 13:11:22:839 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.closeSockedAndStreams()
> > >   > 2005/06/16 13:11:22:839 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.close()
> > >   > 2005/06/16 13:11:22:839 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.closeSockedAndStreams()
> > >   > 2005/06/16 13:11:22:839 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.close()
> > >   > 2005/06/16 13:11:22:839 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.closeSockedAndStreams()
> > >   > 2005/06/16 13:11:22:839 EDT [TRACE] HttpConnection - -enter
> > >   > HttpConnection.releaseConnection()
> > >   > javax.net.ssl.SSLException: Unrecognized SSL handshake.
> > >   > at
> > >   >
> > >   
> > > org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2319)
> > >   > at
> > >   >
> > >   
> > > org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java:2692)
> > >   > at
> > >   >
> > >   
> > > org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1121)
> > >   > at
> > >   >
> > >   org.apache.commons.httpclient.ConnectMethod.execute(ConnectMethod.java:205)
> > >   > at
> > >   > org.frb.rich.ipac.ui.DbFileProcessor.main(DbFileProcessor.java:213)
> > >   >
> > >   >
> > >   >
> > >   > Here is the code snippet I am using (stolen from examples):
> > >   >
> > >   > URI uri = new URI("https://us.etrade.com/e/t/home".toCharArray());
> > >   > String schema = uri.getScheme();
> > >   > Protocol protocol = Protocol.getProtocol(schema);
> > >   > HttpState state = new HttpState();
> > >   > HttpMethod method = new GetMethod(uri.toString());
> > >   > HttpConnection connection = new HttpConnection(uri.getHost(),
> > >   > uri.getPort(), protocol);
> > >   > connection.setProxyHost("myproxy");
> > >   > connection.setProxyPort(8080);
> > >   > method = new ConnectMethod(method);
> > >   > method.execute(state, connection);
> > >   > if (method.getStatusCode() == HttpStatus.SC_OK)
> > >   > {
> > >   > System.out.println(method.getResponseBodyAsString());
> > >   > }
> > >   > else
> > >   > {
> > >   > System.out.println("Unexpected failure: " +
> > >   > method.getStatusLine().toString());
> > >   > }
> > >   > method.releaseConnection();
> > >
> > > -- _______________________________________________
> > > Get your free email from http://www.dellmail.com
> > >
> > >
> > >
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 
> -- 
> _______________________________________________
> Get your free email from http://www.dellmail.com
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
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