You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "allthingssecurity (via GitHub)" <gi...@apache.org> on 2026/10/04 00:09:48 UTC

[PR] CAMEL-25295: camel-undertow - match the charset parameter of the Content-Type case-insensitively [camel]

allthingssecurity opened a new pull request, #27326:
URL: https://github.com/apache/camel/pull/27326

   # Description
   
   [CAMEL-25295](https://issues.apache.org/jira/browse/CAMEL-25295)
   
   Follow-up of #27245 (CAMEL-25248), as suggested in its review.
   
   camel-undertow found the charset of a `Content-Type` with Undertow's `Headers.extractQuotedValueFromHeader(contentType, "charset")`, which matches the parameter name case-sensitively, while parameter names are case-insensitive (RFC 9110). With `Content-Type: text/plain; Charset=ISO-8859-1`:
   - the consumer did not set `CamelCharsetName`, so the request body was read as UTF-8;
   - a `String` body of the consumer response or the producer request was written as UTF-8 while the header declared ISO-8859-1.
   
   This change adds `UndertowHelper.getCharsetFromContentType`, which finds the `charset` parameter case-insensitively, as `IOHelper.getCharsetNameFromContentType` does for the other HTTP components (camel-http-base `HttpHelper`, camel-http, camel-jetty, camel-vertx-http), and uses it for both the request charset and `UndertowHelper.toByteBuffer`. It deliberately does not use `IOHelper.getCharsetNameFromContentType` itself, which returns UTF-8 when there is no charset: the consumer sets `CamelCharsetName` only for a declared charset (892be63447, as the camel-platform-http-vertx consumer does), and a `String` body without a charset is converted as before. The upgrade guide gets a `====` subsection under the camel-undertow entry of CAMEL-25248.
   
   Tests:
   - `UndertowStringBodyCharsetTest`: three new tests with `Charset=ISO-8859-1`, for the consumer response, the consumer request, and the producer request, and one for a request without a charset (no `CamelCharsetName` / `CamelHttpCharacterEncoding`; it fails with `expected: <null> but was: <UTF-8>` if `IOHelper.getCharsetNameFromContentType` is used).
   - Without the change all three fail (`array lengths differ, expected: <14> but was: <17>`, and `<17>` / `<20>` for the request read as UTF-8).
   - With the change all camel-undertow tests pass: 200 tests, 0 failures, 1 skipped.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes.
     (I built and tested the affected module, including the formatter and import-sort plugins. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25295: camel-undertow - match the charset parameter of the Content-Type case-insensitively [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27326:
URL: https://github.com/apache/camel/pull/27326


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25295: camel-undertow - match the charset parameter of the Content-Type case-insensitively [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27326:
URL: https://github.com/apache/camel/pull/27326#issuecomment-5977281406

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25295: camel-undertow - match the charset parameter of the Content-Type case-insensitively [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27326:
URL: https://github.com/apache/camel/pull/27326#issuecomment-5977373885

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `components/camel-undertow`
   - `docs`
   
   > :information_source: Dependent modules were not tested because the total number of affected modules exceeded the threshold (50). Use the `test-dependents` label to force testing all dependents.
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 46 of 698 tested, 26 compile-only — current: 46 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **46 affected modules** (current approach: 46).
   
   **Skip-tests mode would test 46 modules** (2 direct + 45 downstream), **skip tests for 26** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (46)</summary>
   
   - `camel-a2a` ← downstream of org.apache.camel:camel-vertx-http
   - `camel-ai-observability` ← downstream of org.apache.camel:camel-telemetry
   - `camel-consul` ← downstream of org.apache.camel:camel-undertow
   - `camel-cxf-rest` ← downstream of org.apache.camel:camel-undertow
   - `camel-cxf-soap` ← downstream of org.apache.camel:camel-undertow
   - `camel-cxf-spring-rest` ← downstream of org.apache.camel:camel-undertow
   - `camel-cxf-spring-soap` ← downstream of org.apache.camel:camel-undertow
   - `camel-cxf-spring-transport` ← downstream of org.apache.camel:camel-cxf-transport
   - `camel-cxf-transport` ← downstream of org.apache.camel:camel-undertow
   - `camel-jbang-mcp` ← downstream of org.apache.camel:camel-catalog
   - `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-route-parser
   - `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
   - `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jsonpath` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-knative-http` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-langchain4j-agent` ← downstream of org.apache.camel:camel-telemetry
   - `camel-langchain4j-chat` ← downstream of org.apache.camel:camel-telemetry
   - `camel-langchain4j-embeddings` ← downstream of org.apache.camel:camel-telemetry
   - `camel-langchain4j-embeddingstore` ← downstream of org.apache.camel:camel-langchain4j-embeddings
   - `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
   - `camel-lra` ← downstream of org.apache.camel:camel-undertow
   - `camel-mcp-server` ← downstream of org.apache.camel:camel-openai
   - `camel-micrometer-observability` ← downstream of org.apache.camel:camel-undertow
   - `camel-micrometer-prometheus` ← downstream of org.apache.camel:camel-platform-http-main
   - `camel-oauth` ← downstream of org.apache.camel:camel-vertx-http
   - `camel-observability-services` ← downstream of org.apache.camel:camel-opentelemetry2
   - `camel-openai` ← downstream of org.apache.camel:camel-telemetry
   - `camel-openapi-validator` ← downstream of org.apache.camel:camel-rest-openapi
   - `camel-opentelemetry` ← downstream of org.apache.camel:camel-undertow
   - `camel-opentelemetry2` ← downstream of org.apache.camel:camel-undertow
   - `camel-platform-http-main` ← downstream of org.apache.camel:camel-platform-http-vertx
   - `camel-platform-http-vertx` ← downstream of org.apache.camel:camel-vertx-http
   - `camel-rest-openapi` ← downstream of org.apache.camel:camel-undertow
   - `camel-rest-postman` ← downstream of org.apache.camel:camel-vertx-http
   - `camel-slack` ← downstream of org.apache.camel:camel-undertow
   - `camel-soap` ← downstream of org.apache.camel:camel-cxf-soap
   - `camel-spring-ai-chat` ← downstream of org.apache.camel:camel-telemetry
   - `camel-telemetry` ← downstream of org.apache.camel:camel-undertow
   - `camel-telemetry-dev` ← downstream of org.apache.camel:camel-undertow
   - `camel-undertow` ← components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowConsumer.java, components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowHelper.java, components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowStringBodyCharsetTest.java
   - `camel-undertow-spring-security` ← downstream of org.apache.camel:camel-undertow
   - `camel-vertx-http` ← downstream of org.apache.camel:camel-undertow
   - `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-catalog
   - `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   - `camel-zookeeper` ← downstream of org.apache.camel:camel-undertow
   
   </details>
   
   <details><summary>Modules with tests skipped (26)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog`
   - `camel-catalog-console`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-endpointdsl`
   - `camel-endpointdsl-support`
   - `camel-itest`
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `camel-report-maven-plugin`
   - `camel-route-parser`
   - `camel-yaml-dsl`
   - `camel-yaml-dsl-deserializers`
   - `camel-yaml-dsl-maven-plugin`
   - `coverage`
   - `dummy-component`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   <details><summary>Build reactor — dependencies compiled but only changed modules were tested (2 modules, 46.7s total)</summary>
   
   **Total reactor time:** 46.7s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: Undertow | 33.3s | SUCCESS |
   | Camel :: Docs | 13.4s | SUCCESS |
   
   **Top 20 slowest modules:**
   - `Camel :: Undertow` (33.3s)
   - `Camel :: Docs` (13.4s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/37182528595)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org