You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2018/11/02 12:36:00 UTC

[jira] [Commented] (CAMEL-12911) gzip Content-Encoding problems after upgrading to Jetty 9.4.12

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

Claus Ibsen commented on CAMEL-12911:
-------------------------------------

Yeah it sounds plausible to remove that header after the body has been read/unzipped. 

> gzip Content-Encoding problems after upgrading to Jetty 9.4.12
> --------------------------------------------------------------
>
>                 Key: CAMEL-12911
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12911
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http, camel-jetty
>    Affects Versions: 2.22.1
>            Reporter: Grzegorz Grzybek
>            Assignee: Andrea Cosentino
>            Priority: Major
>
> After upgrading to Jetty {{9.4.12.v20180830}}, some tests stopped working:
> * org.apache.camel.component.jetty.JettyContentTypeTest.testContentTypeWithGZipEncoding(org.apache.camel.component.jetty.JettyContentTypeTest)
> * org.apache.camel.component.jetty.JettyImageFileTest.testImageContentWithGZip(org.apache.camel.component.jetty.JettyImageFileTest)
> * org.apache.camel.component.jetty.HttpGZipEncodingTest.testGzipProducerWithGzipData(org.apache.camel.component.jetty.HttpGZipEncodingTest)
> * org.apache.camel.component.jetty.HttpGZipEncodingTest.testGzipProxy(org.apache.camel.component.jetty.HttpGZipEncodingTest)
> * org.apache.camel.component.jetty.HttpGZipEncodingTest.testHttpProducerWithGzip(org.apache.camel.component.jetty.HttpGZipEncodingTest)
> I did some analysis on jetty side and the reason is [exactly this commit|https://github.com/eclipse/jetty.project/commit/cf3681ef568be2fea41e89b2937112a7474c5c07] for Jetty issue [1688|https://github.com/eclipse/jetty.project/issues/1688] where this was added to {{jetty-server/src/main/java/org/eclipse/jetty/server/Request.java}}:
> {code:xml}
>     private void extractContentParameters()
>     {
>         // Content cannot be encoded
>         if (_metaData!=null && getHttpFields().contains(HttpHeader.CONTENT_ENCODING))
>             throw new BadMessageException(HttpStatus.NOT_IMPLEMENTED_501,"Unsupported Content-Encoding");
> ...
> {code}
> With Jetty 9.4.11, it's Camel that does gzip encoding (when creating http entity for httpclient 3) and decoding (when reading http body in {{org.apache.camel.http.common.DefaultHttpBinding#readRequest()}}).
> However, with 9.4.12, after {{org.apache.camel.http.common.DefaultHttpBinding#readRequest()}} has read the body, it calls {{org.apache.camel.http.common.DefaultHttpBinding#readHeaders()}} which also extracts parameters.
> Because parameters may be POSTed using {{application/x-www-form-urlencoded}} content type, Jetty really needs GZIP Handler.
> So far tests worked, because we didn't use {{application/x-www-form-urlencoded}} content type.
> I'm not sure how to solve, but maybe, {{org.apache.camel.http.common.DefaultHttpBinding#readRequest()}} should remove {{Content-Encoding: gzip}} header after reading body? IMO, gzip decoding should be done at "server side" and jetty is the server - so either it decodes gzip content (using configured {{org.eclipse.jetty.server.handler.gzip.GzipHandler}}) or it should not be aware of encoded body (thus camel should pass wrapped request with {{Content-Encoding}} header filtered.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)