You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Chang Sau Sheong <ss...@elipva.com> on 2002/06/12 16:40:07 UTC

HttpClient with HTTPS

Hi,

I've just starting using HttpClient recently -- great work -- but I've some
problems with HTTPS connections. With the older alpha1 release dated October
2001, I get this exception:

javax.net.ssl.SSLException: Unrecognized SSL handshake.
        at
com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198])
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
        at
com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
        at java.io.OutputStream.write(Unknown Source)
        at
org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363)
        at
org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433)
        at
org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase
.java:715)
        at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav
a:692)

With the latest nightly release (12 June 2002) I can't get a connection at
all!

java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(Unknown Source)
        at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at java.net.Socket.<init>(Unknown Source)
        at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198])
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198])
        at
com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1.
2-120198])
        at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284)
        at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466
)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320)

Any ideas or tips? I read in the archive someone mentioning that SSL is not
implemented in this release but I checked the source and it *looks* like it
is implemented. Anyone with a clue?

Thanks in advance!


.sausheong





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HttpClient with HTTPS

Posted by Chang Sau Sheong <ss...@elipva.com>.
Yes it does work on my browser without the proxy settings. How can I get rid
of the SSL handshake problem?

Thanks!

.sausheong
elipva Ltd


----- Original Message -----
From: "Sachin Hamirwasia" <Sa...@Singnet.com.sg>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Wednesday, June 12, 2002 11:36 PM
Subject: RE: HttpClient with HTTPS


