You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mb...@apache.org on 2003/03/07 14:50:53 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpMethodBase.java ConnectMethod.java
mbecke 2003/03/07 05:50:53
Modified: httpclient/src/java/org/apache/commons/httpclient
HttpMethodBase.java ConnectMethod.java
Log:
This should fix the problem where the ConnectMethod would prematurely release the connection.
PR: 17563
Reviewed by: Oleg and Jeff
Revision Changes Path
1.121 +6 -14 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.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- HttpMethodBase.java 6 Mar 2003 07:49:03 -0000 1.120
+++ HttpMethodBase.java 7 Mar 2003 13:50:52 -0000 1.121
@@ -72,7 +72,6 @@
import java.net.URL;
import java.util.HashSet;
import java.util.Set;
-import java.util.StringTokenizer;
import org.apache.commons.httpclient.cookie.MalformedCookieException;
import org.apache.commons.httpclient.cookie.CookiePolicy;
@@ -806,15 +805,8 @@
*/
protected boolean shouldCloseConnection() {
if (!http11) {
- if (getName().equals(ConnectMethod.NAME)
- && (statusLine.getStatusCode() == HttpStatus.SC_OK)) {
- LOG.debug("Will leave connection open for tunneling");
- return false;
- } else {
- LOG.debug("Should close connection since using HTTP/1.0, "
- + "ConnectMethod and status is OK");
- return true;
- }
+ LOG.debug("Should close connection since using HTTP/1.0.");
+ return true;
} else {
Header connectionHeader = getResponseHeader("connection");
if (null != connectionHeader
1.8 +23 -4 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ConnectMethod.java 28 Jan 2003 04:40:20 -0000 1.7
+++ ConnectMethod.java 7 Mar 2003 13:50:53 -0000 1.8
@@ -167,10 +167,29 @@
conn.printLine(line);
}
+ /**
+ * Does nothing. This should be handled by the actual method.
+ *
+ * @see HttpMethodBase#responseBodyConsumed()
+ */
+ protected void responseBodyConsumed() {
+ }
+ /**
+ * Returns <code>true</code> if the status code is anything other than
+ * SC_OK, <code>false</code> otherwise.
+ *
+ * @see HttpMethodBase#shouldCloseConnection()
+ * @see HttpStatus#SC_OK
+ */
+ protected boolean shouldCloseConnection() {
+ return (getStatusCode() != HttpStatus.SC_OK);
+ }
+
/** Log object for this class. */
private static final Log LOG = LogFactory.getLog(ConnectMethod.class);
/** The wrapped method */
private HttpMethod method;
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org