cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6361] Extending the use of a 'max same uri count'
Date Tue, 21 Apr 2015 16:12:42 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes c7061f5a1 -> c93a135e2


[CXF-6361] Extending the use of a 'max same uri count'


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c93a135e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c93a135e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c93a135e

Branch: refs/heads/2.7.x-fixes
Commit: c93a135e237266a64345d8da0eac810cff3cabaa
Parents: c7061f5
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Apr 21 17:10:33 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Apr 21 17:12:25 2015 +0100

----------------------------------------------------------------------
 .../org/apache/cxf/transport/http/HTTPConduit.java | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c93a135e/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
index 74a738b..c408fc8 100644
--- a/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
+++ b/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
@@ -1821,14 +1821,23 @@ public abstract class HTTPConduit
         if (newURL != null && newURLCount != null) {
             // See if we are being redirected in a loop as best we can,
             // using string equality on URL.
-            boolean invalidLoopDetected = newURL.equals(lastURL); 
+            boolean invalidLoopDetected = newURL.equals(lastURL);
+            
+            Integer maxSameURICount = PropertyUtils.getInteger(message, AUTO_REDIRECT_MAX_SAME_URI_COUNT);
+            
             if (!invalidLoopDetected) {
-                // this URI was used sometime earlier
-                Integer maxSameURICount = PropertyUtils.getInteger(message, AUTO_REDIRECT_MAX_SAME_URI_COUNT);
+                // This new URI was already recorded earlier even though it is not equal
to the last URI
+                // Example: a-b-a, where 'a' is the new URI. Check if a limited number of
occurrences of this URI 
+                // is allowed, fail by default.
                 if (maxSameURICount == null || newURLCount > maxSameURICount) {
                     invalidLoopDetected = true;
                 }
-            }
+            } else if (maxSameURICount != null && newURLCount <= maxSameURICount)
{
+                // This new URI was already recorded earlier and is the same as the last
URI.
+                // Example: a-a. But we have a property supporting a limited number of occurrences
of this URI.
+                // Continue the invocation. 
+                invalidLoopDetected = false;
+            } 
             if (invalidLoopDetected) {
                 // We are in a redirect loop; -- bail
                 String msg = "Redirect loop detected on Conduit '" 


Mime
View raw message