Andrea Cosentino created CAMEL-26065:
----------------------------------------

             Summary: camel-netty-http - key multiplex channel handlers by 
listener address
                 Key: CAMEL-26065
                 URL: https://issues.apache.org/jira/browse/CAMEL-26065
             Project: Camel
          Issue Type: Bug
          Components: camel-netty-http
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.24.0, 4.22.3, 4.18.6


h3. Current behaviour

{{NettyHttpComponent}} maintains server listening sockets 
({{HttpServerBootstrapFactory}}) per host and port address, but keeps consumer 
multiplex channel handlers ({{HttpServerConsumerChannelFactory}}) in a map 
keyed solely by integer {{port}}.

When multiple {{netty-http}} consumers share a port on different host addresses:
* {{HttpServerInitializerFactory}} and {{HttpServerBootstrapFactory}} install 
the per-port multiplex channel handler into each server pipeline.
* Inbound requests on any listening socket on that port are matched by 
{{HttpServerMultiplexChannelHandler}} against all consumers registered on that 
port across all host addresses.

h3. Expected behaviour

{{NettyHttpComponent}} keys multiplex channel handlers by the listener's 
address (host:port), ensuring that each listening socket dispatches requests 
only to consumers bound to its own address.

h3. Change

* {{NettyHttpComponent}}: Key {{multiplexChannelHandlers}} by listener address 
string (host:port). Add {{getMultiplexChannelHandler(String address)}} and 
retain {{getMultiplexChannelHandler(int port)}} as deprecated for backwards 
compatibility.
* {{HttpServerInitializerFactory}}: Retrieve the multiplex channel handler 
using {{consumer.getConfiguration().getAddress()}} instead of port alone.
* {{HttpServerBootstrapFactory}}: Initialize using the address-based multiplex 
channel handler.

h3. Tests

* {{NettyHttpDifferentHostSamePortTest}}: Verify that consumers configured on 
the same port across different host addresses only receive requests directed to 
their respective listening sockets, returning 404 for paths registered only on 
another host address.



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

Reply via email to