> You don't require a proxy server if your firewall doesn't block 443 (or
your
> specific https port). However, from your exception stack trace it looks
like
> that destination host/port is unreachable. Does the server work with your
> browser (without the proxy settings?) - try again!
>
> -----Original Message-----
> From: Chang Sau Sheong [mailto:sschang@elipva.com]
> Sent: Wednesday, 12 June 2002 11:25 PM
> To: Jakarta Commons Developers List
> Subject: Re: HttpClient with HTTPS
>
> Thanks -- but I'm not going through any proxies to go out. I have direct
> connection to the Internet, which allows me to connect to the HTTPS server
> without any proxies. Do I need a proxy to go through?
>
> .sausheong
> elipva Ltd
>
>
> ----- Original Message -----
> From: "Sachin Hamirwasia" <Sa...@Singnet.com.sg>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Wednesday, June 12, 2002 11:11 PM
> Subject: RE: HttpClient with HTTPS
>
>
> > I think your problem is to do with the fact that the current version of
> > HTTPClient does not have proxy support for SSL connections. So when you
> try
> > to connect to an HTTP server via a proxy server, the HTTP client
actually
> > makes an SSLSocket connection to the proxy server itself. But obviously
> > since the proxy server does not know SSL protocol, the handshake won't
go
> > through and hence the exception. The same worked with
HttpsURLConnection,
> > since the default implementation does handle proxy tunnelling properly.
> >
> > Try using your same code to connect to a server within your intranet and
> > don't use the proxy server. It will work.
> >
> > Look at my earlier note on enabling proxy support on HTTPClient. You
will
> > need to rebuild the library.
> >
> > Regards, Sachin
> >
> > -----Original Message-----
> > From: Chang Sau Sheong [mailto:sschang@elipva.com]
> > Sent: Wednesday, 12 June 2002 11:01 PM
> > To: Jakarta Commons Developers List
> > Subject: Re: HttpClient with HTTPS
> >
> > Thanks for the quick reply. I used the
> >
> > -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
> >
> > system properties to start up Tomcat (I used HttpClient in Tomcat) and
> when
> > I was previously using URLConnection to do the same thing, it worked
> pretty
> > well. I switched to using HttpClient because I needed the session and
> > cookies support but I'm pretty stymied by this issue I have with SSL.
> >
> > Hoping for answers? Thanks!
> >
> > .sausheong
> >
> >
> > ----- Original Message -----
> > From: "Evert Hoff" <ev...@pixie.co.za>
> > To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> > Sent: Wednesday, June 12, 2002 10:42 PM
> > Subject: Re: HttpClient with HTTPS
> >
> >
> > > Hi,
> > >
> > > You must set your system properties before you start using it with
SSL.
> > > Here's how:
> > >
> > > System.setProperty("java.protocol.handler.pkgs",
> > > "com.sun.net.ssl.internal.www.protocol");
> > > Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
> > >
> > > You need to import:
> > > import com.sun.net.ssl.*;
> > > import java.security.*;
> > >
> > > Regards,
> > >
> > > Evert
> > >
> > > On Wed, 2002-06-12 at 16:40, Chang Sau Sheong wrote:
> > > > Hi,
> > > >
> > > > I've just starting using HttpClient recently -- great work -- but
I've
> > some
> > > > problems with HTTPS connections. With the older alpha1 release dated
> > October
> > > > 2001, I get this exception:
> > > >
> > > > javax.net.ssl.SSLException: Unrecognized SSL handshake.
> > > >         at
> > > >
com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198])
> > > >         at
> > > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> > > >         at
> > > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> > > >         at
> > > >
> >
com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
> > > >         at java.io.OutputStream.write(Unknown Source)
> > > >         at
> > > >
> >
>
org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363)
> > > >         at
> > > >
> >
>
org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433)
> > > >         at
> > > >
> >
>
org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase
> > > > .java:715)
> > > >         at
> > > >
> >
>
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav
> > > > a:692)
> > > >
> > > > With the latest nightly release (12 June 2002) I can't get a
> connection
> > at
> > > > all!
> > > >
> > > > java.net.ConnectException: Connection refused: connect
> > > >         at java.net.PlainSocketImpl.socketConnect(Native Method)
> > > >         at java.net.PlainSocketImpl.doConnect(Unknown Source)
> > > >         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> > > >         at java.net.PlainSocketImpl.connect(Unknown Source)
> > > >         at java.net.Socket.<init>(Unknown Source)
> > > >         at java.net.Socket.<init>(Unknown Source)
> > > >         at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198])
> > > >         at
> > > >
> >
com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198])
> > > >         at
> > > >
> >
>
com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1.
> > > > 2-120198])
> > > >         at
> > > >
> >
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284)
> > > >         at
> > > >
> >
>
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466
> > > > )
> > > >         at
> > > >
> >
>
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320)
> > > >
> > > > Any ideas or tips? I read in the archive someone mentioning that SSL
> is
> > not
> > > > implemented in this release but I checked the source and it *looks*
> like
> > it
> > > > is implemented. Anyone with a clue?
> > > >
> > > > Thanks in advance!
> > > >
> > > >
> > > > .sausheong
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > > >
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: HttpClient with HTTPS

Posted by Sachin Hamirwasia <Sa...@Singnet.com.sg>.
You don't require a proxy server if your firewall doesn't block 443 (or your
specific https port). However, from your exception stack trace it looks like
that destination host/port is unreachable. Does the server work with your
browser (without the proxy settings?) - try again!

-----Original Message-----
From: Chang Sau Sheong [mailto:sschang@elipva.com]
Sent: Wednesday, 12 June 2002 11:25 PM
To: Jakarta Commons Developers List
Subject: Re: HttpClient with HTTPS

Thanks -- but I'm not going through any proxies to go out. I have direct
connection to the Internet, which allows me to connect to the HTTPS server
without any proxies. Do I need a proxy to go through?

.sausheong
elipva Ltd


----- Original Message -----
From: "Sachin Hamirwasia" <Sa...@Singnet.com.sg>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Wednesday, June 12, 2002 11:11 PM
Subject: RE: HttpClient with HTTPS


