Description
When implementing a REST to SOAP bridge on Camel Quarkus, it turns out that Vert.x (the HTTP server of Quarkus) does not accept the :status header propagated from CXF message:
10:27:39,596 INFO [app] 10:27:38,426 HTTP Request to /jaxrs/request failed, error id: 9ce52cd2-3b97-4bbb-9971-1cbbfa20844b-1: java.lang.IllegalArgumentException: a header name cannot contain some prohibited characters, such as : :status 10:27:39,596 INFO [app] at io.vertx.core.http.impl.HttpUtils.validateHeaderName0(HttpUtils.java:913) 10:27:39,596 INFO [app] at io.vertx.core.http.impl.HttpUtils.validateHeaderName(HttpUtils.java:885) 10:27:39,597 INFO [app] at io.vertx.core.http.impl.HttpUtils.validateHeader(HttpUtils.java:772) 10:27:39,597 INFO [app] at io.vertx.core.http.impl.headers.HeadersMultiMap.add0(HeadersMultiMap.java:616) 10:27:39,597 INFO [app] at io.vertx.core.http.impl.headers.HeadersMultiMap.set0(HeadersMultiMap.java:633) 10:27:39,597 INFO [app] at io.vertx.core.http.impl.headers.HeadersMultiMap.set(HeadersMultiMap.java:184) 10:27:39,597 INFO [app] at io.vertx.core.http.impl.headers.HeadersMultiMap.set(HeadersMultiMap.java:189) 10:27:39,597 INFO [app] at io.vertx.core.http.impl.Http1xServerResponse.putHeader(Http1xServerResponse.java:193) 10:27:39,597 INFO [app] at io.vertx.core.http.impl.Http1xServerResponse.putHeader(Http1xServerResponse.java:67) 10:27:39,598 INFO [app] at org.apache.camel.component.platform.http.vertx.VertxPlatformHttpSupport.toHttpResponse(VertxPlatformHttpSupport.java:89)
This happens with HttpClientHTTPConduit using HTTP/2 capable java.net.http.HttpClient as the underlying HTTP client. That's the default in CXF 4.x. Another condition is that the service must also run on a HTTP/2 enabled HTTP server. Jetty 11 used in Camel tests does not seem to have HTTP/2 enabled.
:status is a standard pseudo-header of HTTP/2 and HTTP/3 specified by
RFC-7540.
If CXF is configured to use the older URLConnectionHTTPConduitFactory using the HTTP/1.1 only java.net.HttpURLConnection then the issue does not occur. Note that URLConnectionHTTPConduitFactory is set by default by Quarkus CXF 2.3.1 and 2.2.3 because of https://github.com/quarkiverse/quarkus-cxf/issues/992 (thus overriding the CXF 4.x default). It was also the default in CXF 3.x used by Camel 3.x.
I think the solution should be to filter out all HTTP pseudo-headers when propagating the headers from the CXF message to the Camel message. The reason is, that the info present in pseudo-headers is also available through programmatic API and for HTTP status, it is indeed there as CamelHttpResponseCode header. Any comments about that?
Attachments
Issue Links
- links to