From 1da3065043a81579b3d79ce79e88876f3975c3b7 Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Wed, 11 Nov 2009 04:11:27 +0000 Subject: [PATCH] [Bug 294345] minor fix to previous patch for this bugzilla issue git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1042 7e9141cc-0065-0410-87d8-b60c137991c4 --- VERSION.txt | 1 + .../org/eclipse/jetty/client/RedirectListener.java | 14 ++++++++++---- .../eclipse/jetty/client/HttpGetRedirectTest.java | 2 ++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index dc84160a79e..3cf7aee417f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -37,6 +37,7 @@ jetty-7.0.1-SNAPSHOT + Fixed client abort asocciation + CQ-3581 jetty OSGi contribution + Moved centralized logging and verifier back to sandbox + + 294345 Support for HTTP/301 + HTTP/302 response codes jetty-7.0.0.v20091005 5 October 2009 291340 Race condition in onException() notifications diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java b/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java index 88d589c2873..6e0d47d0a25 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/RedirectListener.java @@ -80,24 +80,28 @@ public class RedirectListener extends HttpEventListenerWrapper public void onRequestComplete() throws IOException { _requestComplete = true; + if (checkExchangeComplete()) + { super.onRequestComplete(); + } } public void onResponseComplete() throws IOException { _responseComplete = true; + if (checkExchangeComplete()) + { super.onResponseComplete(); + } } - private boolean checkExchangeComplete() throws IOException + public boolean checkExchangeComplete() + throws IOException { if (_redirected && _requestComplete && _responseComplete) { - setDelegatingRequests(true); - setDelegatingResponses(true); - if (_location != null) { if (_location.indexOf("://")>0) @@ -106,6 +110,7 @@ public class RedirectListener extends HttpEventListenerWrapper _exchange.setURI(_location); _destination.resend(_exchange); + return false; } else @@ -113,6 +118,7 @@ public class RedirectListener extends HttpEventListenerWrapper setDelegationResult(false); } } + return true; } diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java index 6165c4c50e4..ccbb684bbd7 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpGetRedirectTest.java @@ -18,11 +18,13 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; + import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import junit.framework.TestCase; + import org.eclipse.jetty.client.security.Realm; import org.eclipse.jetty.client.security.SimpleRealmResolver; import org.eclipse.jetty.http.HttpMethods;