You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Alexander Shorin (Created) (JIRA)" <ji...@apache.org> on 2012/03/21 11:37:40 UTC

[jira] [Created] (COUCHDB-1447) X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler

X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler
-----------------------------------------------------------------------------------------------------

                 Key: COUCHDB-1447
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1447
             Project: CouchDB
          Issue Type: Bug
    Affects Versions: 1.2, 1.3
         Environment: Apache CouchDB 1.3.0a-a2bea1f-git
Apache CouchDB 1.2.0a-94e72e7-git
            Reporter: Alexander Shorin
            Priority: Minor


{
   "_id": "_design/dump",
   "_rev": "1-74b49af793bd5ce090712f638c3c920e",
   "updates": {
       "doc": "function(doc, req){ return [doc, {headers: {'Content-Type': 'text/html'}, 'body': '<h1>test</h1>'}]}"
   }
}

curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
* About to connect() to localhost port 5984 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 5984 (#0)
> PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> Host: localhost:5984
> Accept: */*
> 
< HTTP/1.1 201 Created
< Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
< Date: Mon, 19 Mar 2012 01:45:20 GMT
< Content-Type: text/html
< Content-Length: 13
< 
* Connection #0 to host localhost left intact
<h1>test</h1>* Closing connection #0


{
   "_id": "_design/dump",
   "_rev": "2-f1c20db4fb28846399ab1cecaa9d2f28",
   "updates": {
       "doc": "function(doc, req){ return [doc, {'body': '<h1>test</h1>'}]}"
   }
}

curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
* About to connect() to localhost port 5984 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 5984 (#0)
> PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> Host: localhost:5984
> Accept: */*
> 
< HTTP/1.1 201 Created
< X-Couch-Update-NewRev: 4-89c1c79a98fc269e474eb64d999a2049
< Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
< Date: Mon, 19 Mar 2012 01:46:43 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 13
< 
* Connection #0 to host localhost left intact
<h1>test</h1>* Closing connection #0

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1447) X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler

Posted by "Benoit Chesneau (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396991#comment-13396991 ] 

Benoit Chesneau commented on COUCHDB-1447:
------------------------------------------

Since this is the only way to get the new revision, I think we should merge the headers here. It's useful. 

In the original code I don't remember we had the possibility to override headers in an _update function, that's why it's missing.
                
