You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/10/28 23:11:28 UTC

[jira] [Commented] (COUCHDB-2674) Inconsistent handling of URL encoded design doc name between clustered and non-clustered interfaces

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

ASF GitHub Bot commented on COUCHDB-2674:
-----------------------------------------

GitHub user kxepal opened a pull request:

    https://github.com/apache/couchdb-chttpd/pull/87

    Restore HTTP 301 response for /db/_design%2fddoc/* resources

    This also fixes bug that existed in 1.x when escape sequence
    represented in uppercase: then we send wrong Location header
    back to user causing HTTP 404 result.
    
    COUCHDB-2674

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/kxepal/couchdb-chttpd 2674-restore-ddoc-redirection

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-chttpd/pull/87.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #87
    
----
commit 3dd4142e19db705e5db3ec72355629153024984a
Author: Alexander Shorin <kx...@apache.org>
Date:   2015-10-28T22:07:26Z

    Restore HTTP 301 response for /db/_design%2fddoc/* resources
    
    This also fixes bug that existed in 1.x when escape sequence
    represented in uppercase: then we send wrong Location header
    back to user causing HTTP 404 result.
    
    COUCHDB-2674

----


> 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
>          Components: HTTP Interface
>    Affects Versions: 2.0.0
>            Reporter: Will Holley
>            Assignee: Alexander Shorin
>            Priority: Blocker
>
> 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)