geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r603548 - in /geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec: HttpIoHandler.java HttpRequestMessage.java
Date Wed, 12 Dec 2007 10:45:53 GMT
Author: rickmcguire
Date: Wed Dec 12 02:45:53 2007
New Revision: 603548

URL: http://svn.apache.org/viewvc?rev=603548&view=rev
Log:
GERONIMO-3618 when redirected via status code 30x, the original query is incorrectly appended
to the location

Patch submitted by Sangjin Lee. 


Modified:
    geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpIoHandler.java
    geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpRequestMessage.java

Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpIoHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpIoHandler.java?rev=603548&r1=603547&r2=603548&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpIoHandler.java
(original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpIoHandler.java
Wed Dec 12 02:45:53 2007
@@ -117,8 +117,13 @@
             AsyncHttpClient client = (AsyncHttpClient) ioSession.getAttachment();
 
             //Change the request url to the redirect
-            String query = request.getUrl().getQuery();
             request.setUrl(new URL(response.getLocation()));
+            // if we're redirected via 30x, the request method should be reset to GET
+            if (!request.getRequestMethod().equals(HttpRequestMessage.REQUEST_GET)) {
+            	request.setRequestMethod(HttpRequestMessage.REQUEST_GET);
+            }
+            // we also need to clear out the parameters
+            request.clearAllParameters();
 
             //Send the redirect
             client.sendRequest(request);

Modified: geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpRequestMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpRequestMessage.java?rev=603548&r1=603547&r2=603548&view=diff
==============================================================================
--- geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpRequestMessage.java
(original)
+++ geronimo/sandbox/AsyncHttpClient/src/main/java/org/apache/ahc/codec/HttpRequestMessage.java
Wed Dec 12 02:45:53 2007
@@ -360,6 +360,14 @@
     public void setParameter(String name, String value) {
         parameters.put(name, value);
     }
+    
+    /**
+     * Clears all parameters.
+     *
+     */
+    public void clearAllParameters() {
+    	parameters.clear();
+    }
 
     /**
      * Gets the user agent string.



Mime
View raw message