On quinta-feira, 28 de julho de 2016 22:32:10 PDT Dave Thaler via iotivity-dev wrote: > On 15 May 2015, Moumita Ray made a change to iotivity that changes the > separator in query filters: > > Changed ampersand '&' to semicolon ';' to concatenate multiple query > string > > This change set is based on OIC core framework standard specification > draft A. Modified '&' to ';' to separate multiple filters in a query > params. Added necessary changes in the parser to validate and parse the > query including core framework, unit tests and sample. > > The actual change supports both, so technically it *added* ';' rather than > changing it per se (OC_QUERY_SEPARATOR is "&;").
That was on my request that it was done as an addition, not a replacement. I felt and the other IoTivity developers concurred that using a separator other than '&' was a bad idea, would lead to confusion, and was inefficient. The CoAP spec specifically specifies that the Uri-Query header field is separated by '&', so using ';' in OCF queries would have required sending the entire query string in one single CoAP header field. Moreover, the reason why OCF decided to use it was based on a faulty assumption that the '&' would be unavailable for use in a query value like "filter" (they forgot to take percent-encoding into account). That said, the change was actually done in the wrong place, which means IoTivity would technically violate the CoAP spec by splitting on ';'. > However, the core framework doc says: > > A query string shall contain a list of <name>=<value> segments (aka > "name-value pair") each separated by a ';' (semicolon). The query string > will be mapped to the appropriate syntax of the protocol used for > messaging. (e.g., CoAP). I thought we had fixed the spec. The last time this came up and we concluded inside OCF that the reasoning was faulty, we agreed to change. I guess no one submitted a CR. (probably my fault) > But that's in the section on "oic;" URIs not coap URIs. The core framework > document says nothing about any changes to segment separators in coap URIs, > it just references RFC 7252 (the coap RFC). [cut] > Thus the state of the OCF spec is that any code using oic: URIs (and there > is no such code...) would use semicolon, but the semicolons would be > changed to ampersands as a result of an oic: URI being "mapped to the > appropriate syntax of the protocol used for messaging", i.e., to a > coap/coaps URI. Yeah, we concluded the same the last time this topic was discussed. I still think that's confusing and would prefer the spec change. > And the state of iotivity is that the server will accept either one because > of an iotivity-specific change to the forked libcoap code. > > Since the change claims to have been done just for spec compliance which it > appears is no longer needed, is there any reason to retain the ';' in the > code? Yes and no. It should be removed from our code because it is incorrect where it is located, as I noted above and you found out. However, by removing it, it's likely some applications will break because they use the ';' delimiter in a coap URI. I guess we'll have to try. -- Thiago Macieira - thiago.macieira (AT) intel.com Software Architect - Intel Open Source Technology Center