[
https://issues.apache.org/jira/browse/CAMEL-20099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17785789#comment-17785789
]
Claus Ibsen commented on CAMEL-20099:
-------------------------------------
And with DEBUG logging level enabled (--logging-level=DEBUG) if you run via
camel-jbang
{code}
09:16:31.896 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 >> POST / HTTP/1.1
2023-11-14 09:16:31.896 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 >> Accept-Encoding: gzip,
x-gzip, deflate
2023-11-14 09:16:31.896 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 >> Content-Length: 21
2023-11-14 09:16:31.896 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 >> Content-Type:
application/json; charset=UTF-8
2023-11-14 09:16:31.896 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 >> Host:
01het4h4zq3gvtecszbv5rpx3y00-4f92b8ba4ea1459ece69.requestinspector.com
2023-11-14 09:16:31.896 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 >> Connection: keep-alive
2023-11-14 09:16:31.896 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 >> User-Agent:
Apache-HttpClient/5.2.1 (Java/17.0.5)
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "POST /
HTTP/1.1[\r][\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Accept-Encoding:
gzip, x-gzip, deflate[\r][\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Content-Length:
21[\r][\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Content-Type:
application/json; charset=UTF-8[\r][\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Host:
01het4h4zq3gvtecszbv5rpx3y00-4f92b8ba4ea1459ece69.requestinspector.com[\r][\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "Connection:
keep-alive[\r][\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [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:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "[\r][\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "{[\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> " "some": "value"[\n]"
2023-11-14 09:16:31.897 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 >> "}"
2023-11-14 09:16:32.120 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "HTTP/1.1 200
OK[\r][\n]"
2023-11-14 09:16:32.120 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "Date: Tue, 14 Nov
2023 08:16:32 GMT[\r][\n]"
2023-11-14 09:16:32.120 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "Content-Type:
text/plain; charset=utf-8[\r][\n]"
2023-11-14 09:16:32.120 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "Content-Length:
2[\r][\n]"
2023-11-14 09:16:32.120 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "Connection:
keep-alive[\r][\n]"
2023-11-14 09:16:32.121 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "X-Limits-Limit:
100[\r][\n]"
2023-11-14 09:16:32.121 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "X-Limits-Remaining:
99[\r][\n]"
2023-11-14 09:16:32.121 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "X-Limits-Reset:
1699949795[\r][\n]"
2023-11-14 09:16:32.122 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "CF-Cache-Status:
DYNAMIC[\r][\n]"
2023-11-14 09:16:32.122 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "Report-To:
{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ArHC7v3ft6r6yVSQGPjUDGdbdNAZHOyEdVCJZUd%2B7ysJ7rEugl47EeW8jX3iMQddBaJ5YM3yXwbob1DlDDr%2BksPKD%2BqeVQPGBNkGcY2qIG2tsA075CK0n6gwZm6j0FWI9un8VGcZ4pvravNXSLGF6JlJmZWXw58ofNZhuchPnTDr1wOjIA5Q55qKE%2FkCmK3gtwsVZAwWc1xS"}],"group":"cf-nel","max_age":604800}[\r][\n]"
2023-11-14 09:16:32.123 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "NEL:
{"success_fraction":0,"report_to":"cf-nel","max_age":604800}[\r][\n]"
2023-11-14 09:16:32.123 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "Server:
cloudflare[\r][\n]"
2023-11-14 09:16:32.123 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "CF-RAY:
825dd017899ab523-OSL[\r][\n]"
2023-11-14 09:16:32.123 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "alt-svc: h3=":443";
ma=86400[\r][\n]"
2023-11-14 09:16:32.123 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "[\r][\n]"
2023-11-14 09:16:32.123 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.wire : http-outgoing-0 << "OK"
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << HTTP/1.1 200 OK
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << Date: Tue, 14 Nov 2023
08:16:32 GMT
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << Content-Type:
text/plain; charset=utf-8
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << Content-Length: 2
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << Connection: keep-alive
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << X-Limits-Limit: 100
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << X-Limits-Remaining: 99
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << X-Limits-Reset:
1699949795
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << CF-Cache-Status:
DYNAMIC
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << Report-To:
{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=ArHC7v3ft6r6yVSQGPjUDGdbdNAZHOyEdVCJZUd%2B7ysJ7rEugl47EeW8jX3iMQddBaJ5YM3yXwbob1DlDDr%2BksPKD%2BqeVQPGBNkGcY2qIG2tsA075CK0n6gwZm6j0FWI9un8VGcZ4pvravNXSLGF6JlJmZWXw58ofNZhuchPnTDr1wOjIA5Q55qKE%2FkCmK3gtwsVZAwWc1xS"}],"group":"cf-nel","max_age":604800}
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << NEL:
{"success_fraction":0,"report_to":"cf-nel","max_age":604800}
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << Server: cloudflare
2023-11-14 09:16:32.127 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << CF-RAY:
825dd017899ab523-OSL
2023-11-14 09:16:32.128 DEBUG 14893 --- [ler://scheduler]
org.apache.hc.client5.http.headers : http-outgoing-0 << alt-svc: h3=":443";
ma=86400
{code}
> 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)