You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ad...@apache.org on 2003/06/20 15:30:02 UTC

cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java

adrian      2003/06/20 06:30:02

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpMethodBase.java
  Log:
  Avoids a SocketException being thrown when the Content-Length header is missing.
  
  PR: bug 20938
  
  Reviewed by:	Michael Becke and Oleg Kalnichevski
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.153     +12 -4     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java
  
  Index: HttpMethodBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java,v
  retrieving revision 1.152
  retrieving revision 1.153
  diff -u -r1.152 -r1.153
  --- HttpMethodBase.java	13 Jun 2003 21:32:17 -0000	1.152
  +++ HttpMethodBase.java	20 Jun 2003 13:30:02 -0000	1.153
  @@ -880,6 +880,14 @@
        */
       protected boolean shouldCloseConnection(HttpConnection conn) {
   
  +        // if we are not chunked and there is no content length the connection
  +        // cannot be reused
  +        if (responseHeaders.getFirstHeader("Transfer-Encoding") == null 
  +            && getResponseContentLength() < 0) {
  +            LOG.debug("Should close connection as content-length is missing.");
  +            return true;
  +        }
  +
           Header connectionHeader = null;
           // In case being connected via a proxy server
           if (!conn.isTransparent()) {
  
  
  

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