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

ensure_full_commit requires empty but typed content or it will unexpectedly drops the connection

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 2.0.0, 1.7.0
    • Component/s: HTTP Interface
    • Labels:
      None

      Description

      When given an non-empty (but valid) JSON content, some methods such as _ensure_full_commit will abruptly drop a persistent connection instead of waiting for a new HTTP request even though no error is signaled in CouchDB logs:

      Request
      POST /testdb1/_ensure_full_commit HTTP/1.1
      Host: localhost:5984
      Accept: application/json
      Content-Type: application/json
      Content-Length: 2
      
      {}
      
      Response
      HTTP/1.1 201 Created
      Server: CouchDB/1.6.1 (Erlang OTP/17)
      Date: Mon, 16 Feb 2015 11:49:11 GMT
      Content-Type: application/json
      Content-Length: 53
      Cache-Control: must-revalidate
      
      {"ok":true,"instance_start_time":"1424085277160411"}
      

      [connection is closed without warning by CouchDB at this point]

      To remedy that, one could try to give an empty content, but some frameworks (such as spray.io) will systematically omit the Content-Type header in this case since it makes little sense to type empty content. However, CouchDB will reject the request even though it does not want any content:

      Request
      POST /testdb1/_ensure_full_commit HTTP/1.1
      Host: localhost:5984
      Accept: application/json
      Content-Length: 0
      
      Response
      HTTP/1.1 415 Unsupported Media Type
      Server: CouchDB/1.6.1 (Erlang OTP/17)
      Date: Mon, 16 Feb 2015 11:55:52 GMT
      Content-Type: application/json
      Content-Length: 78
      Cache-Control: must-revalidate
      
      {"error":"bad_content_type","reason":"Content-Type must be application/json"}
      

      This makes it impossible to use those methods with such frameworks. CouchDB should not drop the connection and ignore the data if Content-Length is not 0, nor require that data be typed with application/json if it is going to ignore it anyway or if it requires it to be empty.

        Activity

        Hide
        kxepal Alexander Shorin added a comment -

        [connection is closed without warning by CouchDB at this point]

        Cannot reproduce, how did you test this?

        but some frameworks (such as spray.io) will systematically omit the Content-Type header in this case since it makes little sense to type empty content

        Here is better fix such frameworks - there is no rule in HTTP RFC for implicitly dropping Content-Type header when payload is not specified. The reason for enforcing Content-Type for empty payload is simple: it ensures that the request was made by a client who speaks with JSON, not by browser or any other arbitrary client by an accident without understanding what it doing.

        Show
        kxepal Alexander Shorin added a comment - [connection is closed without warning by CouchDB at this point] Cannot reproduce, how did you test this? but some frameworks (such as spray.io) will systematically omit the Content-Type header in this case since it makes little sense to type empty content Here is better fix such frameworks - there is no rule in HTTP RFC for implicitly dropping Content-Type header when payload is not specified. The reason for enforcing Content-Type for empty payload is simple: it ensures that the request was made by a client who speaks with JSON, not by browser or any other arbitrary client by an accident without understanding what it doing.
        Hide
        sam@rfc1149.net Samuel Tardieu added a comment - - edited

        Concerning the content-type for the empty content, I understand your point for the general situation, but in the application/json case, the empty string is not a valid JSON representation (while it would be for application/x-www-form-urlencoded since an empty string would represent the empty JSON object). One could object that if a content-type is present, a value of said content should be parsable (even if it is from the empty string, which is not possible in the JSON case).

        I run the following code (which I created to try to test the issue). Note that the local server has an admin:admin administrator set, remove the Authorization line to check on an admin-party server.

        test.py
        #! /usr/bin/python
        #
        
        from socket import *
        
        s = socket(AF_INET, SOCK_STREAM)
        s.connect(('localhost',5984))
        headers = """Host: localhost:5984
        Authorization: Basic YWRtaW46YWRtaW4=
        Accept: application/json"""
        request = """PUT /testdb1 HTTP/1.1
        %(headers)s
        Content-Length: 0
        
        PUT /testdb2 HTTP/1.1
        %(headers)s
        Content-Length: 0
        
        POST /testdb1/_ensure_full_commit HTTP/1.1
        %(headers)s
        Content-Type: application/json
        Content-Length: 2
        
        {}
        
        PUT /testdb3 HTTP/1.1
        %(headers)s
        Content-Length: 0
        
        """ % {"headers": headers}
        s.send(request)
        
        while True:
            p = s.recv(1500)
            if not p:
                break
            print(p)
        

        When run against my 1.6.1 server, I get:

        Output
        HTTP/1.1 412 Precondition Failed
        Server: CouchDB/1.6.1 (Erlang OTP/17)
        Date: Mon, 16 Feb 2015 12:34:27 GMT
        Content-Type: application/json
        Content-Length: 95
        Cache-Control: must-revalidate
        
        {"error":"file_exists","reason":"The database could not be created, the file already exists."}
        
        HTTP/1.1 412 Precondition Failed
        Server: CouchDB/1.6.1 (Erlang OTP/17)
        Date: Mon, 16 Feb 2015 12:34:27 GMT
        Content-Type: application/json
        Content-Length: 95
        Cache-Control: must-revalidate
        
        {"error":"file_exists","reason":"The database could not be created, the file already exists."}
        
        HTTP/1.1 201 Created
        Server: CouchDB/1.6.1 (Erlang OTP/17)
        Date: Mon, 16 Feb 2015 12:34:27 GMT
        Content-Type: application/json
        Content-Length: 53
        Cache-Control: must-revalidate
        
        {"ok":true,"instance_start_time":"1424085277160411"}
        
        

        [and the test program exits because the connection has been closed from the server side]

        Note that the connection is dropped after the result from the _ensure_full_commit method call. If I change the call to use Content-Length: 0 (instead of 2) and remove the empty JSON object, I get:

        Alternative
        HTTP/1.1 412 Precondition Failed
        Server: CouchDB/1.6.1 (Erlang OTP/17)
        Date: Mon, 16 Feb 2015 12:36:36 GMT
        Content-Type: application/json
        Content-Length: 95
        Cache-Control: must-revalidate
        
        {"error":"file_exists","reason":"The database could not be created, the file already exists."}
        
        HTTP/1.1 412 Precondition Failed
        Server: CouchDB/1.6.1 (Erlang OTP/17)
        Date: Mon, 16 Feb 2015 12:36:36 GMT
        Content-Type: application/json
        Content-Length: 95
        Cache-Control: must-revalidate
        
        {"error":"file_exists","reason":"The database could not be created, the file already exists."}
        
        HTTP/1.1 201 Created
        Server: CouchDB/1.6.1 (Erlang OTP/17)
        Date: Mon, 16 Feb 2015 12:36:36 GMT
        Content-Type: application/json
        Content-Length: 53
        Cache-Control: must-revalidate
        
        {"ok":true,"instance_start_time":"1424085277160411"}
        
        HTTP/1.1 412 Precondition Failed
        Server: CouchDB/1.6.1 (Erlang OTP/17)
        Date: Mon, 16 Feb 2015 12:36:36 GMT
        Content-Type: application/json
        Content-Length: 95
        Cache-Control: must-revalidate
        
        {"error":"file_exists","reason":"The database could not be created, the file already exists."}
        
        

        and the program hangs there because the connection is still not dropped (as expected) and is waiting for the next command.

        Show
        sam@rfc1149.net Samuel Tardieu added a comment - - edited Concerning the content-type for the empty content, I understand your point for the general situation, but in the application/json case, the empty string is not a valid JSON representation (while it would be for application/x-www-form-urlencoded since an empty string would represent the empty JSON object). One could object that if a content-type is present, a value of said content should be parsable (even if it is from the empty string, which is not possible in the JSON case). I run the following code (which I created to try to test the issue). Note that the local server has an admin:admin administrator set, remove the Authorization line to check on an admin-party server. test.py #! /usr/bin/python # from socket import * s = socket(AF_INET, SOCK_STREAM) s.connect(('localhost',5984)) headers = """Host: localhost:5984 Authorization: Basic YWRtaW46YWRtaW4= Accept: application/json""" request = """PUT /testdb1 HTTP/1.1 %(headers)s Content-Length: 0 PUT /testdb2 HTTP/1.1 %(headers)s Content-Length: 0 POST /testdb1/_ensure_full_commit HTTP/1.1 %(headers)s Content-Type: application/json Content-Length: 2 {} PUT /testdb3 HTTP/1.1 %(headers)s Content-Length: 0 """ % {" headers": headers} s.send(request) while True: p = s.recv(1500) if not p: break print(p) When run against my 1.6.1 server, I get: Output HTTP/1.1 412 Precondition Failed Server: CouchDB/1.6.1 (Erlang OTP/17) Date: Mon, 16 Feb 2015 12:34:27 GMT Content-Type: application/json Content-Length: 95 Cache-Control: must-revalidate { "error" : "file_exists" , "reason" : "The database could not be created, the file already exists." } HTTP/1.1 412 Precondition Failed Server: CouchDB/1.6.1 (Erlang OTP/17) Date: Mon, 16 Feb 2015 12:34:27 GMT Content-Type: application/json Content-Length: 95 Cache-Control: must-revalidate { "error" : "file_exists" , "reason" : "The database could not be created, the file already exists." } HTTP/1.1 201 Created Server: CouchDB/1.6.1 (Erlang OTP/17) Date: Mon, 16 Feb 2015 12:34:27 GMT Content-Type: application/json Content-Length: 53 Cache-Control: must-revalidate { "ok" : true , "instance_start_time" : "1424085277160411" } [and the test program exits because the connection has been closed from the server side] Note that the connection is dropped after the result from the _ensure_full_commit method call. If I change the call to use Content-Length: 0 (instead of 2) and remove the empty JSON object, I get: Alternative HTTP/1.1 412 Precondition Failed Server: CouchDB/1.6.1 (Erlang OTP/17) Date: Mon, 16 Feb 2015 12:36:36 GMT Content-Type: application/json Content-Length: 95 Cache-Control: must-revalidate { "error" : "file_exists" , "reason" : "The database could not be created, the file already exists." } HTTP/1.1 412 Precondition Failed Server: CouchDB/1.6.1 (Erlang OTP/17) Date: Mon, 16 Feb 2015 12:36:36 GMT Content-Type: application/json Content-Length: 95 Cache-Control: must-revalidate { "error" : "file_exists" , "reason" : "The database could not be created, the file already exists." } HTTP/1.1 201 Created Server: CouchDB/1.6.1 (Erlang OTP/17) Date: Mon, 16 Feb 2015 12:36:36 GMT Content-Type: application/json Content-Length: 53 Cache-Control: must-revalidate { "ok" : true , "instance_start_time" : "1424085277160411" } HTTP/1.1 412 Precondition Failed Server: CouchDB/1.6.1 (Erlang OTP/17) Date: Mon, 16 Feb 2015 12:36:36 GMT Content-Type: application/json Content-Length: 95 Cache-Control: must-revalidate { "error" : "file_exists" , "reason" : "The database could not be created, the file already exists." } and the program hangs there because the connection is still not dropped (as expected) and is waiting for the next command.
        Hide
        sam@rfc1149.net Samuel Tardieu added a comment -

        Patch to have _ensure_full_commit and _compact consume the request body.

        Show
        sam@rfc1149.net Samuel Tardieu added a comment - Patch to have _ensure_full_commit and _compact consume the request body.
        Hide
        sam@rfc1149.net Samuel Tardieu added a comment - - edited

        I have trivially modified CouchDB (patch attached) to make _ensure_full_commit and _compact consume the body of the HTTP request according to the Content-Length header. It fixes the issue on my side, feel free to apply it with git am, or to request a resubmission using another channel if needed.

        Show
        sam@rfc1149.net Samuel Tardieu added a comment - - edited I have trivially modified CouchDB (patch attached) to make _ensure_full_commit and _compact consume the body of the HTTP request according to the Content-Length header. It fixes the issue on my side, feel free to apply it with git am , or to request a resubmission using another channel if needed.
        Hide
        kxepal Alexander Shorin added a comment -

        Nice found! About the patch (thanks!) I wonder, if it ever reasonable to accept any request payload to drop it silently when actually none is required (for now). May ensure that nothing was sent to reserve a space when some payload will require in future?

        Show
        kxepal Alexander Shorin added a comment - Nice found! About the patch (thanks!) I wonder, if it ever reasonable to accept any request payload to drop it silently when actually none is required (for now). May ensure that nothing was sent to reserve a space when some payload will require in future?
        Hide
        sam@rfc1149.net Samuel Tardieu added a comment -

        As I wrote above, ensuring that nothing is sent is problematic: that would require people to actually declare that they are sending "application/json" content while in fact they do not do so as the empty string is not strictly a valid "application/json" content. This is precisely why I used couch_httpd:body(Req) in the patch instead of couch_httpd:json_body(Req), as the latter would have returned an error for an empty content despite the declared "application/json".

        Forcing clients to declare a content-type when the content is not used is one thing, forcing them to generate invalid representations is another

        An alternative would be to use http:json_body(Req) if the content length is not 0, to ensure that the transmitted content is valid json. But that would require handling the chunked request case as well and would not be trivial nor useful at this stage, and why refuse for example a content of one space (invalid JSON) when we accept an empty one (invalid JSON as well)?

        In my opinion, the most sensible thing to do would be to accept anything in CouchDB 1.x, as not to break existing code and practices (for example, HTTP/1.0 clients might already be sending valid JSON, as by default the connection is dropped after every command), and to require valid JSON content (for example an empty object) in CouchDB 2.x for those methods.

        Show
        sam@rfc1149.net Samuel Tardieu added a comment - As I wrote above, ensuring that nothing is sent is problematic: that would require people to actually declare that they are sending "application/json" content while in fact they do not do so as the empty string is not strictly a valid "application/json" content. This is precisely why I used couch_httpd:body(Req) in the patch instead of couch_httpd:json_body(Req) , as the latter would have returned an error for an empty content despite the declared "application/json". Forcing clients to declare a content-type when the content is not used is one thing, forcing them to generate invalid representations is another An alternative would be to use http:json_body(Req) if the content length is not 0, to ensure that the transmitted content is valid json. But that would require handling the chunked request case as well and would not be trivial nor useful at this stage, and why refuse for example a content of one space (invalid JSON) when we accept an empty one (invalid JSON as well)? In my opinion, the most sensible thing to do would be to accept anything in CouchDB 1.x, as not to break existing code and practices (for example, HTTP/1.0 clients might already be sending valid JSON, as by default the connection is dropped after every command), and to require valid JSON content (for example an empty object) in CouchDB 2.x for those methods.
        Hide
        kxepal Alexander Shorin added a comment -

        Good point about backward compatibility. This one is enough.

        Show
        kxepal Alexander Shorin added a comment - Good point about backward compatibility. This one is enough.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user samueltardieu opened a pull request:

        https://github.com/apache/couchdb/pull/303

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request.

        Fixes COUCHDB-2583

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/samueltardieu/couchdb consume-json-body

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/couchdb/pull/303.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #303


        commit 120ce333e8103d2cd8cf79fefaf1ced6d01db893
        Author: Samuel Tardieu <sam@rfc1149.net>
        Date: 2015-02-16T13:17:10Z

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type
        be set to "application/json". However, when some content is provided
        (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content
        is read from the incoming HTTP request.

        Fixes COUCHDB-2583


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user samueltardieu opened a pull request: https://github.com/apache/couchdb/pull/303 Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. Fixes COUCHDB-2583 You can merge this pull request into a Git repository by running: $ git pull https://github.com/samueltardieu/couchdb consume-json-body Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb/pull/303.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #303 commit 120ce333e8103d2cd8cf79fefaf1ced6d01db893 Author: Samuel Tardieu <sam@rfc1149.net> Date: 2015-02-16T13:17:10Z Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. Fixes COUCHDB-2583
        Hide
        sam@rfc1149.net Samuel Tardieu added a comment -

        Is there anything left to do before being able to solve this issue? Can I help in any way?

        Show
        sam@rfc1149.net Samuel Tardieu added a comment - Is there anything left to do before being able to solve this issue? Can I help in any way?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user samueltardieu closed the pull request at:

        https://github.com/apache/couchdb/pull/303

        Show
        githubbot ASF GitHub Bot added a comment - Github user samueltardieu closed the pull request at: https://github.com/apache/couchdb/pull/303
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user samueltardieu opened a pull request:

        https://github.com/apache/couchdb/pull/304

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type
        be set to "application/json". However, when some content is provided
        (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content
        is read from the incoming HTTP request.

        Fixes COUCHDB-2583

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/samueltardieu/couchdb consume-json-body

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/couchdb/pull/304.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #304


        commit 220aba4c2bbd42045c994fd61c1757184e0ff59d
        Author: Samuel Tardieu <sam@rfc1149.net>
        Date: 2015-02-16T13:17:10Z

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type
        be set to "application/json". However, when some content is provided
        (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content
        is read from the incoming HTTP request.

        Fixes COUCHDB-2583


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user samueltardieu opened a pull request: https://github.com/apache/couchdb/pull/304 Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. Fixes COUCHDB-2583 You can merge this pull request into a Git repository by running: $ git pull https://github.com/samueltardieu/couchdb consume-json-body Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb/pull/304.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #304 commit 220aba4c2bbd42045c994fd61c1757184e0ff59d Author: Samuel Tardieu <sam@rfc1149.net> Date: 2015-02-16T13:17:10Z Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. Fixes COUCHDB-2583
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user samueltardieu opened a pull request:

        https://github.com/apache/couchdb-couch/pull/36

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type
        be set to "application/json". However, when some content is provided
        (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content
        is read from the incoming HTTP request.

        Mirrors the fix for COUCHDB-2583 in CouchDB 1.x.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/samueltardieu/couchdb-couch consume-json-body-2

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/couchdb-couch/pull/36.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #36


        commit 21bcf147f5e0b7e2ee06face3d2c7e41eae6cc6c
        Author: Samuel Tardieu <sam@rfc1149.net>
        Date: 2015-02-19T08:44:53Z

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type
        be set to "application/json". However, when some content is provided
        (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content
        is read from the incoming HTTP request.

        Mirrors the fix for COUCHDB-2583 in CouchDB 1.x.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user samueltardieu opened a pull request: https://github.com/apache/couchdb-couch/pull/36 Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. Mirrors the fix for COUCHDB-2583 in CouchDB 1.x. You can merge this pull request into a Git repository by running: $ git pull https://github.com/samueltardieu/couchdb-couch consume-json-body-2 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-couch/pull/36.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #36 commit 21bcf147f5e0b7e2ee06face3d2c7e41eae6cc6c Author: Samuel Tardieu <sam@rfc1149.net> Date: 2015-02-19T08:44:53Z Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. Mirrors the fix for COUCHDB-2583 in CouchDB 1.x.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 0035f8e33b374713af0133de20a599751166b1da in couchdb's branch refs/heads/1.x.x from Samuel Tardieu
        [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=0035f8e ]

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type
        be set to "application/json". However, when some content is provided
        (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content
        is read from the incoming HTTP request.

        This closes #304

        Fixes COUCHDB-2583

        Signed-off-by: Alexander Shorin <kxepal@apache.org>

        Show
        jira-bot ASF subversion and git services added a comment - Commit 0035f8e33b374713af0133de20a599751166b1da in couchdb's branch refs/heads/1.x.x from Samuel Tardieu [ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=0035f8e ] Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. This closes #304 Fixes COUCHDB-2583 Signed-off-by: Alexander Shorin <kxepal@apache.org>
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 952a41c7a10fc4dcb0324d09c5be7e5d1d548803 in couchdb-couch's branch refs/heads/master from Samuel Tardieu
        [ https://git-wip-us.apache.org/repos/asf?p=couchdb-couch.git;h=952a41c ]

        Consume JSON body even when its content is ignored

        "_ensure_full_commit" and "_compact" require that the content-type
        be set to "application/json". However, when some content is provided
        (such as "{}" in order to send a valid JSON external representation
        for the empty object), CouchDB needs to ensure that this content
        is read from the incoming HTTP request.

        Mirrors the fix for COUCHDB-2583 in CouchDB 1.x.

        This closes #36

        Signed-off-by: Alexander Shorin <kxepal@apache.org>

        Show
        jira-bot ASF subversion and git services added a comment - Commit 952a41c7a10fc4dcb0324d09c5be7e5d1d548803 in couchdb-couch's branch refs/heads/master from Samuel Tardieu [ https://git-wip-us.apache.org/repos/asf?p=couchdb-couch.git;h=952a41c ] Consume JSON body even when its content is ignored "_ensure_full_commit" and "_compact" require that the content-type be set to "application/json". However, when some content is provided (such as "{}" in order to send a valid JSON external representation for the empty object), CouchDB needs to ensure that this content is read from the incoming HTTP request. Mirrors the fix for COUCHDB-2583 in CouchDB 1.x. This closes #36 Signed-off-by: Alexander Shorin <kxepal@apache.org>
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/couchdb-couch/pull/36

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/couchdb-couch/pull/36
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user samueltardieu closed the pull request at:

        https://github.com/apache/couchdb/pull/304

        Show
        githubbot ASF GitHub Bot added a comment - Github user samueltardieu closed the pull request at: https://github.com/apache/couchdb/pull/304

          People

          • Assignee:
            Unassigned
            Reporter:
            sam@rfc1149.net Samuel Tardieu
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development