couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From St├ęphane Alnet (JIRA) <>
Subject [jira] [Commented] (COUCHDB-1155) Etag send by list function does not depend on userCtx
Date Wed, 03 Oct 2012 08:24:07 GMT


St├ęphane Alnet commented on COUCHDB-1155:

Although you can't currently override the Etag you can modify it:

    "lists": {
      "test": "(function(){start({headers:{Etag:'foo'}}); send('');})"

GET /bar/_design/foo/_list/test/test

    HTTP/1.1 200 OK
    Vary: Accept
    Transfer-Encoding: chunked
    Server: CouchDB/1.2.0 (Erlang OTP/R15B01)
    Etag: foo, "4SNNDV6U28X8Z7TXTQURJAMPT"
    Date: Wed, 03 Oct 2012 08:20:14 GMT
    Content-Type: application/json

So the Etag provided by Javascript is pre-pended to the CouchDB-generated Etag, which should
be sufficient?
> Etag send by list function does not depend on userCtx
> -----------------------------------------------------
>                 Key: COUCHDB-1155
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.0.2
>            Reporter: Johannes J. Schmidt
>            Assignee: Randall Leeds
> List functions should send a different Etag when requested by different users.
> The following curl session shows identical Etags for different users. CouchDB must not
be in admin party mode.
> DB=testdb
> # admin credentials for db creation
> ADMIN=admin:secure
> # this user must have an empty roles array
> USER=user:secure
> curl -XPUT $PROTOCOL://$ADMIN@$DOMAIN/$DB/foo -d '{"count":1}'
> curl -XPUT $PROTOCOL://$ADMIN@$DOMAIN/$DB/_design/foo -d '{ "views": { "bar": { "map":
"function(doc) { emit(doc._id, null); }" } }, "lists": { "bar": "function(head, req) { return || \"anonymous\" }" }}'
> curl -s $PROTOCOL://$DOMAIN/$DB/_design/foo/_list/bar/bar --head | grep Etag
> curl -s $PROTOCOL://$USER@$DOMAIN/$DB/_design/foo/_list/bar/bar --head | grep Etag
> #=> Etag: "A1NKHA0935KMCSHFSK94EHZNL"
> #=> Etag: "A1NKHA0935KMCSHFSK94EHZNL"
> This issue is important for standalone CouchDB applications which use list functions
depending on the user context, eg. showing a login button or username.
> regards
> Johannes
> PS: I tried to write a javascript test case but this issue can only be reproduced if
the server is not in admin party mode, which the test suite requires. I am not so familar
with those tests to temporarily change the admin party.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message