Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-3373

POST to _changes times out if a POST body is present and the "filter" query parameter is set to something other than _doc_ids

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • HTTP Interface
    • None

    Description

      CouchDB version – 2.0.0
      Platform – Mac
      Client – CURL

      This appears to be the same issue that was reported in COUCHDB-3131

      In CouchDB 2.0.0, if I do a POST to _changes, and I have the filter query parameter set to point to my design document, and I also have a superfluous JSON message body in the POST request, the request times out. If, however, there is no JSON body in the POST request, I get the expected behavior (correct filtered _changes response). I would expect the superfluous JSON body to be ignored if present, and for both to work the same (see examples below).

      Unfiltered POSTs to _changes (no "filter" query param) work with or without a POST request body. POSTs to _changes with the query parameter set to "filter=_doc_ids", but with an unexpected JSON body, return a reasonable error –

      {"error":"bad_request","reason":"`doc_ids` filter parameter is not a list of doc ids."}

      As an aside – in CouchDB 1.6, filtered POSTs to _changes work with or without a superfluous message body in the POST request (the request body is ignored).

      It would be nice if CouchDB 2.0 behaved like 1.6, where the superfluous request body is simply ignored since it's not relevant to the request (i.e., the "filter" parameter is set, but not set to "_doc_ids").

      Examples (I would expect these to behave identically):
      =========================================
      Superfluous Request Body:

      > curl -v -X POST -H 'Content-Type: application/json' 'http://localhost:5984/couchbase-test-notes/_changes?feed=normal&style=all_docs&filter=filterFuncs/ownerFilter&owner=Gunderson' -d '{}'
      ...
      < HTTP/1.1 500 Internal Server Error
      < Cache-Control: must-revalidate
      < Connection: close
      < Content-Length: 37
      < Content-Type: application/json
      < Date: Wed, 12 Apr 2017 19:35:09 GMT
      < Server: CouchDB/2.0.0 (Erlang OTP/19)
      < X-Couch-Request-ID: 5a58b4cfba
      < X-CouchDB-Body-Time: 0
      < 
      {"error":"error","reason":"timeout"}
      

      No Request Body:

      > curl -X POST -H 'Content-Type: application/json' 'http://localhost:5984/couchbase-test-notes/_changes?feed=normal&style=all_docs&filter=filterFuncs/ownerFilter&owner=Gunderson'
      {"results":[
      {"seq":"7-g1AAAAB5eJzLYWBgYMpgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUklMiTV____PyuRAY-iPBYgydAApP6D1GYwJ7LnAgXYk1LMUg2S0rDpywIA-MYnAQ","id":"Gunderson-ThrowAway-faafcfac-4942-4c72-a6c3-27a0c3f68183","changes":[{"rev":"3-bf8d32e5dbc3417d737e6d1146da1879"}],"deleted":true},
      .
      .
      .
      ],
      "last_seq":"81-g1AAAACbeJzLYWBgYMpgTmEQTM4vTc5ISXLIyU9OzMnILy7JAUklMiTV____PyuDOVEmFyjAnmiZlmqalIZNAx5j8liAJEMDkPoPNc0UbFpSilmqAXbTsgC8KjHi","pending":0}
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            philmay Phil May
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: