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: Problem using proxy over SSL connection
Date Mon, 20 Jun 2005 12:47:09 GMT
Jeroen,

Try running the same code using Java 1.4.2 (preferably on both client
and server side) and see if that makes any difference.

The SSL support in Java 1.5 still appears unstable. We have had a few
reports about similar issues when running HttpClient in JRE 1.5

Meanwhile I'll take a closer look at the wirelog you have posted

Oleg


On Mon, Jun 20, 2005 at 02:32:58PM +0200, Jeroen ter Voorde wrote:
> Hi,
> 
> I've got a problem connecting using an SSL connection over a proxy 
> (squid 2.5)..
> Accessing the page using IE 6 works fine. HttpClient also works fine 
> when using SSL or over the proxy but not the combination.
> 
> I get the message "javax.net.ssl.SSLHandshakeException: Remote host 
> closed connection during handshake".
> I've tried version 3.0-RC2 and the latest development build (200605).
> 
> I'm using an untrusted certificate using the EasySSLPrototolSocketFactory.
> 
> Tomcat 5.0.28 is the webserver. The tomcat connector configuration:
> 
>    <Connector port="443" keystoreFile="qonline.kdb" 
> keystorePass="changeit" 
>               maxThreads="20" minSpareThreads="5" maxSpareThreads="10"
>               enableLookups="false" disableUploadTimeout="true"
>               acceptCount="100" scheme="https" secure="true"
>               clientAuth="false" sslProtocol="TLS" />
> 
> Here's the code making the connection:
> 
>        HostConfiguration hostConfig = 
> qollinx.getHostConfig(qollinx.getProtocol(), qollinx.getHost(), 
> qollinx.getPort());
>       
>        HttpState initialState = new HttpState();       
>        Cookie mycookie = new Cookie(qollinx.getHost(), "JSESSIONID", 
> qollinx.getJSessionID(), "/", null, false);
>        // and then added to your HTTP state instance
>        initialState.addCookie(mycookie);
> 
>        // Get HTTP client instance
>        HttpClient httpclient = new HttpClient();
>        httpclient.setHostConfiguration(hostConfig);
>        
> httpclient.getHttpConnectionManager().getParams().setConnectionTimeout(30000);      
 
