This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new a8a9b40b3c2 fix(components/jetty-common): don't use user provided 
character encoding
a8a9b40b3c2 is described below

commit a8a9b40b3c283167aa1d2dc2ae7e7cb0fc3a971e
Author: Pasquale Congiusti <pasquale.congiu...@gmail.com>
AuthorDate: Thu Feb 13 16:57:37 2025 +0100

    fix(components/jetty-common): don't use user provided character encoding
    
    For security reasons
---
 .../apache/camel/component/jetty/CamelContinuationServlet.java    | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
index 9a0020b661b..51c2ee23f14 100644
--- 
a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
+++ 
b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/CamelContinuationServlet.java
@@ -33,12 +33,12 @@ import org.apache.camel.AsyncCallback;
 import org.apache.camel.CamelException;
 import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
+import org.apache.camel.ExchangePropertyKey;
 import org.apache.camel.Message;
 import org.apache.camel.http.common.CamelServlet;
 import org.apache.camel.http.common.HttpCommonEndpoint;
 import org.apache.camel.http.common.HttpConstants;
 import org.apache.camel.http.common.HttpConsumer;
-import org.apache.camel.http.common.HttpHelper;
 import org.apache.camel.http.common.HttpMessage;
 import org.apache.camel.spi.UnitOfWork;
 import org.apache.camel.support.ObjectHelper;
@@ -200,8 +200,10 @@ public class CamelContinuationServlet extends CamelServlet 
{
                 exchange.setProperty(Exchange.DISABLE_HTTP_STREAM_CACHE, 
Boolean.TRUE);
             }
 
-            HttpHelper.setCharsetFromContentType(request.getContentType(), 
exchange);
-
+            String charset = request.getCharacterEncoding();
+            if (charset != null) {
+                exchange.setProperty(ExchangePropertyKey.CHARSET_NAME, 
charset);
+            }
             // reuse existing http message if pooled
             Message msg = exchange.getIn();
             if (msg instanceof HttpMessage) {

Reply via email to