gnodet opened a new pull request, #31251: URL: https://github.com/apache/camel/pull/31251
## Summary Fix `camel-netty-http` consumer setting `CamelHttpScheme` and `CamelHttpHost` to `null` and `CamelHttpPort` to `80`/`443` when the endpoint receives a standard HTTP/1.1 request with a relative-path URI (e.g. `GET /foo?x=1 HTTP/1.1`). ## Root Cause `DefaultNettyHttpBinding.populateCamelHeaders()` constructs a `java.net.URI` from `request.uri()`. When the client sends a relative-path URI (the common case for HTTP/1.1 consumer endpoints), `uri.getScheme()` and `uri.getHost()` return `null`, and `uri.getPort()` returns `-1`. The code already handles this correctly for `HTTP_URL` (lines 162-169), which falls back to `configuration.isSsl()`, `configuration.getHost()`, and `configuration.getPort()`. But the three subsequent headers (`HTTP_SCHEME`, `HTTP_HOST`, `HTTP_PORT`) were written directly from the URI, so they always received `null`/`null`/`80 or 443` for relative-path requests. ## Fix When `uri.getScheme()` or `uri.getHost()` are `null` (relative URI), fall back to the endpoint configuration -- the same values already used to build `HTTP_URL`: - `HTTP_SCHEME` -> `configuration.isSsl() ? "https" : "http"` - `HTTP_HOST` -> `configuration.getHost()` - `HTTP_PORT` -> `configuration.getPort()` (the actual configured port, not a protocol default) ## Tests Added two regression tests to `DefaultNettyHttpBindingCamelHeadersTest`: - `testRelativeUriUsesConfigurationForSchemeHostPort` -- plain HTTP consumer on port 8080 - `testRelativeUriSslUsesConfigurationForSchemeHostPort` -- HTTPS consumer on port 8443 Both are pure unit tests (no network), and both fail on the unfixed code and pass after the fix. Fixes https://issues.apache.org/jira/browse/CAMEL-28017 --- _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_ -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
