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:10:48 GMT
Repository: cxf
Updated Branches:
  refs/heads/master b68c86145 -> 6fd84bc9f


[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/6fd84bc9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6fd84bc9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6fd84bc9

Branch: refs/heads/master
Commit: 6fd84bc9fa08bae417ba5027a3694800f65bfbf0
Parents: b68c861
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:10:33 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/6fd84bc9/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 a6ebaa7..239d790 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
@@ -1847,14 +1847,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