Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DE783200BA2 for ; Sun, 16 Oct 2016 13:17:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id DD431160ACE; Sun, 16 Oct 2016 11:17:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2FD5E160AFA for ; Sun, 16 Oct 2016 13:17:22 +0200 (CEST) Received: (qmail 36941 invoked by uid 500); 16 Oct 2016 11:17:21 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 36822 invoked by uid 99); 16 Oct 2016 11:17:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Oct 2016 11:17:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 918342C4C79 for ; Sun, 16 Oct 2016 11:17:20 +0000 (UTC) Date: Sun, 16 Oct 2016 11:17:20 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-10380) JettyHttpEndpoint9 ignores eagerCheckContentAvailable so Jetty builds a reuqest with "Transfer-Encoding: chunked" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sun, 16 Oct 2016 11:17:23 -0000 [ https://issues.apache.org/jira/browse/CAMEL-10380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-10380: -------------------------------- Fix Version/s: 2.19.0 2.18.1 2.17.4 > JettyHttpEndpoint9 ignores eagerCheckContentAvailable so Jetty builds a reuqest with "Transfer-Encoding: chunked" > ----------------------------------------------------------------------------------------------------------------- > > Key: CAMEL-10380 > URL: https://issues.apache.org/jira/browse/CAMEL-10380 > Project: Camel > Issue Type: Bug > Components: camel-jetty > Affects Versions: 2.17.3 > Reporter: Rudolf Batt > Priority: Minor > Fix For: 2.17.4, 2.18.1, 2.19.0 > > > My original problem is the fact, that in a Jetty based proxy the consumer sets the header "Transfer-Encoding: chunked" to the backend request for a GET request without body. This is not necessary, since there is no body, but the http component puts that null body into a InputStreamCache/HttpInputOverHTTP. This happens, because there is no content-length header set (which means it's "-1"): > see https://github.com/apache/camel/blob/master/components/camel-http-common/src/main/java/org/apache/camel/http/common/DefaultHttpBinding.java#L564 > The only workaround I found, is to set "eagerCheckContentAvailable=true". Unfortunately the JettyHttpEndpoint9 does not transfer this setting to the http binding and therefor my problem can't be fixed. (Ok, I found another workaround, but it's really ugly.) > I found that problem using camel-2.17. In the current master branch, there is an open TODO to transfer this option: > https://github.com/apache/camel/blame/master/components/camel-jetty9/src/main/java/org/apache/camel/component/jetty9/JettyHttpEndpoint9.java#L52 > For me this fixed the problem in my "test". > I didn't manage to build a good test, since that header is set deeply inside "org.eclipse.jetty.client.HttpConnection.normalizeRequest(Request)", but it's easy to reproduce it, by running a simple proxy and enable DEBUG log for "org.eclipse.jetty.client.HttpSender": > Inside the log a http header like will be logged: > {noformat} > Accept-Encoding: gzip > User-Agent: Jetty/9.2.15.v20160210 > sendDirect: true > Host: 127.0.0.1 > Transfer-Encoding: chunked > {noformat} > This is the test I used to reproduce and debug that problen > {code} > public class JettyEndpointsChuckedFalseTest extends BaseJettyTest { > > @Test > public void runningTest() throws Exception { > Exchange exchange = template.request("http://localhost:{{port}}/test", new Processor() { > @Override > public void process(Exchange exchange) throws Exception { > exchange.getIn().getBody(); > } > }); > assertNotNull(exchange); > } > > @Override > protected RouteBuilder createRouteBuilder() throws Exception { > return new RouteBuilder() { > @Override > public void configure() throws Exception { > from("jetty:http://localhost:{{port}}/test?matchOnUriPrefix=true&chunked=false&disableStreamCache=true" > + "&eagerCheckContentAvailable=true") > .to("log:request-debug?showHeaders=true&showBody=false&level=INFO") > .to("jetty:http://localhost:{{port2}}/test?bridgeEndpoint=true&chunked=false"); > > from("jetty:http://localhost:{{port2}}/test") > .to("mock:dead.end"); > } > }; > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)