commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient ConnectMethod.java
Date Mon, 26 May 2003 18:09:35 GMT
olegk       2003/05/26 11:09:35

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        ConnectMethod.java
  Log:
  Bug fix #20198 (HttpClient drops connection to the proxy when an invalid 'connection: close'
directive is encountered in 'connection established' response)
  
  Reviewed by Mike Becke
  Contributed by Oleg Kalnichevski
  
  Revision  Changes    Path
  1.16      +24 -5     jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java
  
  Index: ConnectMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/ConnectMethod.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ConnectMethod.java	22 May 2003 18:26:33 -0000	1.15
  +++ ConnectMethod.java	26 May 2003 18:09:35 -0000	1.16
  @@ -277,7 +277,26 @@
        * @return <code>true</code> if the connection should be closed
        */
       protected boolean shouldCloseConnection(HttpConnection conn) {
  -        return (getStatusCode() != HttpStatus.SC_OK);
  +        if (getStatusCode() != HttpStatus.SC_OK) {
  +            return true;
  +        } else {
  +            Header connectionHeader = null;
  +            if (!conn.isTransparent()) {
  +                connectionHeader = getResponseHeader("proxy-connection");
  +            }
  +            if (connectionHeader == null) {
  +                connectionHeader = getResponseHeader("connection");
  +            }
  +            if (connectionHeader != null) {
  +                if (connectionHeader.getValue().equalsIgnoreCase("close")) {
  +                    if (LOG.isWarnEnabled()) {
  +                        LOG.warn("Invalid header encountered '" + connectionHeader.toExternalForm()
+
  +                            "' in response " + getStatusLine().toString());
  +                    }
  +                }
  +            }
  +            return false;
  +        }
       }
       
       /** Log object for this class. */
  
  
  

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


Mime
View raw message