Repository: camel
Updated Branches:
  refs/heads/master 415f9549c -> e61f7f5a2


CAMEL-9052: HttpHeaderFilterStrategy should filter any Camel header on consumer 
side as well


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

Branch: refs/heads/master
Commit: e61f7f5a2d1603c00b2e0571fd59fff616eac19d
Parents: 4803af1
Author: Claus Ibsen <davscl...@apache.org>
Authored: Wed Aug 5 11:30:34 2015 +0200
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Wed Aug 5 11:44:25 2015 +0200

----------------------------------------------------------------------
 .../camel/component/netty/http/DefaultNettyHttpBinding.java    | 5 +----
 .../netty/http/NettyHttpHeaderFilterStrategyTest.java          | 6 ++++--
 .../camel/component/netty4/http/DefaultNettyHttpBinding.java   | 5 +----
 .../netty4/http/NettyHttpHeaderFilterStrategyTest.java         | 6 ++++--
 4 files changed, 10 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e61f7f5a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
 
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
index c071533..e9e9e83 100644
--- 
a/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
+++ 
b/components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/DefaultNettyHttpBinding.java
@@ -158,10 +158,7 @@ public class DefaultNettyHttpBinding implements 
NettyHttpBinding, Cloneable {
                 String value = request.headers().get(name);
                 // store a special header that this request was authenticated 
using HTTP Basic
                 if (value != null && value.trim().startsWith("Basic")) {
-                    if (headerFilterStrategy != null
-                            && 
!headerFilterStrategy.applyFilterToExternalHeaders(NettyHttpConstants.HTTP_AUTHENTICATION,
 "Basic", exchange)) {
-                        NettyHttpHelper.appendHeader(headers, 
NettyHttpConstants.HTTP_AUTHENTICATION, "Basic");
-                    }
+                    NettyHttpHelper.appendHeader(headers, 
NettyHttpConstants.HTTP_AUTHENTICATION, "Basic");
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e61f7f5a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderFilterStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderFilterStrategyTest.java
 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderFilterStrategyTest.java
index 15de68e..46cd61a 100644
--- 
a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderFilterStrategyTest.java
+++ 
b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/NettyHttpHeaderFilterStrategyTest.java
@@ -61,8 +61,9 @@ public class NettyHttpHeaderFilterStrategyTest {
         assertFalse(filter.applyFilterToExternalHeaders("warning", "199 
Miscellaneous warning", exchange));
         assertFalse(filter.applyFilterToExternalHeaders("Warning", "199 
Miscellaneous warning", exchange));
 
-        assertFalse(filter.applyFilterToExternalHeaders("CamelHeader", "test", 
exchange));
-        
assertFalse(filter.applyFilterToExternalHeaders("org.apache.camel.header", 
"test", exchange));
+        // any Camel header should be filtered
+        assertTrue(filter.applyFilterToExternalHeaders("CamelHeader", "test", 
exchange));
+        
assertTrue(filter.applyFilterToExternalHeaders("org.apache.camel.header", 
"test", exchange));
 
         assertFalse(filter.applyFilterToExternalHeaders("notFilteredHeader", 
"test", exchange));
 
@@ -95,6 +96,7 @@ public class NettyHttpHeaderFilterStrategyTest {
         assertTrue(filter.applyFilterToCamelHeaders("warning", "199 
Miscellaneous warning", exchange));
         assertTrue(filter.applyFilterToCamelHeaders("Warning", "199 
Miscellaneous warning", exchange));
 
+        // any Camel header should be filtered
         assertTrue(filter.applyFilterToCamelHeaders("CamelHeader", "test", 
exchange));
         assertTrue(filter.applyFilterToCamelHeaders("org.apache.camel.header", 
"test", exchange));
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e61f7f5a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
 
b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
index 1a8c496..435b334 100644
--- 
a/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
+++ 
b/components/camel-netty4-http/src/main/java/org/apache/camel/component/netty4/http/DefaultNettyHttpBinding.java
@@ -160,10 +160,7 @@ public class DefaultNettyHttpBinding implements 
NettyHttpBinding, Cloneable {
                 String value = request.headers().get(name);
                 // store a special header that this request was authenticated 
using HTTP Basic
                 if (value != null && value.trim().startsWith("Basic")) {
-                    if (headerFilterStrategy != null
-                            && 
!headerFilterStrategy.applyFilterToExternalHeaders(NettyHttpConstants.HTTP_AUTHENTICATION,
 "Basic", exchange)) {
-                        NettyHttpHelper.appendHeader(headers, 
NettyHttpConstants.HTTP_AUTHENTICATION, "Basic");
-                    }
+                    NettyHttpHelper.appendHeader(headers, 
NettyHttpConstants.HTTP_AUTHENTICATION, "Basic");
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/e61f7f5a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java
 
b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java
index 4fa8c69..cacb8e6 100644
--- 
a/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java
+++ 
b/components/camel-netty4-http/src/test/java/org/apache/camel/component/netty4/http/NettyHttpHeaderFilterStrategyTest.java
@@ -61,8 +61,9 @@ public class NettyHttpHeaderFilterStrategyTest {
         assertFalse(filter.applyFilterToExternalHeaders("warning", "199 
Miscellaneous warning", exchange));
         assertFalse(filter.applyFilterToExternalHeaders("Warning", "199 
Miscellaneous warning", exchange));
 
-        assertFalse(filter.applyFilterToExternalHeaders("CamelHeader", "test", 
exchange));
-        
assertFalse(filter.applyFilterToExternalHeaders("org.apache.camel.header", 
"test", exchange));
+        // any Camel header should be filtered
+        assertTrue(filter.applyFilterToExternalHeaders("CamelHeader", "test", 
exchange));
+        
assertTrue(filter.applyFilterToExternalHeaders("org.apache.camel.header", 
"test", exchange));
 
         assertFalse(filter.applyFilterToExternalHeaders("notFilteredHeader", 
"test", exchange));
 
@@ -95,6 +96,7 @@ public class NettyHttpHeaderFilterStrategyTest {
         assertTrue(filter.applyFilterToCamelHeaders("warning", "199 
Miscellaneous warning", exchange));
         assertTrue(filter.applyFilterToCamelHeaders("Warning", "199 
Miscellaneous warning", exchange));
 
+        // any Camel header should be filtered
         assertTrue(filter.applyFilterToCamelHeaders("CamelHeader", "test", 
exchange));
         assertTrue(filter.applyFilterToCamelHeaders("org.apache.camel.header", 
"test", exchange));
 

Reply via email to