> I think your problem is to do with the fact that the current version of
> HTTPClient does not have proxy support for SSL connections. So when you
try
> to connect to an HTTP server via a proxy server, the HTTP client actually
> makes an SSLSocket connection to the proxy server itself. But obviously
> since the proxy server does not know SSL protocol, the handshake won't go
> through and hence the exception. The same worked with HttpsURLConnection,
> since the default implementation does handle proxy tunnelling properly.
>
> Try using your same code to connect to a server within your intranet and
> don't use the proxy server. It will work.
>
> Look at my earlier note on enabling proxy support on HTTPClient. You will
> need to rebuild the library.
>
> Regards, Sachin
>
> -----Original Message-----
> From: Chang Sau Sheong [mailto:sschang@elipva.com]
> Sent: Wednesday, 12 June 2002 11:01 PM
> To: Jakarta Commons Developers List
> Subject: Re: HttpClient with HTTPS
>
> Thanks for the quick reply. I used the
>
> -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
>
> system properties to start up Tomcat (I used HttpClient in Tomcat) and
when
> I was previously using URLConnection to do the same thing, it worked
pretty
> well. I switched to using HttpClient because I needed the session and
> cookies support but I'm pretty stymied by this issue I have with SSL.
>
> Hoping for answers? Thanks!
>
> .sausheong
>
>
> ----- Original Message -----
> From: "Evert Hoff" <ev...@pixie.co.za>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Wednesday, June 12, 2002 10:42 PM
> Subject: Re: HttpClient with HTTPS
>
>
> > Hi,
> >
> > You must set your system properties before you start using it with SSL.
> > Here's how:
> >
> > System.setProperty("java.protocol.handler.pkgs",
> > "com.sun.net.ssl.internal.www.protocol");
> > Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
> >
> > You need to import:
> > import com.sun.net.ssl.*;
> > import java.security.*;
> >
> > Regards,
> >
> > Evert
> >
> > On Wed, 2002-06-12 at 16:40, Chang Sau Sheong wrote:
> > > Hi,
> > >
> > > I've just starting using HttpClient recently -- great work -- but I've
> some
> > > problems with HTTPS connections. With the older alpha1 release dated
> October
> > > 2001, I get this exception:
> > >
> > > javax.net.ssl.SSLException: Unrecognized SSL handshake.
> > >         at
> > > com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198])
> > >         at
> > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> > >         at
> > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> > >         at
> > >
> com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
> > >         at java.io.OutputStream.write(Unknown Source)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase
> > > .java:715)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav
> > > a:692)
> > >
> > > With the latest nightly release (12 June 2002) I can't get a
connection
> at
> > > all!
> > >
> > > java.net.ConnectException: Connection refused: connect
> > >         at java.net.PlainSocketImpl.socketConnect(Native Method)
> > >         at java.net.PlainSocketImpl.doConnect(Unknown Source)
> > >         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> > >         at java.net.PlainSocketImpl.connect(Unknown Source)
> > >         at java.net.Socket.<init>(Unknown Source)
> > >         at java.net.Socket.<init>(Unknown Source)
> > >         at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198])
> > >         at
> > >
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198])
> > >         at
> > >
>
com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1.
> > > 2-120198])
> > >         at
> > >
> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466
> > > )
> > >         at
> > >
>
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320)
> > >
> > > Any ideas or tips? I read in the archive someone mentioning that SSL
is
> not
> > > implemented in this release but I checked the source and it *looks*
like
> it
> > > is implemented. Anyone with a clue?
> > >
> > > Thanks in advance!
> > >
> > >
> > > .sausheong
> > >
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HttpClient with HTTPS

Posted by Chang Sau Sheong <ss...@elipva.com>.
Thanks -- but I'm not going through any proxies to go out. I have direct
connection to the Internet, which allows me to connect to the HTTPS server
without any proxies. Do I need a proxy to go through?

.sausheong
elipva Ltd


----- Original Message -----
From: "Sachin Hamirwasia" <Sa...@Singnet.com.sg>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Wednesday, June 12, 2002 11:11 PM
Subject: RE: HttpClient with HTTPS


