camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Jetty Producer always uses "Transfer-Encoding: chunked"
Date Sat, 11 Mar 2017 12:36:57 GMT

Have you tried your patch and then run all the unit tests of camel-jetty9 ?

On Fri, Mar 10, 2017 at 11:12 PM, mluckam <> wrote:
> When passing a request with a Content-Length header through a route with a
> jetty consumer and producer, the producer is removing the Content-Length
> header and replacing it with Transfer-Encoding: chunked.  The uri option
> chunked appears to only be for jetty consumers and not for producers.  This
> issue seems to stem from the following set of calls starting in
> JettyHttpProducer ln 184 (camel-2.18.2):
> httpExchange.setRequestContent(is)
>   this.request.content(new InputStreamContentProvider(ins),
> this.requestContentType)
> With the content set as an InputStreamContentProvider, when the
> content.getLength() is called in org.eclipse.jetty.client.HttpConnection ln
> 120, it is returned as -1.  This causes the "Transfer-Encoding: chunked"
> header to be added at ln 129.  Again in the
> org.eclipse.jetty.http.HttpGenerator class getLength() is called on the
> InputStreamContentProvider and since it is -1, the Content-Length header is
> not added to the request to be sent out.
> I propose that the InputStreamContentProvider be subclassed and given a
> value for its length as was done by the class
> org.eclipse.jetty.proxy.ProxyServlet.ProxyInputStreamContentProvider.  This
> subclass could then be used in the JettyHttpProducer, but only if the
> Content-Length header exists.  This would allow subsequent calls to the
> ContentProvider to return a positive value for getLength() and therefore
> allow the Content-Length header to persist.  A prototype of this patch is
> attached to the post.
> jettyProducer.patch
> <>
> --
> View this message in context:
> Sent from the Camel Development mailing list archive at

Claus Ibsen
----------------- @davsclaus
Camel in Action 2:

View raw message