google / uribeacon

The Web Uri Open Beacon for the Internet of Things
Apache License 2.0
409 stars 108 forks source link

HTTP URL encoding specification improvement #243

Open dennisg opened 9 years ago

dennisg commented 9 years ago

In the UriBeacon HTTP URL encoding chapter (specification/AdvertisingMode.md) it is described how the bytes listed in the table are expanded to their respective expansion texts. It is however not described how a given URL should be shortened. For example:

http://u1hr8.infoub.org/t23

can be shortened to: <0x02> u1hr8 <0x0B> ub <0x01> t23.

The current implementation actually does this, but the spec could easily be read to just shorten the domain extension, like so:

<0x02> u1hr8.infoub <0x01> t23 which would be wasteful in the sense that it uses 4 more bytes than the first version. It might be better to describe the shortening process in more detail to make sure other implementations follow the reference implementation. Thanks !
schilit commented 9 years ago

Thanks for noticing. You are right that the codes can be recognized anywhere in the string. Do you want to provide a fix?

dennisg commented 9 years ago

does this small addition make any sense ? comments/ improvements are welcome.

schilit commented 9 years ago

I think this makes sense to add to the specification something like "Any strings within the URL, not just the suffix, will be substituted."

On Tue, Jul 7, 2015 at 2:37 AM, Dennis Geurts notifications@github.com wrote:

does this small addition make any sense ? comments/ improvements are welcome.

— Reply to this email directly or view it on GitHub https://github.com/google/uribeacon/issues/243#issuecomment-119137714.