> 
>        httpclient.setState(initialState);      
>               
>        GetMethod get = new 
> GetMethod(URIUtil.encodePath(qollinx.getFilePath()) + 
> URIencUTF8.encodeUTF8(qollinx.getFieldName()) + "/" + 
> URIencUTF8.encodeUTF8(attName) +"?OpenAttachment&qollinx-dummy=" + 
> Long.toString(Math.abs(System.currentTimeMillis()), 16));
>        get.getParams().setVersion(HttpVersion.HTTP_1_1);
>       
>        try {
>            log.info("Using download source: " +get.getPath() + "?" + 
> get.getQueryString());
>            if (progress != null) 
> progress.updateText(glossary.getTranslation("SEND_DOWNLOAD"));
>            int result = httpclient.executeMethod(get);
>           
>            if (result != 200) {
> 
> The qollinx.getHostConfig() method looks like this:
> 
>    public HostConfiguration getHostConfig(String protocol, String host, 
> int port) {
>       
>        HostConfiguration hostConfig = new HostConfiguration();
>        hostConfig.setHost(host, port, protocol);           
> 
>        String proxy = detectProxyForUrl(protocol + "://" + host + ":" + 
> port + "/");
>        if (proxy != null && !"DIRECT".equals(proxy)) {
>            if (proxy.startsWith("PROXY ")) {
>                proxy = proxy.substring(6);
>                if (proxy.indexOf(';') != -1) {
>                    proxy = proxy.substring(0, proxy.indexOf(';'));
>                }
>               
>                int pi = proxy.indexOf(':');
>                hostConfig.setProxy(proxy.substring(0, pi), 
> Integer.parseInt(proxy.substring(pi + 1)));
>               
>                log.info("Proxy detected. Using proxy connection to " + 
> hostConfig.getProtocol() + "://" + hostConfig.getProxyHost() + ":" + 
> hostConfig.getProxyPort());
>            }
>        } else {
>            log.info("No proxy detected. Using direct connection to " + 
> hostConfig.getProtocol() + "://" + hostConfig.getHost() + ":" + 
> hostConfig.getPort());
>        }
>       
>        return hostConfig;
>    }
> 
> The following logs are outputted by httpclient:
> 
> 2005-06-20 13:56:01,046: INFO com.qonline.qollinx.Qollinx - ProxyService 
> returned proxy 192.168.0.201:3128.
> 2005-06-20 13:56:01,062: INFO com.qonline.qollinx.Qollinx - Proxy 
> detected. Using proxy connection to https:443://192.168.0.201:3128
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.Cookie - 
> enter Cookie(String, String, String, String, Date, boolean)
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpState - 
> enter HttpState.addCookie(Cookie)
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - Java version: 1.5.0_03
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - Java vendor: Sun Microsystems Inc.
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - Java class path: C:\PROGRA~1\Java\JRE15~2.0_0\classes
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - Operating system name: Windows XP
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - Operating system architecture: x86
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - Operating system version: 5.1
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - SUN 1.5: SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 
> digests; SecureRandom; X.509 certificates; JKS keystore; PKIX 
> CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores)
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - SunRsaSign 1.5: Sun RSA signature provider
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - SunJSSE 1.5: Sun JSSE provider(PKCS12, SunX509 key/trust factories, 
> SSLv3, TLSv1)
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - SunJCE 1.5: SunJCE Provider (implements RSA, DES, Triple DES, AES, 
> Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - SunJGSS 1.0: Sun (Kerberos v5)
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - SunSASL 1.5: Sun SASL provider(implements client mechanisms for: 
> DIGEST-MD5, GSSAPI, EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for: 
> DIGEST-MD5, GSSAPI, CRAM-MD5)
> 2005-06-20 13:56:01,093: DEBUG org.apache.commons.httpclient.HttpClient 
> - SunDeploy-MSCrypto 1.5: SunDeploy-MSCrypto Provider (implements RSA)
> 2005-06-20 13:56:01,093: DEBUG 
> org.apache.commons.httpclient.params.DefaultHttpParams - Set parameter 
> http.connection.timeout = 30000
> 2005-06-20 13:56:01,156: DEBUG 
> org.apache.commons.httpclient.methods.GetMethod - enter GetMethod(String)
> 2005-06-20 13:56:01,156: DEBUG 
> org.apache.commons.httpclient.params.DefaultHttpParams - Set parameter 
> http.protocol.version = HTTP/1.0
> 2005-06-20 13:56:01,156: INFO com.qonline.qollinx.LocalAttachment - 
> Using download source: 
> /%7B7%7D/fdAttachmentContent/Functional%20specifications%20-%20Response%20Reader%20Access.doc?OpenAttachment&qollinx-dummy=104999ae0f4
> 2005-06-20 13:56:01,156: DEBUG org.apache.commons.httpclient.HttpClient 
> - enter HttpClient.executeMethod(HttpMethod)
> 2005-06-20 13:56:01,156: DEBUG org.apache.commons.httpclient.HttpClient 
> - enter HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState)
> 2005-06-20 13:56:01,171: DEBUG 
> org.apache.commons.httpclient.HttpMethodDirector - Attempt number 1 to 
> process request
> 2005-06-20 13:56:01,171: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter HttpConnection.open()
> 2005-06-20 13:56:01,171: DEBUG 
> org.apache.commons.httpclient.HttpConnection - Open connection to 
> 192.168.0.201:3128
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.execute(HttpState, HttpConnection)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.writeRequest(HttpState, HttpConnection)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.writeRequestLine(HttpState, HttpConnection)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.generateRequestLine(HttpConnection, String, String, 
> String, String)
> 2005-06-20 13:56:01,203: DEBUG httpclient.wire.header - >> "GET 
> https://192.168.0.193/%7B7%7D/fdAttachmentContent/Functional%20specifications%20-%20Response%20Reader%20Access.doc?OpenAttachment&qollinx-dummy=104999ae0f4

> HTTP/1.0[\r][\n]"
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.print(String)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[])
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[], int, int)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.writeRequestHeaders(HttpState,HttpConnection)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.addRequestHeaders(HttpState, HttpConnection)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.addUserAgentRequestHeaders(HttpState, HttpConnection)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.addHostRequestHeader(HttpState, HttpConnection)
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - Adding Host request header
> 2005-06-20 13:56:01,203: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.addCookieRequestHeader(HttpState, HttpConnection)
> 2005-06-20 13:56:01,218: DEBUG org.apache.commons.httpclient.HttpState - 
> enter HttpState.getCookies()
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.cookie.CookieSpec - enter 
> CookieSpecBase.match(String, int, String, boolean, Cookie[])
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.cookie.CookieSpec - enter 
> CookieSpecBase.match(String, int, String, boolean, Cookie
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.cookie.CookieSpec - enter 
> RFC2109Spec.formatCookie(Cookie)
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpMethodBase - enter 
> HttpMethodBase.addProxyConnectionHeader(HttpState, HttpConnection)
> 2005-06-20 13:56:01,218: DEBUG httpclient.wire.header - >> "User-Agent: 
> Jakarta Commons-HttpClient/3.0-rc2[\r][\n]"
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.print(String)
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[])
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[], int, int)
> 2005-06-20 13:56:01,218: DEBUG httpclient.wire.header - >> "Host: 
> 192.168.0.193[\r][\n]"
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.print(String)
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[])
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[], int, int)
> 2005-06-20 13:56:01,218: DEBUG httpclient.wire.header - >> "Cookie: 
> $Version=0; JSESSIONID=2D07ED438968613447EEA3E64A32D60B[\r][\n]"
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.print(String)
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[])
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[], int, int)
> 2005-06-20 13:56:01,218: DEBUG httpclient.wire.header - >> 
> "Proxy-Connection: Keep-Alive[\r][\n]"
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.print(String)
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[])
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[], int, int)
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.writeLine()
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[])
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.write(byte[], int, int)
> 2005-06-20 13:56:01,218: DEBUG httpclient.wire.header - >> "[\r][\n]"
> 2005-06-20 13:56:01,218: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.flushRequestOutputStream()
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpMethodDirector - Closing the connection.
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter HttpConnection.close()
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.closeSockedAndStreams()
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpMethodDirector - Method retry handler 
> returned false. Automatic recovery will not be attempted
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.releaseConnection()
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpConnection - Releasing connection back 
> to connection manager.
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpConnection - enter 
> HttpConnection.releaseConnection()
> 2005-06-20 14:01:02,812: DEBUG 
> org.apache.commons.httpclient.HttpConnection - Releasing connection back 
> to connection manager.
> 2005-06-20 14:01:02,828: ERROR com.qonline.qollinx.gui.QollinxWidget - 
> Could not open file for reading
> javax.net.ssl.SSLHandshakeException: Remote host closed connection 
> during handshake
>    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
>    at 
> com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown 
> Source)
>    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown 
> Source)
>    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
>    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
>    at java.io.BufferedOutputStream.flush(Unknown Source)
>    at 
> org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(Unknown 
> Source)
>    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(Unknown 
> Source)
>    at org.apache.commons.httpclient.HttpMethodBase.execute(Unknown Source)
>    at 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown 
> Source)
>    at 
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown 
> Source)
>    at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown 
> Source)
>    at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown 
> Source)
>    at 
> com.qonline.qollinx.LocalAttachment.download(LocalAttachment.java:464)
>    at 
> com.qonline.qollinx.gui.QollinxWidget.doReadSelected(QollinxWidget.java:215)
>    at 
> com.qonline.qollinx.gui.ButtonPanel$1.actionPerformed(ButtonPanel.java:83)
>    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
>    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
>    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
>    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
>    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown 
> Source)
>    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
>    at java.awt.Component.processMouseEvent(Unknown Source)
>    at javax.swing.JComponent.processMouseEvent(Unknown Source)
>    at java.awt.Component.processEvent(Unknown Source)
>    at java.awt.Container.processEvent(Unknown Source)
>    at java.awt.Component.dispatchEventImpl(Unknown Source)
>    at java.awt.Container.dispatchEventImpl(Unknown Source)
>    at java.awt.Component.dispatchEvent(Unknown Source)
>    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
>    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
>    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
>    at java.awt.Container.dispatchEventImpl(Unknown Source)
>    at java.awt.Component.dispatchEvent(Unknown Source)
>    at java.awt.EventQueue.dispatchEvent(Unknown Source)
>    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
>    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
>    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>    at java.awt.EventDispatchThread.run(Unknown Source)
> Caused by: java.io.EOFException: SSL peer shut down incorrectly
>    at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source)
>    ... 40 more
> 
> 
> Any ideas?
> Jeroen
> 
> 
> ---------------------------------------------------------------------
> 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