You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Will Holley (JIRA)" <ji...@apache.org> on 2015/04/26 20:35:38 UTC
[jira] [Created] (COUCHDB-2674) Inconsistent handling of URL
encoded design doc name between clustered and non-clustered interfaces
Will Holley created COUCHDB-2674:
------------------------------------
Summary: Inconsistent handling of URL encoded design doc name between clustered and non-clustered interfaces
Key: COUCHDB-2674
URL: https://issues.apache.org/jira/browse/COUCHDB-2674
Project: CouchDB
Issue Type: Bug
Security Level: public (Regular issues)
Components: Database Core
Reporter: Will Holley
In CouchDB 1.6 (and non-clustered 2.X), a request to GET a design document where the full design document name is URL encoded results in a 301 redirect:
{code}
$ curl -v http://127.0.0.1:15986/test/_design%2Ffoo
> GET /test/_design%2Ffoo HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 127.0.0.1:15986
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
* Server CouchDB/44fe5b6 (Erlang OTP/17) is not blacklisted
< Server: CouchDB/44fe5b6 (Erlang OTP/17)
< Location: http://127.0.0.1:15986/test/_design/foo
< Date: Sun, 26 Apr 2015 18:18:30 GMT
< Content-Length: 0
<
* Connection #0 to host 127.0.0.1 left intact
{code}
However, the same request through the clustered interface is handled directly:
{code}
$ curl -v http://127.0.0.1:15984/test/_design%2Ffoo
> GET /test/_design%2Ffoo HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 127.0.0.1:15984
> Accept: */*
>
< HTTP/1.1 200 OK
< X-CouchDB-Body-Time: 0
< X-Couch-Request-ID: f9a8af50
* Server CouchDB/44fe5b6 (Erlang OTP/17) is not blacklisted
< Server: CouchDB/44fe5b6 (Erlang OTP/17)
< Etag: "1-670d087e023b4320c148c8e73ba82129"
< Date: Sun, 26 Apr 2015 18:16:51 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 160
< Cache-Control: must-revalidate
<
{"_id":"_design/foo","_rev":"1-670d087e023b4320c148c8e73ba82129","views":{"newView":{"map":"function(doc) {\n emit(doc._id, 1);\n}"}},"language":"javascript"}
* Connection #0 to host 127.0.0.1 left intact
{code}
I think the behaviour in the clustered interface is preferable but we should be consistent. The difference seems to be at https://github.com/apache/couchdb-chttpd/blob/ab80f3131e244af967e2d162925ee45008d54a50/src/chttpd_db.erl#L512.
This came to light due to the .NET HTTP client not sending authentication headers when following the redirect (see https://github.com/danielwertheim/mycouch/issues/75).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)