> I think your problem is to do with the fact that the current version of
> HTTPClient does not have proxy support for SSL connections. So when you
try
> to connect to an HTTP server via a proxy server, the HTTP client actually
> makes an SSLSocket connection to the proxy server itself. But obviously
> since the proxy server does not know SSL protocol, the handshake won't go
> through and hence the exception. The same worked with HttpsURLConnection,
> since the default implementation does handle proxy tunnelling properly.
>
> Try using your same code to connect to a server within your intranet and
> don't use the proxy server. It will work.
>
> Look at my earlier note on enabling proxy support on HTTPClient. You will
> need to rebuild the library.
>
> Regards, Sachin
>
> -----Original Message-----
> From: Chang Sau Sheong [mailto:sschang@elipva.com]
> Sent: Wednesday, 12 June 2002 11:01 PM
> To: Jakarta Commons Developers List
> Subject: Re: HttpClient with HTTPS
>
> Thanks for the quick reply. I used the
>
> -Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
>
> system properties to start up Tomcat (I used HttpClient in Tomcat) and
when
> I was previously using URLConnection to do the same thing, it worked
pretty
> well. I switched to using HttpClient because I needed the session and
> cookies support but I'm pretty stymied by this issue I have with SSL.
>
> Hoping for answers? Thanks!
>
> .sausheong
>
>
> ----- Original Message -----
> From: "Evert Hoff" <ev...@pixie.co.za>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Wednesday, June 12, 2002 10:42 PM
> Subject: Re: HttpClient with HTTPS
>
>
> > Hi,
> >
> > You must set your system properties before you start using it with SSL.
> > Here's how:
> >
> > System.setProperty("java.protocol.handler.pkgs",
> > "com.sun.net.ssl.internal.www.protocol");
> > Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
> >
> > You need to import:
> > import com.sun.net.ssl.*;
> > import java.security.*;
> >
> > Regards,
> >
> > Evert
> >
> > On Wed, 2002-06-12 at 16:40, Chang Sau Sheong wrote:
> > > Hi,
> > >
> > > I've just starting using HttpClient recently -- great work -- but I've
> some
> > > problems with HTTPS connections. With the older alpha1 release dated
> October
> > > 2001, I get this exception:
> > >
> > > javax.net.ssl.SSLException: Unrecognized SSL handshake.
> > >         at
> > > com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198])
> > >         at
> > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> > >         at
> > > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> > >         at
> > >
> com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
> > >         at java.io.OutputStream.write(Unknown Source)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase
> > > .java:715)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav
> > > a:692)
> > >
> > > With the latest nightly release (12 June 2002) I can't get a
connection
> at
> > > all!
> > >
> > > java.net.ConnectException: Connection refused: connect
> > >         at java.net.PlainSocketImpl.socketConnect(Native Method)
> > >         at java.net.PlainSocketImpl.doConnect(Unknown Source)
> > >         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> > >         at java.net.PlainSocketImpl.connect(Unknown Source)
> > >         at java.net.Socket.<init>(Unknown Source)
> > >         at java.net.Socket.<init>(Unknown Source)
> > >         at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198])
> > >         at
> > >
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198])
> > >         at
> > >
>
com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1.
> > > 2-120198])
> > >         at
> > >
> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284)
> > >         at
> > >
>
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466
> > > )
> > >         at
> > >
>
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320)
> > >
> > > Any ideas or tips? I read in the archive someone mentioning that SSL
is
> not
> > > implemented in this release but I checked the source and it *looks*
like
> it
> > > is implemented. Anyone with a clue?
> > >
> > > Thanks in advance!
> > >
> > >
> > > .sausheong
> > >
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: HttpClient with HTTPS

Posted by Sachin Hamirwasia <Sa...@Singnet.com.sg>.
I think your problem is to do with the fact that the current version of
HTTPClient does not have proxy support for SSL connections. So when you try
to connect to an HTTP server via a proxy server, the HTTP client actually
makes an SSLSocket connection to the proxy server itself. But obviously
since the proxy server does not know SSL protocol, the handshake won't go
through and hence the exception. The same worked with HttpsURLConnection,
since the default implementation does handle proxy tunnelling properly.

