Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-905

libcouchbase interpretation of reserved uri characters when querying a view

    XMLWordPrintable

Details

    • 1

    Description

      Hi,

      When querying a view with libcouchbase and supplying a real number key, for instance 1.23e+04, which is a valid JSON number, the key, as I understand, ends up in a uri, and as it should, the reserved character '+' is replaced by a space, leading to an issue with the real number syntax (1.23e 04 is not a valid JSON number). The query fails and reports a syntax error. So, as RFC 3986 requires it (https://en.wikipedia.org/wiki/Percent-encoding), the '+' sign needs to be percent-encoded, and replaced by %2B. After that, everything works fine.

      However, if the key is a JSON array, say [1, 2], it does not seem to be the case. '[', ',' and ']' are all uri reserved characters, like '+', and should be encoded (respectively into %5B, %2C, %5D). But when this is done, there is an error ("Unknown Error") reported by the library. It's only when the three characters are unencoded that everything works.

      Is there some documentation explaining the rules to follow, and what libcouchbase does? It does not seem to be intuitive. For instance, if I search the array key [1.23e+04], should I use [1.23e%2B04], or some other combination?

      As usual, thanks!

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            avsej Sergey Avseyev
            vincent.lextrait Vincent Lextrait
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty