You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Phil May (JIRA)" <ji...@apache.org> on 2017/04/14 19:25:41 UTC

[jira] [Commented] (COUCHDB-3131) Valid JSON rejected in _changed query with filter

    [ https://issues.apache.org/jira/browse/COUCHDB-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15969430#comment-15969430 ] 

Phil May commented on COUCHDB-3131:
-----------------------------------

Samuel, are you still experiencing this issue? I have the same issue with CouchDB/2.0.0 (Erlang OTP/19) for the Mac:

* If a body is present in the POST to _changes, the server times out (after about 30 sec), returning 500 (did you try waiting to see if yours timed out?).
* If no body is present in the POST, it works as expected.
* In CouchDB 1.6, both of the above cases work (the body is just ignored if the "filter" query param is not set to _doc_ids). Since it appears that the body is only interesting if fliter=_doc_ids, it would be nice if was just ignored in all other cases.

This is an issue for us, because we are using Couchbase Lite for our client data store, and they use POST in their replicator rather than the GET for _changes, and they include a body (I'm going to see if I can get them to change back to GET  ;) ).

If you have additional info, we'd appreciate it. Thanks!

> Valid JSON rejected in _changed query with filter
> -------------------------------------------------
>
>                 Key: COUCHDB-3131
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-3131
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 2.0.0
>            Reporter: Samuel Tardieu
>
> While testing 2.0.0-RC4, I noticed some oddities when giving a valid JSON payload to a POST _changes request involving a filter: only one document seem to go through the filter (and may or may not match) then nothing more is sent.
> In short, everything works if you send a request with "Content-Type: application/json", "Content-Length: 0", and an empty payload. However, this is not valid JSON, as explained in issue COUCH-2583 for another command.
> As an example, I have a "test" database with a "d/f" filter which contains a function testing that doc.name is equal to "foo".
> Here is a query with an invalid JSON payload:
> {noformat}
> %  curl -H "Content-Type: application/json" --data "" -v "http://localhost:5984/test/_changes?filter=d/f&feed=continuous&heartbeat=30000"
>                                         
> *   Trying ::1...
> * Connected to localhost (::1) port 5984 (#0)
> > POST /test/_changes?filter=d/f&feed=continuous&heartbeat=30000 HTTP/1.1
> > Host: localhost:5984
> > User-Agent: curl/7.50.1
> > Accept: */*
> > Content-Type: application/json
> > Content-Length: 0
> > 
> < HTTP/1.1 200 OK
> < Cache-Control: must-revalidate
> < Content-Type: application/json
> < Date: Tue, 06 Sep 2016 12:16:32 GMT
> < Server: CouchDB/1df597f (Erlang OTP/17)
> < Transfer-Encoding: chunked
> < X-Couch-Request-ID: 422e7cd090
> < X-CouchDB-Body-Time: 0
> < 
> {"seq":"2-g1AAAAFReJzLYWBg4MhgTmHgzcvPy09JdcjLz8gvLskBCjMlMiTJ____PyuRAYeCJAUgmWSPX40DSE08SE0GcyJTLpDHbpSamGpsaIyuHpcJCSAT6vHakscCJBkagBRQ2XxC6hZA1O0npO4ARN19QuoeQNSB3JcFALv_a5o","id":"t1","changes":[{"rev":"2-0d4850a48036a083e9f18f94f6cb9abe"}]}
> {"seq":"4-g1AAAAGneJzLYWBg4MhgTmHgzcvPy09JdcjLz8gvLskBCjMlMiTJ____PyuDOZExFyjAnmKZlmhibIauGIf2JAUgmWQPNYEBbIJ5okGimbFhCgNnaV5KalpmXmoKLt0OIN3xUN1MYN1GqYmpxobGxNqfADKhHmRCIgMONXksQJKhAUgBlc0npG4BRN1-RIgkJqaYWSSnEukiiCkHIKbcJ2TbA4g6kOuzAM6WhBY","id":"t3","changes":[{"rev":"1-bc98e8ae0f9c89fbc8c237dfc9bfe478"}]}
> {"seq":"11-g1AAAAIbeJyV0UsOgjAQBuAKGnXhGfQIhZq2rOQmOqVtkGC7UNd6E72J3kRvguWRQExIYDOTTPp_k3RyhNAi9SVaGWusVLGxqT1fcjf2AIl1URRZ6sPk5AZzGWnYEvr_uCcuNq6KXSOgSmCAgZJAouXVSKWPRsm-dFym903aq9KhAkUCMnT_oRRujTCrBK1JBFgPFMzUVXR3zSGP9h8wJzTkbJTyrJVXqwBIyhM1SnnXyqdVSCICqvgo5VsrnbtgHLCEie5dsh9GyaSG","id":"9a1c0e93e4aa88c45c3e38031d5cc7f3","changes":[{"rev":"1-bc98e8ae0f9c89fbc8c237dfc9bfe478"}]}
> {"seq":"12-g1AAAAIbeJyV0UsOgjAQBuAKGnXhGfQIhZq2rOQmOqVtkGC7UNd6E72J3kRvguWRQExIYDNNJvN_TWZyhNAi9SVaGWusVLGxqT1fctf2AIl1URRZ6sPk5BpzGWnYEvo_3BMXG1fFrhFQJTDAQEkg0fJqpNJHo2RfOi7T-ybtVelQgSIBGfr_oRRujTCrBK1JBFgPFMzUVXR3j0Me7R4wJzTkbJTyrJVXqwBIyhM1SnnXyqfdCUlEQBUfpXxrpXMXjAOWMNG9S_YDRymkhw","id":"9a1c0e93e4aa88c45c3e38031d5e6c11","changes":[{"rev":"1-bc98e8ae0f9c89fbc8c237dfc9bfe478"}]}
> {"seq":"13-g1AAAAIbeJyV0UsOgjAQBuAKGnXhGfQILTWlrOQmOqVtkGC7UNd6E72J3kRvguWRQExIYDOTTPp_k3RyhNAi9SVaGWusVLGxqT1fcjf2AIl1URRZ6sPk5AZzGWnYUvb_uCcuNq6KXSOgSggBA6NEouXVSKWPRsm-dFym903aq9KBAkUJHbr_UAq3RphVgtY0AqwHCmbqKrq75pBH-w-YUxbwcJTyrJVXqwBIxhM1SnnXyqdU_EqhiSBM8VHKt1Y6d8GYhEkounfJfkeJpIg","id":"t2","changes":[{"rev":"1-bc98e8ae0f9c89fbc8c237dfc9bfe478"}]}
> {noformat}
> (everything has been returned, it works, but I had to send an invalid empty payload which is not valid JSON)
> However, if I try to send "{}" which is a valid JSON payload:
> {noformat}
>  % curl -H "Content-Type: application/json" --data "{}" -v "http://localhost:5984/test/_changes?filter=d/f&feed=continuous&heartbeat=30000"
>             
> *   Trying ::1...
> * Connected to localhost (::1) port 5984 (#0)
> > POST /test/_changes?filter=d/f&feed=continuous&heartbeat=30000 HTTP/1.1
> > Host: localhost:5984
> > User-Agent: curl/7.50.1
> > Accept: */*
> > Content-Type: application/json
> > Content-Length: 2
> > 
> * upload completely sent off: 2 out of 2 bytes
> {noformat}
> Nothing at all is sent back.
> This is a regression as this request works against CouchDB 1.x.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)