Excerpt from EntityEnclosingMethod.java:

Entity enclosing requests cannot be redirected without user intervention
according to RFC 2616.

However, according to the RFC:

Note: RFC 1945 and RFC 2068 specify that the client is not allowed
      to change the method on the redirected request.  However, most
      existing user agent implementations treat 302 as if it were a 303
      response, performing a GET on the Location field-value regardless
      of the original request method. The status codes 303 and 307 have
      been added for servers that wish to make unambiguously clear which
      kind of reaction is expected of the client.

It's great that you guys are trying to follow the RFC, but the problem is,
what we really need is a client that can act like a web browser, not something
that strictly follows the RFC.  We were using an older version of HttpClient,
and following a 302 response from a POST worked.  Upgrading to 2.0rc2 broke
this behavior.  It seems like the most flexible solution would be to default
to not following redirects, as the RFC suggests, but to allow the developer
to explicitly set the following of redirects if he really needs it.  That's
what this patch does.
Index: src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java,v
retrieving revision 1.18.2.2
diff -u -r1.18.2.2 EntityEnclosingMethod.java
--- src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java	4 Oct 2003 02:31:26 -0000	1.18.2.2
+++ src/java/org/apache/commons/httpclient/methods/EntityEnclosingMethod.java	17 Oct 2003 19:03:45 -0000
@@ -243,35 +243,6 @@
     }
 
     /**
-     * Entity enclosing requests cannot be redirected without user intervention
-     * according to RFC 2616.
-     *
-     * @return <code>false</code>.
-     *
-     * @since 2.0
-     */
-    public boolean getFollowRedirects() {
-        return false;
-    }
-
-
-    /**
-     * Entity enclosing requests cannot be redirected without user intervention 
-     * according to RFC 2616.
-     *
-     * @param followRedirects must always be <code>false</code>
-     */
-    public void setFollowRedirects(boolean followRedirects) {
-        if (followRedirects == true) {
-            // TODO: EntityEnclosingMethod should inherit from HttpMethodBase rather than GetMethod
-            // Enable exception once the inheritence is fixed
-            //throw new IllegalArgumentException(
-            //  "Entity enclosing requests cannot be redirected without user intervention");
-        }
-        super.setFollowRedirects(false);
-    }
-
-    /**
      * Sets length information about the request body.
      *
      * <p>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to