Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-35455

If binding has trailing slash and request path has leading slash, resulting URL has //

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 6.5.0
    • None
    • eventing
    • None
    • Untriaged
    • Unknown

    Description

      Set the URL binding to:
      foo = http://www.google.com/

      Set the Curl request to:
      req =

      { path: '/hello' }

      Now the path accessed is http://www.google.com//hello – this is often disallowed and is unlikely to be what the user intended. (If the user really intended this, they can put // on the binding or on path).

      While it may seem to be a user's error, this is too common and too easy to happen. But trailing and leading '/' has a meaning, so we simply can't strip it from binding or path either.

      So, when concatenating binding URL and request path:

      1. If binding ends with / and path starts with /, keep only one in the resulting URI
      2. If binding doesn't end with a / and path doesn't start with /, introduce one into URI
      3. If URI or path explicitly has a // – do not mess with it.

      This will give the behavior of "least surprise" to the user.

      Attachments

        Activity

          People

            suraj.naik Suraj Naik (Inactive)
            siri Sriram Melkote (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty