hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "linea@libero.it" <li...@libero.it>
Subject Re: setBodyCheckTimeout causes problems in closing the connection
Date Fri, 05 Sep 2003 08:50:04 GMT
Hi,
thank you very much for your reply..
actually, when I'm using the 2.0 build I get this log, in which it looks 
like there is a second attempt to wait for the non-complaint response 
body, but no exception is thrown (i'm just pasting the relevant portions 
here):

1213   DEBUG [Thread-1] methods.HeadMethod - enter 
HeadMethod.readResponseBody(HttpState, HttpConnection)
1213   DEBUG [Thread-1] methods.HeadMethod - Check for non-compliant 
response body. Timeout in 500 ms
1214   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.isResponseAvailable(int)
1216   DEBUG [Thread-1] httpclient.HttpConnection - Input data not available
1217   DEBUG [Thread-1] httpclient.HttpMethodBase - Closing the connection.
1217   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.close()
1217   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.closeSockedAndStreams()
1218   INFO  [Thread-1] httpclient.HttpMethodBase - Recoverable 
exception caught when processing request
1222   DEBUG [Thread-1] httpclient.HttpMethodBase - Attempt number 2 to 
process request
1222   DEBUG [Thread-1] httpclient.HttpMethodBase - Opening the connection.
1222   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.open()
1363   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.writeRequest(HttpState, HttpConnection)
1364   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.writeRequestLine(HttpState, HttpConnection)
1364   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.generateRequestLine(HttpConnection, String, String, 
String, String)
1364   DEBUG [Thread-1] httpclient.wire - >> "HEAD 
/info/about/peerreview HTTP/1.1[\r][\n]"
....
1564   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.flushRequestOutputStream()
1564   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.readResponse(HttpState, HttpConnection)
1564   DEBUG [Thread-1] methods.HeadMethod - enter 
HeadMethod.readResponseBody(HttpState, HttpConnection)
1564   DEBUG [Thread-1] methods.HeadMethod - Check for non-compliant 
response body. Timeout in 500 ms
1564   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.isResponseAvailable(int)
1646   DEBUG [Thread-1] httpclient.HttpConnection - Input data available
1647   WARN  [Thread-1] methods.HeadMethod - Body content returned in 
response to HTTP HEAD
1648   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.readResponseBody(HttpState, HttpConnection)
1648   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.readResponseBody(HttpState, HttpConnection)
1648   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.getResponseInputStream()
1649   DEBUG [Thread-1] httpclient.HttpMethodBase - enter 
HttpMethodBase.canResponseHaveBody(int)
1652   DEBUG [Thread-1] httpclient.HttpMethodBase - Should forcefully 
close connection.
1653   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.close()
1653   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.closeSockedAndStreams()
1653   DEBUG [Thread-1] httpclient.HttpConnection - enter 
HttpConnection.releaseConnection()

I confirm that setting setBodyCheckTimeout(-1) eliminates this behaviour 
  when using 2.0 biuld, as well as the exception being thrown when using 
the 2.1 build.

In my version of EasyX509TrustManager I just let isServerTrusted() to 
always return true, but I don't know if this can impact the problem:

public class EasyX509TrustManager implements X509TrustManager
{
     private X509TrustManager standardTrustManager = null;

     /** Log object for this class. */
     private static final Log LOG = 
LogFactory.getLog(EasyX509TrustManager.class);

     /**
      * Constructor for EasyX509TrustManager.
      */
     public EasyX509TrustManager(KeyStore keystore) throws 
NoSuchAlgorithmException, KeyStoreException {
         super();
         TrustManagerFactory factory = 
TrustManagerFactory.getInstance("SunX509");
         factory.init(keystore);
         TrustManager[] trustmanagers = factory.getTrustManagers();
         if (trustmanagers.length == 0) {
             throw new NoSuchAlgorithmException("SunX509 trust manager 
not supported");
         }
         this.standardTrustManager = (X509TrustManager)trustmanagers[0];
     }

     /**
      * @see 
com.sun.net.ssl.X509TrustManager#isClientTrusted(X509Certificate[])
      */
     public boolean isClientTrusted(X509Certificate[] certificates) {
         return this.standardTrustManager.isClientTrusted(certificates);
     }

     /**
      * @see 
com.sun.net.ssl.X509TrustManager#isServerTrusted(X509Certificate[])
      */
     public boolean isServerTrusted(X509Certificate[] certificates) {
         if ((certificates != null) && LOG.isDebugEnabled()) {
             LOG.debug("Server certificate chain:");
             for (int i = 0; i < certificates.length; i++) {
                 LOG.debug("X509Certificate[" + i + "]=" + certificates[i]);
             }
         }
	/*        if ((certificates != null) && (certificates.length == 1)) {
             X509Certificate certificate = certificates[0];
             try {
                 certificate.checkValidity();
             }
             catch (CertificateException e) {
                 LOG.error(e.toString());
                 return false;
             }
             return true;
         } else {
             return this.standardTrustManager.isServerTrusted(certificates);
	    }*/
	return true;
     }

     /**
      * @see com.sun.net.ssl.X509TrustManager#getAcceptedIssuers()
      */
     public X509Certificate[] getAcceptedIssuers() {
         return this.standardTrustManager.getAcceptedIssuers();
     }
}

Many thanks again..


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


Mime
View raw message