Claus Ibsen created CAMEL-27818:
-----------------------------------

             Summary: camel-coap: endpoint options are sent as Uri-Query and 
turn a POST into a GET, clientAuthentication=WANTED fails to start
                 Key: CAMEL-27818
                 URL: https://issues.apache.org/jira/browse/CAMEL-27818
             Project: Camel
          Issue Type: Bug
          Components: camel-coap
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-coap for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31140).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. Endpoint options are sent to the server, and turn a POST into a GET
The CoAPEndpoint keeps the full endpoint URI, and CoAPProducer and CoAPObserver 
send every Camel option as a Uri-Query. As CoAPHelper.getDefaultMethod sees the 
"?", any option also turns a POST into a GET and drops the body: 
to("coap://localhost:p/q?lazyStartProducer=true") with a body sends a GET with 
lazyStartProducer=true and no body.
Proposed change: build the request URI without the query of the Camel options.

h4. 2. clientAuthentication=WANTED fails to start the server
{{CoAPEndpoint.isClientAuthenticationWanted}} calls 
{{ClientAuthentication.valueOf("WANTED")}} (IllegalArgumentException), and 
isClientAuthenticationRequired / isClientAuthenticationWanted call 
{{CertificateAuthenticationMode.valueOf}} with the ServerParameters values WANT 
/ REQUIRE, which also throws. Only NONE works; the server client-auth test in 
CoAPComponentTLSTestBase is commented out.
Proposed change: map NONE->NONE, WANT->WANTED, REQUIRE->NEEDED.

h4. 3. A consumer without a port binds 5684 for every scheme
{{CoAPComponent.getServer}} binds the coaps port 5684 also for coap and 
coap+tcp, while producers use the Californium defaults (5683), so 
from("coap:localhost/x") and to("coap:localhost/x") do not meet.
Proposed change: use the default port of the scheme.

h4. 4. configurationFile is never closed and replaces the JVM-wide configuration
{{CoAPComponent.loadConfiguration}} leaks the InputStream for each server and 
client, and replaces Californium's "standard" Configuration for the JVM.
Proposed change: close the stream and use a Configuration per component.

h4. 5. coaps+tcp consumer without sslContextParameters fails with 
NullPointerException
doEnableTLSTCP fails with a NullPointerException instead of a clear message.
Proposed change: validate the configuration.


_Claude Code on behalf of davsclaus_



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

Reply via email to