Claus Ibsen created CAMEL-28017:
-----------------------------------

             Summary: camel-netty-http - consumer sets CamelHttpScheme and 
CamelHttpHost to null and CamelHttpPort to 80/443
                 Key: CAMEL-28017
                 URL: https://issues.apache.org/jira/browse/CAMEL-28017
             Project: Camel
          Issue Type: Bug
          Components: camel-netty-http
            Reporter: Claus Ibsen
             Fix For: 4.25.0


DefaultNettyHttpBinding.populateCamelHeaders builds the URI from request.uri():

{code:java}
URI uri = new URI(request.uri());
...
headers.put(Exchange.HTTP_SCHEME, uri.getScheme());
headers.put(Exchange.HTTP_HOST, uri.getHost());
final int port = uri.getPort();
headers.put(Exchange.HTTP_PORT, port > 0 ? port : configuration.isSsl() || 
"https".equals(uri.getScheme()) ? 443 : 80);
{code}

A request line normally holds only the path and query (/foo?x=1), so 
CamelHttpScheme and CamelHttpHost are null, and CamelHttpPort is 80 or 443 
instead of the port the consumer listens on (for example 8080).

Fix: when the request URI has no scheme or host, use http/https from 
configuration.isSsl(), the host of the Host header or of the configuration, and 
the port of the configuration; add a test with a consumer on a non-default port.

Found while declaring the message headers of the components (CAMEL-27980).

----
_Filed by Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to