CouchDB and malformed URLs

CouchDB chokes on malformed URLs. This request works in Firefox but not curl or when called from a PHP script. The problem is that the space after the comma in the endkey is not properly encoded. The solution is to remove the space.

localhost:5984/db/_design/forum/_view/postsbak?startkey=["forum/test_page_1"]&endkey=["forum/test_page_1", {}]

Luckily the CouchDB team know about this (Doesn’t gracefully handle malformed URLs) and hopefully will be fixing it soon.

No Responses

  1. Malformed is a funny word. You’ll probably want to try something like:

    curl -v ‘http://localhost:5984/db/_design/forum/_view/postsbak?startkey=["forum/test_page_1"]&endkey=["forum/test_page_1", {}]‘

    Remember that your shell loves to play with special characters too.

    I sure don’t remember seeing that ticket get filed, but the description sure does make me think shell escaping because the space isn’t. If you can verify, make sure and comment on it.

  2. Definitely just noticed that the original bug was singled quoted as it should be. My eyes saw double quotes so I discarded it. Most intriguing…

Leave a Reply

Name (required)


Email address (required)


Website