> X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler
> -----------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-1447
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1447
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.3
>         Environment: Apache CouchDB 1.3.0a-a2bea1f-git
> Apache CouchDB 1.2.0a-94e72e7-git
>            Reporter: Alexander Shorin
>            Priority: Minor
>
> {
>    "_id": "_design/dump",
>    "_rev": "1-74b49af793bd5ce090712f638c3c920e",
>    "updates": {
>        "doc": "function(doc, req){ return [doc, {headers: {'Content-Type': 'text/html'}, 'body': '<h1>test</h1>'}]}"
>    }
> }
> curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
> * About to connect() to localhost port 5984 (#0)
> *   Trying 127.0.0.1...
> * connected
> * Connected to localhost (127.0.0.1) port 5984 (#0)
> > PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> > User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> > Host: localhost:5984
> > Accept: */*
> > 
> < HTTP/1.1 201 Created
> < Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
> < Date: Mon, 19 Mar 2012 01:45:20 GMT
> < Content-Type: text/html
> < Content-Length: 13
> < 
> * Connection #0 to host localhost left intact
> <h1>test</h1>* Closing connection #0
> {
>    "_id": "_design/dump",
>    "_rev": "2-f1c20db4fb28846399ab1cecaa9d2f28",
>    "updates": {
>        "doc": "function(doc, req){ return [doc, {'body': '<h1>test</h1>'}]}"
>    }
> }
> curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
> * About to connect() to localhost port 5984 (#0)
> *   Trying 127.0.0.1...
> * connected
> * Connected to localhost (127.0.0.1) port 5984 (#0)
> > PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> > User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> > Host: localhost:5984
> > Accept: */*
> > 
> < HTTP/1.1 201 Created
> < X-Couch-Update-NewRev: 4-89c1c79a98fc269e474eb64d999a2049
> < Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
> < Date: Mon, 19 Mar 2012 01:46:43 GMT
> < Content-Type: text/html; charset=utf-8
> < Content-Length: 13
> < 
> * Connection #0 to host localhost left intact
> <h1>test</h1>* Closing connection #0

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1447) X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler

Posted by "Dave Cottlehuber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13397058#comment-13397058 ] 

Dave Cottlehuber commented on COUCHDB-1447:
-------------------------------------------

+1 for merging.
                
> X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler
> -----------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-1447
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1447
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.3
>         Environment: Apache CouchDB 1.3.0a-a2bea1f-git
> Apache CouchDB 1.2.0a-94e72e7-git
>            Reporter: Alexander Shorin
>            Priority: Minor
>
> {
>    "_id": "_design/dump",
>    "_rev": "1-74b49af793bd5ce090712f638c3c920e",
>    "updates": {
>        "doc": "function(doc, req){ return [doc, {headers: {'Content-Type': 'text/html'}, 'body': '<h1>test</h1>'}]}"
>    }
> }
> curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
> * About to connect() to localhost port 5984 (#0)
> *   Trying 127.0.0.1...
> * connected
> * Connected to localhost (127.0.0.1) port 5984 (#0)
> > PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> > User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> > Host: localhost:5984
> > Accept: */*
> > 
> < HTTP/1.1 201 Created
> < Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
> < Date: Mon, 19 Mar 2012 01:45:20 GMT
> < Content-Type: text/html
> < Content-Length: 13
> < 
> * Connection #0 to host localhost left intact
> <h1>test</h1>* Closing connection #0
> {
>    "_id": "_design/dump",
>    "_rev": "2-f1c20db4fb28846399ab1cecaa9d2f28",
>    "updates": {
>        "doc": "function(doc, req){ return [doc, {'body': '<h1>test</h1>'}]}"
>    }
> }
> curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
> * About to connect() to localhost port 5984 (#0)
> *   Trying 127.0.0.1...
> * connected
> * Connected to localhost (127.0.0.1) port 5984 (#0)
> > PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> > User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> > Host: localhost:5984
> > Accept: */*
> > 
> < HTTP/1.1 201 Created
> < X-Couch-Update-NewRev: 4-89c1c79a98fc269e474eb64d999a2049
> < Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
> < Date: Mon, 19 Mar 2012 01:46:43 GMT
> < Content-Type: text/html; charset=utf-8
> < Content-Length: 13
> < 
> * Connection #0 to host localhost left intact
> <h1>test</h1>* Closing connection #0

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1447) X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396858#comment-13396858 ] 

Robert Newson commented on COUCHDB-1447:
----------------------------------------

The relevant section of code is here (couch_mrview_show.erl);

            {[
                {<<"code">>, 201},
                {<<"headers">>, {[{<<"X-Couch-Update-NewRev">>, NewRevStr}]}}
                | JsonResp0]};

If JsonResp0 includes a headers entry, then the X-Couch-Update-NewRev header is lost (only one of the <<"headers">> items is found, they are not merged).

Should they be merged or should sending "headers" from a show function suppress this field?

I think the former but would like some opinions.

                
> X-Couch-Update-NewRev header is missed if custom headers are specified in response of _update handler
> -----------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-1447
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1447
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.3
>         Environment: Apache CouchDB 1.3.0a-a2bea1f-git
> Apache CouchDB 1.2.0a-94e72e7-git
>            Reporter: Alexander Shorin
>            Priority: Minor
>
> {
>    "_id": "_design/dump",
>    "_rev": "1-74b49af793bd5ce090712f638c3c920e",
>    "updates": {
>        "doc": "function(doc, req){ return [doc, {headers: {'Content-Type': 'text/html'}, 'body': '<h1>test</h1>'}]}"
>    }
> }
> curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
> * About to connect() to localhost port 5984 (#0)
> *   Trying 127.0.0.1...
> * connected
> * Connected to localhost (127.0.0.1) port 5984 (#0)
> > PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> > User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> > Host: localhost:5984
> > Accept: */*
> > 
> < HTTP/1.1 201 Created
> < Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
> < Date: Mon, 19 Mar 2012 01:45:20 GMT
> < Content-Type: text/html
> < Content-Length: 13
> < 
> * Connection #0 to host localhost left intact
> <h1>test</h1>* Closing connection #0
> {
>    "_id": "_design/dump",
>    "_rev": "2-f1c20db4fb28846399ab1cecaa9d2f28",
>    "updates": {
>        "doc": "function(doc, req){ return [doc, {'body': '<h1>test</h1>'}]}"
>    }
> }
> curl -v -X PUT http://localhost:5984/app%2fdefault/_design/dump/_update/doc/foo
> * About to connect() to localhost port 5984 (#0)
> *   Trying 127.0.0.1...
> * connected
> * Connected to localhost (127.0.0.1) port 5984 (#0)
> > PUT /app%2fdefault/_design/dump/_update/doc/foo HTTP/1.1
> > User-Agent: curl/7.24.0 (x86_64-pc-linux-gnu) libcurl/7.24.0 GnuTLS/2.10.5 zlib/1.2.6
> > Host: localhost:5984
> > Accept: */*
> > 
> < HTTP/1.1 201 Created
> < X-Couch-Update-NewRev: 4-89c1c79a98fc269e474eb64d999a2049
> < Server: CouchDB/1.3.0a-a2bea1f-git (Erlang OTP/R15B)
> < Date: Mon, 19 Mar 2012 01:46:43 GMT
> < Content-Type: text/html; charset=utf-8
> < Content-Length: 13
> < 
> * Connection #0 to host localhost left intact
> <h1>test</h1>* Closing connection #0

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira