couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Lehnardt (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-981) req.path and req.requested_path both show the path after rewrites
Date Sun, 30 Oct 2011 21:42:32 GMT

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

Jan Lehnardt commented on COUCHDB-981:
--------------------------------------

Since you can combine ghosts and rewrites, I'm not sure what's the best step here.

maybe a new property that includes all permutations and doesn't break BC.

"paths": {
  "requested_path": {
    "raw": "/foo/bar/baz/",
    "segments": ["foo","bar","baz"]
  },
  "after_vhost_path": {
    "raw": "/foo/bar/baz/",
    "segments": ["foo","bar","baz"]
  },
  "after_rewrite_path": {
    "raw": "/foo/bar/baz/",
    "segments": ["foo","bar","baz"]
  }
}


                
> req.path and req.requested_path both show the path after rewrites
> -----------------------------------------------------------------
>
>                 Key: COUCHDB-981
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-981
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 1.1, 1.2
>         Environment: Ubuntu 9.10 (karmic)
>            Reporter: Caolan McMahon
>
> The request object passed to show functions contains properties for 'path' and 'requested_path'.
Both of these properties return the path *after* rewrites have taken place, it was my understanding
(from talking to benoitc and others on #couchdb) that requested_path should show the path
prior to the rewrite.
> With the following design doc:
> {
>    "_id": "_design/test",
>    "_rev": "1-be48afc903d2ca4b879efa211b354d88",
>    "shows": {
>        "testshow": "function(doc, req){log(req); return 'testshow';}"
>    },
>    "rewrites": [
>        {
>            "from": "/",
>            "to": "_show/testshow"
>        }
>    ]
> }
> Requesting the _rewrite url:
> $ curl http://localhost:5984/test/_design/test/_rewrite/
> testshow
> Shows the following in the couchdb log output:
> [info] [<0.592.0>] OS Process #Port<0.2152> Log :: {"info":{"db_name":"test","doc_count":1,"doc_del_count":0,"update_seq":1,"purge_seq":0,"compact_running":false,"disk_size":4185,"instance_start_time":"1291827724231276","disk_format_version":5,"committed_update_seq":1},"id":null,"uuid":"b37350616734d6a48f6d63fefd00156c","method":"GET","requested_path":["test","_design","test","_show","testshow"],"path":["test","_design","test","_show","testshow"],"query":{},"headers":{"Accept":"*/*","Host":"localhost:5984","User-Agent":"curl/7.19.5
(x86_64-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15"},"body":"undefined","peer":"127.0.0.1","form":{},"cookie":{},"userCtx":{"db":"test","name":null,"roles":["_admin"]},"secObj":{}}
> [info] [<0.574.0>] 127.0.0.1 - - 'GET' /test/_design/test/_show/testshow 200
> You'll notice that both 'path' and 'requested_path' are set to: 
> ["test","_design","test","_show","testshow"]

--
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

        

Mime
View raw message