[ 
https://issues.apache.org/jira/browse/CAMEL-27236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Torsten Mielke reassigned CAMEL-27236:
--------------------------------------

    Assignee: Torsten Mielke

> 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)

Reply via email to