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

ASF GitHub Bot commented on CAMEL-12751:
----------------------------------------

bobpaulin commented on issue #2496: CAMEL-12751 - Added Content-Length Test for 
incorrect length.
URL: https://github.com/apache/camel/pull/2496#issuecomment-418475646
 
 
   Or perhaps remove the code that sets it in the 
org.apache.camel.component.http4.HttpEntityConverter?
   ```
       private static HttpEntity asHttpEntity(InputStream in, Exchange 
exchange) throws IOException {
           InputStreamEntity entity;
           if (!exchange.getProperty(Exchange.SKIP_GZIP_ENCODING, 
Boolean.FALSE, Boolean.class)) {
               String contentEncoding = 
exchange.getIn().getHeader(Exchange.CONTENT_ENCODING, String.class);
               InputStream stream = GZIPHelper.compressGzip(contentEncoding, 
in);
               entity = new InputStreamEntity(stream, stream instanceof 
ByteArrayInputStream
                   ? stream.available() != 0 ? stream.available() : -1 : -1);
           } else {
                   entity = new InputStreamEntity(in, Long.parseLong(length));
           }
       }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> http producer - Ignore content length header
> --------------------------------------------
>
>                 Key: CAMEL-12751
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12751
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-http, camel-http4
>    Affects Versions: 2.22.0
>            Reporter: Claus Ibsen
>            Priority: Major
>             Fix For: 2.22.2, 2.23.0
>
>
> When doing eg REST -> HTTP etc then the REST consumer may populate the 
> message with Content-Length header, which gets propagated to the http 
> producer. We should by default ignore those existing headers and calculate 
> the length in the producer based on the message body, eg if string, byte[] 
> etc which AFAIR does today.
> See nabble
> http://camel.465427.n5.nabble.com/Content-Length-Header-being-used-previous-HTTP-Response-td5813376.html



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

Reply via email to