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

Jason Smith commented on COUCHDB-1416:
--------------------------------------

Ryan, I believe there is still a bug here, triggered with just a vhost/rewrite 
combo. Would it be possible for you to modify the test to strictly use 
hostnames with no paths as the vhost key?

Jan, two things:

1. Your description is counter to the actual CouchDB code. Paths are valid 
vhost keys. example.com/foo and example.com/bar are distinct vhosts in 1.2.x.

2. In any case, the bug in this ticket is that the path a browser sends to 
couch is somehow forgotten by the time it hits a _show function as 
req.requested_path. Ryan might fill in the details but AFAIK, this will fail.

[vhosts]
example.com = /db/_design/ddoc/_rewrite

"_rewrites": [{"from":"show", "to":"_show/show_doc"}]

function(doc, req) {
  // show_doc
  return JSON.stringify(req.requested_path)
}

GET /foo
Host: example.com

The response should be "/foo" but it is not.
                
> the requested_path that is passed to a show is wrong on a vhost with a path 
> ----------------------------------------------------------------------------
>
>                 Key: COUCHDB-1416
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1416
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.2
>            Reporter: Ryan Ramage
>            Priority: Minor
>         Attachments: 
> A_0001-Testing-requested_path-for-various-combinations-of-r.patch, 
> A_0002-Compatibility-with-the-CLI-test-runner.patch, 
> A_0003-Store-the-entire-requested-path-in-x-couchdb-vhost-f.patch, 
> A_0004-For-a-vhost-correctly-reflect-true-requested-path.patch
>
>
> In a show or list, it is impossible to construct a full url that an end user 
> could use to re-request the resource, given the various combinations of 
> vhosts and rewrites. 
> The major one is if the vhost contains a path component, this path 
> information is not passed to the show at all. 
> I have created three tests that highlight the condition, currently failing 
> for one test, with the two passing to prevent regressions.
> The commit can be found here:
> https://github.com/ryanramage/couchdb/commit/e9417480e2ce160f359d9508dcec3d4e56045a60
> I have talked this over with JasonSmith and bennoitc on #couchdb and they 
> asked me to write the tests and raise the jira. 

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

        

Reply via email to