Try using your same code to connect to a server within your intranet and
don't use the proxy server. It will work.

Look at my earlier note on enabling proxy support on HTTPClient. You will
need to rebuild the library.

Regards, Sachin

-----Original Message-----
From: Chang Sau Sheong [mailto:sschang@elipva.com]
Sent: Wednesday, 12 June 2002 11:01 PM
To: Jakarta Commons Developers List
Subject: Re: HttpClient with HTTPS

Thanks for the quick reply. I used the

-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol

system properties to start up Tomcat (I used HttpClient in Tomcat) and when
I was previously using URLConnection to do the same thing, it worked pretty
well. I switched to using HttpClient because I needed the session and
cookies support but I'm pretty stymied by this issue I have with SSL.

Hoping for answers? Thanks!

.sausheong


----- Original Message -----
From: "Evert Hoff" <ev...@pixie.co.za>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Wednesday, June 12, 2002 10:42 PM
Subject: Re: HttpClient with HTTPS


> Hi,
>
> You must set your system properties before you start using it with SSL.
> Here's how:
>
> System.setProperty("java.protocol.handler.pkgs",
> "com.sun.net.ssl.internal.www.protocol");
> Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
>
> You need to import:
> import com.sun.net.ssl.*;
> import java.security.*;
>
> Regards,
>
> Evert
>
> On Wed, 2002-06-12 at 16:40, Chang Sau Sheong wrote:
> > Hi,
> >
> > I've just starting using HttpClient recently -- great work -- but I've
some
> > problems with HTTPS connections. With the older alpha1 release dated
October
> > 2001, I get this exception:
> >
> > javax.net.ssl.SSLException: Unrecognized SSL handshake.
> >         at
> > com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198])
> >         at
> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> >         at
> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> >         at
> >
com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
> >         at java.io.OutputStream.write(Unknown Source)
> >         at
> >
org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363)
> >         at
> >
org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433)
> >         at
> >
org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase
> > .java:715)
> >         at
> >
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav
> > a:692)
> >
> > With the latest nightly release (12 June 2002) I can't get a connection
at
> > all!
> >
> > java.net.ConnectException: Connection refused: connect
> >         at java.net.PlainSocketImpl.socketConnect(Native Method)
> >         at java.net.PlainSocketImpl.doConnect(Unknown Source)
> >         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> >         at java.net.PlainSocketImpl.connect(Unknown Source)
> >         at java.net.Socket.<init>(Unknown Source)
> >         at java.net.Socket.<init>(Unknown Source)
> >         at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198])
> >         at
> >
com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198])
> >         at
> >
com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1.
> > 2-120198])
> >         at
> >
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284)
> >         at
> >
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466
> > )
> >         at
> >
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320)
> >
> > Any ideas or tips? I read in the archive someone mentioning that SSL is
not
> > implemented in this release but I checked the source and it *looks* like
it
> > is implemented. Anyone with a clue?
> >
> > Thanks in advance!
> >
> >
> > .sausheong
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HttpClient with HTTPS

Posted by Chang Sau Sheong <ss...@elipva.com>.
Thanks for the quick reply. I used the

-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol

system properties to start up Tomcat (I used HttpClient in Tomcat) and when
I was previously using URLConnection to do the same thing, it worked pretty
well. I switched to using HttpClient because I needed the session and
cookies support but I'm pretty stymied by this issue I have with SSL.

Hoping for answers? Thanks!

.sausheong


----- Original Message -----
From: "Evert Hoff" <ev...@pixie.co.za>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Wednesday, June 12, 2002 10:42 PM
Subject: Re: HttpClient with HTTPS


