You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "John Georgiadis (JIRA)" <ji...@apache.org> on 2008/09/12 12:37:44 UTC

[jira] Created: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
------------------------------------------------------

                 Key: CXF-1795
                 URL: https://issues.apache.org/jira/browse/CXF-1795
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.1.2
         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
            Reporter: John Georgiadis


HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.

The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.

I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
String mappedName = HttpHeaderHelper.getHeaderKey(fname);
already maps common upper-case headers to lower-case (except Authentication).


--- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
+++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
@@ -190,7 +190,7 @@
       HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
       //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
-            String fname = (String)e.nextElement();
+            String fname = ((String)e.nextElement()).toLowerCase();
           String mappedName = HttpHeaderHelper.getHeaderKey(fname);
           List<String> values;
           if (headers.containsKey(mappedName)) {

--- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
+++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
@@ -449,7 +449,7 @@
   private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
       Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
-        List<String> values = headers.get(header);
+        List<String> values = headers.get(header.toLowerCase());
       StringBuilder sb = new StringBuilder();
       if (values != null) {
           for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

Posted by "Chris Matthews (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698486#action_12698486 ] 

Chris Matthews edited comment on CXF-1795 at 4/13/09 11:40 AM:
---------------------------------------------------------------

I have encountered a bug that seems similar to this with CXF-2.1.4 REST (JAX-RS)

When specifying a @HeaderParam CXF does not map the header value to the method parameter unless the header parameter is provided all in lowercase (example: X-Forwarded-For).  Not sure if this is a bug but CXF should also ignore the case of the provided value for @HeaderParams.

      was (Author: cmatthews):
    I have encountered a bug that seems similar to this with CXF-2.1.4

When specifying a @HeaderParam CXF does not map the header value to the method parameter unless the header parameter is provided all in lowercase (example: X-Forwarded-For).  Not sure if this is a bug but CXF should also ignore the case of the provided value for @HeaderParams.
  
> REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
> ------------------------------------------------------
>
>                 Key: CXF-1795
>                 URL: https://issues.apache.org/jira/browse/CXF-1795
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
>            Reporter: John Georgiadis
>
> HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.
> The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.
> I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
> String mappedName = HttpHeaderHelper.getHeaderKey(fname);
> already maps common upper-case headers to lower-case (except Authentication).
> --- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
> +++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
> @@ -190,7 +190,7 @@
>        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
>        //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
> -            String fname = (String)e.nextElement();
> +            String fname = ((String)e.nextElement()).toLowerCase();
>            String mappedName = HttpHeaderHelper.getHeaderKey(fname);
>            List<String> values;
>            if (headers.containsKey(mappedName)) {
> --- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
> +++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
> @@ -449,7 +449,7 @@
>    private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
>        Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
> -        List<String> values = headers.get(header);
> +        List<String> values = headers.get(header.toLowerCase());
>        StringBuilder sb = new StringBuilder();
>        if (values != null) {
>            for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-1795.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.1

This issue must have been fixed in 2.2.1 for JAX-RS. Please reopen the JIRA if you find it is still not-working for you


> REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
> ------------------------------------------------------
>
>                 Key: CXF-1795
>                 URL: https://issues.apache.org/jira/browse/CXF-1795
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.2
>         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
>            Reporter: John Georgiadis
>            Assignee: Sergey Beryozkin
>             Fix For: 2.2.1
>
>
> HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.
> The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.
> I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
> String mappedName = HttpHeaderHelper.getHeaderKey(fname);
> already maps common upper-case headers to lower-case (except Authentication).
> --- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
> +++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
> @@ -190,7 +190,7 @@
>        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
>        //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
> -            String fname = (String)e.nextElement();
> +            String fname = ((String)e.nextElement()).toLowerCase();
>            String mappedName = HttpHeaderHelper.getHeaderKey(fname);
>            List<String> values;
>            if (headers.containsKey(mappedName)) {
> --- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
> +++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
> @@ -449,7 +449,7 @@
>    private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
>        Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
> -        List<String> values = headers.get(header);
> +        List<String> values = headers.get(header.toLowerCase());
>        StringBuilder sb = new StringBuilder();
>        if (values != null) {
>            for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin updated CXF-1795:
----------------------------------

    Component/s: REST

> REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
> ------------------------------------------------------
>
>                 Key: CXF-1795
>                 URL: https://issues.apache.org/jira/browse/CXF-1795
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.2
>         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
>            Reporter: John Georgiadis
>
> HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.
> The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.
> I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
> String mappedName = HttpHeaderHelper.getHeaderKey(fname);
> already maps common upper-case headers to lower-case (except Authentication).
> --- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
> +++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
> @@ -190,7 +190,7 @@
>        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
>        //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
> -            String fname = (String)e.nextElement();
> +            String fname = ((String)e.nextElement()).toLowerCase();
>            String mappedName = HttpHeaderHelper.getHeaderKey(fname);
>            List<String> values;
>            if (headers.containsKey(mappedName)) {
> --- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
> +++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
> @@ -449,7 +449,7 @@
>    private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
>        Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
> -        List<String> values = headers.get(header);
> +        List<String> values = headers.get(header.toLowerCase());
>        StringBuilder sb = new StringBuilder();
>        if (values != null) {
>            for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704171#action_12704171 ] 

Sergey Beryozkin commented on CXF-1795:
---------------------------------------

John, Chris : it should definitely be fixed in 2.2 and 2.1.5 - can you confirm please

I'd like to close this JIRA soon

thanks, Sergey


> REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
> ------------------------------------------------------
>
>                 Key: CXF-1795
>                 URL: https://issues.apache.org/jira/browse/CXF-1795
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.2
>         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
>            Reporter: John Georgiadis
>
> HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.
> The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.
> I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
> String mappedName = HttpHeaderHelper.getHeaderKey(fname);
> already maps common upper-case headers to lower-case (except Authentication).
> --- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
> +++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
> @@ -190,7 +190,7 @@
>        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
>        //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
> -            String fname = (String)e.nextElement();
> +            String fname = ((String)e.nextElement()).toLowerCase();
>            String mappedName = HttpHeaderHelper.getHeaderKey(fname);
>            List<String> values;
>            if (headers.containsKey(mappedName)) {
> --- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
> +++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
> @@ -449,7 +449,7 @@
>    private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
>        Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
> -        List<String> values = headers.get(header);
> +        List<String> values = headers.get(header.toLowerCase());
>        StringBuilder sb = new StringBuilder();
>        if (values != null) {
>            for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin reassigned CXF-1795:
-------------------------------------

    Assignee: Sergey Beryozkin

> REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
> ------------------------------------------------------
>
>                 Key: CXF-1795
>                 URL: https://issues.apache.org/jira/browse/CXF-1795
>             Project: CXF
>          Issue Type: Bug
>          Components: REST
>    Affects Versions: 2.1.2
>         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
>            Reporter: John Georgiadis
>            Assignee: Sergey Beryozkin
>
> HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.
> The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.
> I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
> String mappedName = HttpHeaderHelper.getHeaderKey(fname);
> already maps common upper-case headers to lower-case (except Authentication).
> --- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
> +++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
> @@ -190,7 +190,7 @@
>        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
>        //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
> -            String fname = (String)e.nextElement();
> +            String fname = ((String)e.nextElement()).toLowerCase();
>            String mappedName = HttpHeaderHelper.getHeaderKey(fname);
>            List<String> values;
>            if (headers.containsKey(mappedName)) {
> --- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
> +++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
> @@ -449,7 +449,7 @@
>    private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
>        Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
> -        List<String> values = headers.get(header);
> +        List<String> values = headers.get(header.toLowerCase());
>        StringBuilder sb = new StringBuilder();
>        if (values != null) {
>            for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

Posted by "Chris Matthews (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698486#action_12698486 ] 

Chris Matthews commented on CXF-1795:
-------------------------------------

I have encountered a bug that seems similar to this with CXF-2.1.4

When specifying a @HeaderParam CXF does not map the header value to the method parameter unless the header parameter is provided all in lowercase (example: X-Forwarded-For).  Not sure if this is a bug but CXF should also ignore the case of the provided value for @HeaderParams.

> REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
> ------------------------------------------------------
>
>                 Key: CXF-1795
>                 URL: https://issues.apache.org/jira/browse/CXF-1795
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
>            Reporter: John Georgiadis
>
> HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.
> The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.
> I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
> String mappedName = HttpHeaderHelper.getHeaderKey(fname);
> already maps common upper-case headers to lower-case (except Authentication).
> --- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
> +++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
> @@ -190,7 +190,7 @@
>        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
>        //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
> -            String fname = (String)e.nextElement();
> +            String fname = ((String)e.nextElement()).toLowerCase();
>            String mappedName = HttpHeaderHelper.getHeaderKey(fname);
>            List<String> values;
>            if (headers.containsKey(mappedName)) {
> --- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
> +++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
> @@ -449,7 +449,7 @@
>    private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
>        Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
> -        List<String> values = headers.get(header);
> +        List<String> values = headers.get(header.toLowerCase());
>        StringBuilder sb = new StringBuilder();
>        if (values != null) {
>            for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1795) REST header case sensitivity in CXF-2.1.2 / Tomcat AJP

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698774#action_12698774 ] 

Sergey Beryozkin commented on CXF-1795:
---------------------------------------

It must have been fixed for 2.1.5-SNAPSHOT, sorry it took me so long to get it fixed.
Please try the latest snapshot, available at http://repository.apache.org/snapshots/org/apache/cxf/apache-cxf/2.1.5-SNAPSHOT/ and confirm it's been fixed. The retrieval of http headers should now be case-insensitive, both for @HttpHeader and @Context HttpHeaders





> REST header case sensitivity in CXF-2.1.2 / Tomcat AJP
> ------------------------------------------------------
>
>                 Key: CXF-1795
>                 URL: https://issues.apache.org/jira/browse/CXF-1795
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>         Environment: Apache-2.2, Tomcat-6.0.18, mod_jk-1.2.26
>            Reporter: John Georgiadis
>
> HeaderParam labels in CXF-2.1.2 REST seem to be case sensitive. The problem appears only when using Tomcat-6.0.18 through its AJP connector. It does not appear when Tomcat is accessed through its HTTP connector. mod_jk (1.2.26) is passing headers unmodified to AJP, so differences in AJP & HTTP connectors make this issue manifest.
> The following patch fixed the bug for us. The Tomcat HTTP connector also works with the patch.
> I'm not sure whether other code paths are affected by the change in AbstractHTTPDestination, however the line after the modified code:
> String mappedName = HttpHeaderHelper.getHeaderKey(fname);
> already maps common upper-case headers to lower-case (except Authentication).
> --- rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java    2008-08-12 23:31:10.000000000 +0300
> +++ rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java 2008-09-11 21:31:56.000000000 +0300
> @@ -190,7 +190,7 @@
>        HttpServletRequest req = (HttpServletRequest)message.get(HTTP_REQUEST);
>        //TODO how to deal with the fields              for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
> -            String fname = (String)e.nextElement();
> +            String fname = ((String)e.nextElement()).toLowerCase();
>            String mappedName = HttpHeaderHelper.getHeaderKey(fname);
>            List<String> values;
>            if (headers.containsKey(mappedName)) {
> --- rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java     2008-08-12 23:30:37.000000000 +0300
> +++ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java  2008-09-11 21:29:53.000000000 +0300
> @@ -449,7 +449,7 @@
>    private static Object processHeaderParam(Message m, String header,                                             Class<?> pClass, Type genericType, String defaultValue) {
>        Map<String, List<String>> headers = (Map<String, List<String>>)m.get(Message.PROTOCOL_HEADERS);
> -        List<String> values = headers.get(header);
> +        List<String> values = headers.get(header.toLowerCase());
>        StringBuilder sb = new StringBuilder();
>        if (values != null) {
>            for (Iterator<String> it = values.iterator(); it.hasNext();) { 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.