commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mbe...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpConnection.java
Date Wed, 10 Sep 2003 21:34:12 GMT
mbecke      2003/09/10 14:34:12

  Modified:    httpclient/src/java/org/apache/commons/httpclient/methods
                        Tag: HTTPCLIENT_2_0_BRANCH HeadMethod.java
               httpclient/src/java/org/apache/commons/httpclient Tag:
                        HTTPCLIENT_2_0_BRANCH HttpConnection.java
  Log:
  Makes HttpConnection.isResponseAvailable() a little more robust, particularly when used
by HeadMethod.
  PR: 22968
  Submitted by: Michael Becke
  Reviewed by: Oleg Kalnichevski
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.19.2.2  +14 -5     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java
  
  Index: HeadMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/HeadMethod.java,v
  retrieving revision 1.19.2.1
  retrieving revision 1.19.2.2
  diff -u -r1.19.2.1 -r1.19.2.2
  --- HeadMethod.java	9 Aug 2003 19:36:39 -0000	1.19.2.1
  +++ HeadMethod.java	10 Sep 2003 21:34:11 -0000	1.19.2.2
  @@ -188,7 +188,16 @@
                   LOG.debug("Check for non-compliant response body. Timeout in " 
                    + this.bodyCheckTimeout + " ms");    
               }
  -            if (conn.isResponseAvailable(this.bodyCheckTimeout)) {
  +            boolean responseAvailable = false;
  +            try {
  +                responseAvailable = conn.isResponseAvailable(this.bodyCheckTimeout);
  +            } catch (IOException e) {
  +                LOG.debug("An IOException occurred while testing if a response was available,"
  +                    + " we will assume one is not.", 
  +                    e);
  +                responseAvailable = false;
  +            }
  +            if (responseAvailable) {
                   if (isStrictMode()) {
                       throw new HttpException(
                           "Body content may not be sent in response to HTTP HEAD request");
  
  
  
  No                   revision
  No                   revision
  1.67.2.4  +12 -5     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
  
  Index: HttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
  retrieving revision 1.67.2.3
  retrieving revision 1.67.2.4
  diff -u -r1.67.2.3 -r1.67.2.4
  --- HttpConnection.java	8 Sep 2003 00:33:31 -0000	1.67.2.3
  +++ HttpConnection.java	10 Sep 2003 21:34:11 -0000	1.67.2.4
  @@ -904,7 +904,14 @@
                       LOG.debug("Input data not available after " + timeout + " ms");
                   }
               } finally {
  -                socket.setSoTimeout(soTimeout);
  +                try {
  +                    socket.setSoTimeout(soTimeout);
  +                } catch (IOException ioe) {
  +                    LOG.debug("An error ocurred while resetting soTimeout, we will assume
that"
  +                        + " no response is available.",
  +                        ioe);
  +                    result = false;
  +                }
               }
           }
           return result;
  
  
  

Mime
View raw message