couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Hooker (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COUCHDB-313) '$' in database name confuses behaviour of %2F in design doc ID
Date Thu, 21 Jan 2010 04:36:57 GMT

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

Matthew Hooker commented on COUCHDB-313:
----------------------------------------

works fine for me off trunk. I think this can be closed.


$ curl -X PUT 'http://127.0.0.1:5984/my$db'
{"ok":true}
$ curl -X PUT -d'{}' 'http://127.0.0.1:5984/my$db/_design/test'
{"ok":true,"id":"_design/test","rev":"1-967a00dff5e02add41819138abb3284d"}
$ curl 'http://127.0.0.1:5984/my$db/_design/test'
{"_id":"_design/test","_rev":"1-967a00dff5e02add41819138abb3284d"}
$ curl -v 'http://127.0.0.1:5984/my$db/_design%2Ftest'
* About to connect() to 127.0.0.1 port 5984 (#0)
*   Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 5984 (#0)
> GET /my$db/_design%2Ftest HTTP/1.1
> User-Agent: curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/1.2.3.3
libidn/1.15
> Host: 127.0.0.1:5984
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Server: CouchDB/0.11.0b890693 (Erlang OTP/R13B)
< Location: http://127.0.0.1:5984/my%24db/_design/test
< Date: Thu, 21 Jan 2010 04:33:39 GMT
< Content-Length: 0
< 
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0

> '$' in database name confuses behaviour of %2F in design doc ID
> ---------------------------------------------------------------
>
>                 Key: COUCHDB-313
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-313
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: svn r761188
> Ubuntu Hardy + Erlang 12B3 from Intrepid
>            Reporter: Brian Candler
>            Priority: Minor
>
> Normally, if you use %2F to separate _design from the rest of the URL, you get a 301
redirect:
> $ curl -X PUT http://127.0.0.1:5984/mydb
> {"ok":true}
> $ curl -X PUT -d"{}" http://127.0.0.1:5984/mydb/_design/test
> {"ok":true,"id":"_design/test","rev":"1-481559718"}
> $ curl -v http://127.0.0.1:5984/mydb/_design%2Ftest
> ...
> < HTTP/1.1 301 Moved Permanently
> < Server: CouchDB/0.9.0 (Erlang OTP/R12B)
> < Location: http://127.0.0.1:5984/mydb/_design/test
> However this logic is broken if you use a database which has a '$' in the name: you get
a 'badmatch' erlang error.
> $ curl -X PUT 'http://127.0.0.1:5984/my$db'
> {"ok":true}
> $ curl -X PUT -d'{}' 'http://127.0.0.1:5984/my$db/_design/test'
> {"ok":true,"id":"_design/test","rev":"1-4187139805"}
> $ curl 'http://127.0.0.1:5984/my$db/_design/test'
> {"_id":"_design/test","_rev":"1-4187139805"}
> $ curl 'http://127.0.0.1:5984/my$db/_design%2Ftest'
> {"error":"badmatch","reason":"{ok,[\"/my$db/\",\"test\"]}"}
> $ is allowed in a database name according to the wiki (as long as it's not the first
character), and otherwise appears to work OK. I have not tried other 'unusual' characters.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message