> Hi,
>
> You must set your system properties before you start using it with SSL.
> Here's how:
>
> System.setProperty("java.protocol.handler.pkgs",
> "com.sun.net.ssl.internal.www.protocol");
> Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
>
> You need to import:
> import com.sun.net.ssl.*;
> import java.security.*;
>
> Regards,
>
> Evert
>
> On Wed, 2002-06-12 at 16:40, Chang Sau Sheong wrote:
> > Hi,
> >
> > I've just starting using HttpClient recently -- great work -- but I've
some
> > problems with HTTPS connections. With the older alpha1 release dated
October
> > 2001, I get this exception:
> >
> > javax.net.ssl.SSLException: Unrecognized SSL handshake.
> >         at
> > com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198])
> >         at
> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> >         at
> > com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
> >         at
> >
com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
> >         at java.io.OutputStream.write(Unknown Source)
> >         at
> >
org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363)
> >         at
> >
org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433)
> >         at
> >
org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase
> > .java:715)
> >         at
> >
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav
> > a:692)
> >
> > With the latest nightly release (12 June 2002) I can't get a connection
at
> > all!
> >
> > java.net.ConnectException: Connection refused: connect
> >         at java.net.PlainSocketImpl.socketConnect(Native Method)
> >         at java.net.PlainSocketImpl.doConnect(Unknown Source)
> >         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> >         at java.net.PlainSocketImpl.connect(Unknown Source)
> >         at java.net.Socket.<init>(Unknown Source)
> >         at java.net.Socket.<init>(Unknown Source)
> >         at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198])
> >         at
> >
com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198])
> >         at
> >
com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1.
> > 2-120198])
> >         at
> >
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284)
> >         at
> >
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466
> > )
> >         at
> >
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320)
> >
> > Any ideas or tips? I read in the archive someone mentioning that SSL is
not
> > implemented in this release but I checked the source and it *looks* like
it
> > is implemented. Anyone with a clue?
> >
> > Thanks in advance!
> >
> >
> > .sausheong
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HttpClient with HTTPS

Posted by Evert Hoff <ev...@pixie.co.za>.
Hi,

You must set your system properties before you start using it with SSL.
Here's how:

System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

You need to import:
import com.sun.net.ssl.*;
import java.security.*;

Regards,

Evert

On Wed, 2002-06-12 at 16:40, Chang Sau Sheong wrote:
> Hi,
> 
> I've just starting using HttpClient recently -- great work -- but I've some
> problems with HTTPS connections. With the older alpha1 release dated October
> 2001, I get this exception:
> 
> javax.net.ssl.SSLException: Unrecognized SSL handshake.
>         at
> com.sun.net.ssl.internal.ssl.InputRecord.read([DashoPro-V1.2-120198])
>         at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
>         at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
>         at
> com.sun.net.ssl.internal.ssl.AppOutputStream.write([DashoPro-V1.2-120198])
>         at java.io.OutputStream.write(Unknown Source)
>         at
> org.apache.commons.httpclient.HttpConnection.write(HttpConnection.java:363)
>         at
> org.apache.commons.httpclient.HttpConnection.print(HttpConnection.java:433)
>         at
> org.apache.commons.httpclient.HttpMethodBase.writeRequestLine(HttpMethodBase
> .java:715)
>         at
> org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.jav
> a:692)
> 
> With the latest nightly release (12 June 2002) I can't get a connection at
> all!
> 
> java.net.ConnectException: Connection refused: connect
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>         at java.net.PlainSocketImpl.doConnect(Unknown Source)
>         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>         at java.net.PlainSocketImpl.connect(Unknown Source)
>         at java.net.Socket.<init>(Unknown Source)
>         at java.net.Socket.<init>(Unknown Source)
>         at javax.net.ssl.SSLSocket.<init>([DashoPro-V1.2-120198])
>         at
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>([DashoPro-V1.2-120198])
>         at
> com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket([DashoPro-V1.
> 2-120198])
>         at
> org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:284)
>         at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:466
> )
>         at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:320)
> 
> Any ideas or tips? I read in the archive someone mentioning that SSL is not
> implemented in this release but I checked the source and it *looks* like it
> is implemented. Anyone with a clue?
> 
> Thanks in advance!
> 
> 
> .sausheong
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>