-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request.scheme is not set properly or at all #38
Comments
My understanding is that we are talking about an incoming CoAP request, right? |
Yes, you are right. Currently it is not possible to know if a request is coming from a In Class if (raw.getCorrelationContext().get(DtlsCorrelationContext.KEY_SESSION_ID) != null) {
request.setScheme(CoAP.COAP_SECURE_URI_SCHEME);
} else {
request.setScheme(CoAP.COAP_URI_SCHEME);
}
request.setSource(raw.getAddress());
request.setSourcePort(raw.getPort());
request.setSenderIdentity(raw.getSenderIdentity()); |
I guess additionally, |
I had exactly the same idea :-)
This way we do not expose too much of the underlying mechanism around Would you like to create a PR? :-) |
I like the fix. Another comment: Do not rely too much on the RD implementation. It was a contribution that has never been fully overhauled, and hence is of lower code quality... (yet I did some improvements a while ago). This means, whenever you find something strange in the RD code, do not hesitate to ask about it! ;) |
Fixed and submitted as Pull Request #42 |
I will take a look (and merge) tomorrow. |
Set scheme variable of Request object when it is created in the CoapEndpoint.InboxImpl. This helps applications to inspect the scheme just as source address, port or principle. New method RawData.isSecure() inspects the CorrelationContext to determine if it is from a secure context. Bug: #38 Signed-off-by: Vinod Mukkamala <vmukkamala@hotmail.com> Also-by: Kai Hudalla <kai.hudalla@bosch-si.com>
Hi @calif-devel, I guess you can now close this issue ... thanks again for contributing :-) |
Thank you @sophokles73 and @mkovatsc for resolving this. |
Set scheme variable of Request object when it is created in the CoapEndpoint.InboxImpl. This helps applications to inspect the scheme just as source address, port or principle. New method RawData.isSecure() inspects the CorrelationContext to determine if it is from a secure context. Bug: eclipse-californium#38 Signed-off-by: Vinod Mukkamala <vmukkamala@hotmail.com> Also-by: Kai Hudalla <kai.hudalla@bosch-si.com>
I'm working on a HTTP-CoAP ProxyServer based on Californium and I'm using cf-rd from californium.tools project. My intention is to support both
coap
andcoaps
endpoints on the proxy server and with help of cf-rd tools, the CoAP peers canPOST /rd
using either coap or coaps.However I noticed that although my CoAP device registered using
coaps
, the logs showedOn further investigation, in
RDNodeResource
class, whenLinkFormat.CONTEXT
is either missing or empty, the code assumes the scheme to becoap
. I can't setLinkFormat.CONTEXT
inURIQuery
when positng on resource/rd
, because of NAT. Based on RFC, ifLinkFormat.CONTEXT
is not set, then source address and port should be used.RDNodeResource
class uses Request object to correctly set the source address and port, but not the scheme.So I decided to change the logic in class
RDNodeResource
to rely onRequest.getScheme()
method to create appropriateLinkFormat.CONTEXT
. But this change produced the following in logsIs
Request.scheme
ever set? Which component is responsible of setting this variable to right value? Is there a better way to setting theLinkFormat.CONTEXT
inRDNodeResource
other than usingRequest
object?The text was updated successfully, but these errors were encountered: