camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Mueller (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAMEL-2452) HttpHeaderFilterStrategy dosn't filters out 'Cache-Control', 'Connection', 'Pragma', 'Trailer', 'Transfer-Encoding', 'Upgrade', 'Via' and 'Warning' in method applyFilterToCamelHeaders
Date Wed, 10 Feb 2010 09:23:33 GMT

    [ https://issues.apache.org/activemq/browse/CAMEL-2452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=57489#action_57489
] 

Christian Mueller commented on CAMEL-2452:
------------------------------------------

Claus,
could you please have a look on this issue and patch. [CAMEL-1530|https://issues.apache.org/activemq/browse/CAMEL-1530]
depends on this and I planed to deliver the patch for [CAMEL-1530|https://issues.apache.org/activemq/browse/CAMEL-1530]
in the next tree days.

The "problem" is, that HttpClient 4.0.1 checks the request header of the presents of some
header which must not in, e.g. Transfer-Encoding. This header (and the other headers list
in the issue name) should be filtered by the HttpHeaderFilterStrategy:

{code:title=HttpHeaderFilterStrategy.java}
public class HttpHeaderFilterStrategy extends DefaultHeaderFilterStrategy {

    public HttpHeaderFilterStrategy() {
        initialize();
    }

    protected void initialize() {
        getOutFilter().add("content-length");
        getOutFilter().add("content-type");
        // Add the filter for the Generic Message header
        // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
        getOutFilter().add("Cache-Control");
        getOutFilter().add("Connection");
        getOutFilter().add("Pragma");
        getOutFilter().add("Trailer");
        getOutFilter().add("Transfer-Encoding");
        getOutFilter().add("Upgrade");
        getOutFilter().add("Via");
        getOutFilter().add("Warning");

    setLowerCase(true);

        // filter headers begin with "Camel" or "org.apache.camel"
        // must ignore case for Http based transports
        setOutFilterPattern("(?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*");
        }
}
{code}

But DefaultHeaderFilterStrategy compares the lower case strings, if lowerCase is set to true
(which is the case for HttpHeaderFilterStrategy)

{code:title=DefaultHeaderFilterStrategy .java}
if (filter != null) {
    if (isLowerCase()) {
        if (filter.contains(headerName.toLowerCase())) {
            return true;
        }
    } else {
        if (filter.contains(headerName)) {
            return true;
        }
    }
}
{code}

This imply, that 'Transfer-Encoding' is comparing with 'transfer-encoding' what never match
and this header will be never filtered out.

Tanks,
Christian

> HttpHeaderFilterStrategy dosn't filters out 'Cache-Control', 'Connection', 'Pragma',
'Trailer', 'Transfer-Encoding', 'Upgrade', 'Via' and 'Warning' in method applyFilterToCamelHeaders
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2452
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2452
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.1.0
>         Environment: All
>            Reporter: Christian Mueller
>            Assignee: Christian Mueller
>             Fix For: 2.3.0
>
>         Attachments: HttpHeaderFilterStrategy.patch, HttpHeaderFilterStrategyTest.patch
>
>
> HttpHeaderFilterStrategy uses the HTTP headers with upper case characters on the beginning
(e. g. 'Transfer-Encoding' instead of 'transfer-encoding').

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


Mime
View raw message