Claus Ibsen created CAMEL-26485:
-----------------------------------

             Summary: camel-netty-http - endpoint options such as cookieHandler 
and httpMethodRestrict are sent to the server as query parameters
                 Key: CAMEL-26485
                 URL: https://issues.apache.org/jira/browse/CAMEL-26485
             Project: Camel
          Issue Type: Bug
          Components: camel-netty-http
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 4.24.0


The netty-http producer sends some of its endpoint options to the HTTP server 
as query parameters. With

{code}
netty-http:http://localhost:8080/foo?bar=1&cookieHandler=#myCookieHandler&httpMethodRestrict=GET
{code}

the server receives the query 
{{bar=1&cookieHandler=#myCookieHandler&httpMethodRestrict=GET}}, while only 
{{bar=1}} is meant for the server. The component documentation (_Query 
parameters vs. endpoint options_) says that endpoint options are resolved and 
removed from the target URL.

*Cause*

{{NettyHttpComponent.createEndpoint}} builds the HTTP address with 
{{URISupport.createRemainingURI(u, parameters)}} after {{parseConfiguration}} 
has bound the {{NettyHttpConfiguration}} options, but before 
{{setProperties(answer, parameters)}} binds the options of the endpoint itself. 
Those options stay in the address, and {{NettyHttpHelper.createURL}} sends 
them. Seen at runtime: {{cookieHandler}}, {{exchangePattern}} and 
{{httpMethodRestrict}}; from reading the code also {{exceptionHandler}}, 
{{oauthProfile}} and {{traceEnabled}}. camel-http builds its HTTP address after 
the endpoint options are bound ({{HttpEndpoint.setHttpUri}}).

*Proposed change*

Build the HTTP address from the parameters that are left after 
{{setProperties(answer, parameters)}}, and add a test that checks the query the 
server receives ({{CamelHttpQuery}}).

The endpoint URI itself must keep these options: Rest DSL consumers for 
different verbs on the same path differ only in {{httpMethodRestrict}}, and 
they must stay distinct endpoints. So this change goes together with, or after, 
the change that keeps the HTTP address separate from the endpoint URI.

_Filed by Claude Code on behalf of davsclaus_



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

Reply via email to