[
https://issues.apache.org/jira/browse/CAMEL-20099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17785790#comment-17785790
]
Claus Ibsen commented on CAMEL-20099:
-------------------------------------
And yes I can see the bug in 4.1.0 when using --camel-version=4.1.0
{code}
09:19:30.032 DEBUG 14935 --- [ler://scheduler] org.apache.hc.client5.http.wire
: http-outgoing-0 >> "POST / HTTP/1.1[\r][\n]"
2023-11-14 09:19:30.032 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Accept-Encoding:
gzip, x-gzip, deflate[\r][\n]"
2023-11-14 09:19:30.032 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Content-Length:
21[\r][\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Content-Type:
application/json; charset=UTF-8[\r][\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Content-Encoding:
UTF-8[\r][\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Host:
01het4h4zq3gvtecszbv5rpx3y00-4f92b8ba4ea1459ece69.requestinspector.com[\r][\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Connection:
keep-alive[\r][\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "User-Agent:
Apache-HttpClient/5.2.1 (Java/17.0.5)[\r][\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "[\r][\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "{[\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> " "some": "value"[\n]"
2023-11-14 09:19:30.033 DEBUG 14935 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "}"
{code}
So this is fixed in 4.2.0 onwards.
> Camel-http is creating invalid Content-Encoding header based on charset from
> Content-Type header
> ------------------------------------------------------------------------------------------------
>
> Key: CAMEL-20099
> URL: https://issues.apache.org/jira/browse/CAMEL-20099
> Project: Camel
> Issue Type: Bug
> Components: camel-http
> Affects Versions: 4.1.0
> Reporter: Damir Palinic
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.0.3, 4.3.0
>
> Attachments: Screenshot 2023-11-14 at 09.12.12.png, Selection_894.png
>
>
> In case *Content-Type* header has *";charset=UTF-8"* suffix, camel-http
> component creates *Content-Encoding: UTF-8* header which is invalid by RFC
> specification.
> If you try to send request with *Content-Encoding: UTF-8* to SAP systems for
> example, they will reject it due to invalid header.
> YAML DSL to reproduce the issue:
>
> {code:java}
> - route:
> nodePrefixId: route-7e2
> id: route-dafc
> from:
> uri: scheduler
> id: from-64dc
> parameters:
> name: scheduler
> steps:
> - setHeader:
> name: Content-Type
> expression:
> simple:
> expression: application/json;charset=UTF-8
> id: simple-dc79
> id: setHeader-2f26
> - setBody:
> expression:
> simple:
> expression: |-
> {
> "some": "value"
> }
> id: simple-bfca
> id: setBody-243c
> - to:
> uri: http
> id: to-2cfa
> parameters:
> httpUri: >-
>
> 01het4h4zq3gvtecszbv5rpx3y00-4f92b8ba4ea1459ece69.requestinspector.com
> httpMethod: POST
> {code}
> Additional notes:
> * If you remove ";charset=UTF-8" part from the Content-Type header, and call
> one more http request after the first one, it gets appended automatically for
> some reason, even if you remove Content-Type header and set it again manually
> (possible another bug) between two calls
> * Same behavior is for the https traffic
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)