-
Notifications
You must be signed in to change notification settings - Fork 368
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
Issues with parsing CoRE Link Format #2274
Comments
To be frank, I'm no expert for RFC 6690. |
@boaks Not entirely sure what you mean by use-case, but we are using parts of californium in an Android app and in a Resource Directory backend. And we have IoT devices that send data in the formats outlined above (when querying "/.well-known/core") which caused problems when we tried using the |
"Resource Directory" is the kind of answer I was looking for.
OK. If you're interested to get answers for your points and interpretations from the IETF core-group, We can alternatively convert your solution into a PR and see, if someone has issues with it. (I'm personally on the way to ramp down my engagement to a hobby/free time level. Therefore the handling of the clarification on my side will take some time.) |
On my side, I never used Californium classes to parse Link Format. In Leshan we try to implement a CoRE Link Parser, all classes are in leshan-lwm2m-core@org/eclipse/leshan/core/link/
|
I have encountered some issues with the
LinkFormat.parse()
method when parsing certain payloads. I realize the current implementation is very simple. And maybe the following points are not even considered bugs, in which case feel free to close this issue. I'm also hoping that I have not completely misunderstood the main RFC 6690, or any of the linked ones 😅.The current parser seems to have the following problems:
1. Incorrect handling of certain characters in Attribute Values
Parsing stops when encountering certain characters that are valid in
relation-types
. Specifically, it fails when handling characters such as dots (.), hyphens (-), and colons (:).Expected output:
Actual output:
It appears that the issue is caused by the regex pattern used for
WORD
.However, I'm not sure if simply extending this regex to include those characters will fix it. It might even make it worse :)
2. Incorrect handling of quoted strings for non-
relation-type
attributesThe current parser splits all quoted strings into separate values when encountering spaces, regardless of the attribute type. If I understood correctly, only specific attributes (such as
rel
,rev
,rt
, andif
) should have their quoted strings split into space-separated values. All other attributes should treat quoted strings as single entities, even if they contain spaces.Expected output:
Actual output:
3. (Maybe issue) Handling of attributes without values (e.g., observability flags)
I decided to represent them as the empty list, instead of the list containing the empty string as californium treats them, since an attribute like
a=""
seemed distinct than justa
I'm sure there are other issues with the parser (for example I didn't see any handling of
ext-value
) as the whole specification is (imo) a giant mess of interlinking RFCs. These are just the ones that I came across.My own solution
I don't know if this is of value to anyone else, but this is the code that I'm currently using to using to get around these issues. It's nowhere near "RFC-compliant" and also not very efficient with the String allocations.
Core Links parser in Kotlin
The text was updated successfully, but these errors were encountered: