[
https://issues.apache.org/jira/browse/CAMEL-27236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18149955#comment-18149955
]
Claus Ibsen commented on CAMEL-27236:
-------------------------------------
Another way to hit this, not only form fields: a *query parameter* whose name
is not a valid header name gives the same 500. Found by the camel-kamelets
session on a 4.24.0-SNAPSHOT build of 2026-11-23:
{noformat}
- route:
from:
uri: "platform-http:/echo"
steps:
- setBody:
constant: "ok"
{noformat}
{noformat}
curl 'localhost:8080/echo?my%20key=1' -> 500 (plain GET)
curl -X POST localhost:8080/echo -d 'my key=1' -> 500
curl -X POST localhost:8080/echo -d 'How long do I have?' -> 500
curl -X POST localhost:8080/echo -d 'q=How long do I have?' -> 200
{noformat}
The query parameters become headers in
{{VertxPlatformHttpSupport.applyHeaderFilterStrategy}} ({{ctx.queryParams()}}),
the form fields in {{VertxPlatformHttpConsumer.populateMultiFormData}}, and
both are copied to the response in
{{VertxPlatformHttpSupport.copyMessageHeadersToResponse}}. Checking the name
there fixes both cases.
The fix for the other HTTP components in CAMEL-27235
(https://github.com/apache/camel/pull/30509, merged 2026-11-20) added
{{org.apache.camel.http.base.HttpHelper.isValidHeaderName}} (RFC 9110 tchar).
camel-platform-http-vertx already depends on camel-http-base, so it can be
reused in {{copyMessageHeadersToResponse}}: skip such a header, with a DEBUG
log.
[~tmielke] are you aiming for 4.24.0 with this one? The release is planned for
this Friday. The camel-kamelets RAG how-to (apache/camel-kamelets#3385) hits it
with a plain {{curl -d "question"}}.
_Claude Code on behalf of davsclaus_
> camel-platform-http-vertx - a form field whose name is not a valid header
> name fails the response with 500, after the route has run
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27236
> URL: https://issues.apache.org/jira/browse/CAMEL-27236
> Project: Camel
> Issue Type: Bug
> Components: camel-platform-http-vertx
> Affects Versions: 4.23.0
> Reporter: Federico Mariani
> Assignee: Torsten Mielke
> Priority: Minor
>
> platform-http on the Vert.x engine (Camel Main and Camel Quarkus) maps the
> fields of an {{application/x-www-form-urlencoded}} request to message headers
> ({{VertxPlatformHttpConsumer.populateMultiFormData}}), and also to a Map body
> ({{populateBodyWithForm=true}} by default). When the response is written,
> {{VertxPlatformHttpSupport}} copies the message headers to the HTTP response
> headers, and the form fields are among them. When a field name is not a valid
> HTTP header name (a space, a comma, a colon...), Vert.x refuses it and the
> client gets a 500, after the route has run.
> The common way to hit it is {{curl -d "some text"}}, which sends the text as
> {{application/x-www-form-urlencoded}}: the text becomes one field name with
> an empty value.
> h3. Reproducer
> {noformat}
> - route:
> id: echo
> from:
> uri: platform-http
> parameters:
> path: /echo
> steps:
> - setBody:
> expression:
> simple:
> expression: "type=${body?.getClass().getName()} body=${body}"
> {noformat}
> {noformat}
> camel run form.camel.yaml
> curl -i -X POST http://localhost:8080/echo -d "Hi, I'm [email protected]. My
> order is late, can you refund it?"
> HTTP/1.1 500 Internal Server Error
> {noformat}
> {noformat}
> WARN VertxPlatformHttpConsumer : Failed handling platform-http endpoint
> /echo. Caused by: [java.lang.IllegalArgumentException - a header name cannot
> contain some prohibited characters, such as : Hi, I'm [email protected]. My
> order is late, can you refund it?]
> {noformat}
> With {{-H 'Content-Type: text/plain'}} the same request returns 200.
> Reproduced with Camel 4.23.0 on Camel Main ({{camel run}}) and on a Camel
> Quarkus export (the Quarkus error page reports the same exception). The code
> is the same on main.
> The route has already done its work when the response fails, for example a
> route that calls a refund service, while the client sees an error and may
> send the request again.
> h3. Possible fix
> When writing the response, skip a header whose name is not a valid HTTP token
> (RFC 9110), with a debug log, instead of failing the whole response.
> Spring Boot fails earlier on the same request, while parsing the form:
> CAMEL-27235.
> _Claude Code on behalf of Croway_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)