You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Jan Lehnardt <ja...@apache.org> on 2010/06/01 11:58:06 UTC

Re: svn commit: r949912 - in /couchdb/trunk: src/couchdb/couch_httpd.erl test/etap/160-vhosts.t

On 1 Jun 2010, at 02:59, jchris@apache.org wrote:

> Author: jchris
> Date: Tue Jun  1 00:59:26 2010
> New Revision: 949912
> 
> URL: http://svn.apache.org/viewvc?rev=949912&view=rev
> Log:
> better tests for the vhost globals, fixed a bug

which bug?

Cheers
Jan
--

> 
> Modified:
>    couchdb/trunk/src/couchdb/couch_httpd.erl
>    couchdb/trunk/test/etap/160-vhosts.t
> 
> Modified: couchdb/trunk/src/couchdb/couch_httpd.erl
> URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=949912&r1=949911&r2=949912&view=diff
> ==============================================================================
> --- couchdb/trunk/src/couchdb/couch_httpd.erl (original)
> +++ couchdb/trunk/src/couchdb/couch_httpd.erl Tue Jun  1 00:59:26 2010
> @@ -311,8 +311,14 @@ increment_method_stats(Method) ->
> % if so, then it will not be rewritten, but will run as a normal couchdb request.
> % normally you'd use this for _uuids _utils and a few of the others you want to keep available on vhosts. You can also use it to make databases 'global'.
> vhost_global(VhostGlobals, MochiReq) ->
> -    "/"++Path = MochiReq:get(path),
> -    [true] == [true||V <- VhostGlobals, V == Path].
> +    "/" ++ Path = MochiReq:get(path),
> +    Front = case partition(Path) of
> +    {"", "", ""} ->
> +        "/"; % Special case the root url handler
> +    {FirstPart, _, _} ->
> +        FirstPart
> +    end,
> +    [true] == [true||V <- VhostGlobals, V == Front].
> 
> % Utilities
> 
> 
> Modified: couchdb/trunk/test/etap/160-vhosts.t
> URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/160-vhosts.t?rev=949912&r1=949911&r2=949912&view=diff
> ==============================================================================
> --- couchdb/trunk/test/etap/160-vhosts.t (original)
> +++ couchdb/trunk/test/etap/160-vhosts.t Tue Jun  1 00:59:26 2010
> @@ -122,11 +122,10 @@ test_vhost_request_with_qs() ->
>     end.
> 
> test_vhost_request_with_global() ->
> -    Url = server() ++ "_uuids",
> -    case ibrowse:send_req(Url, [], get, [], [{host_header, "example.com"}]) of
> -        {ok, _, _, Body} ->
> -            {JsonProps} = couch_util:json_decode(Body),
> -            HasUuids = proplists:is_defined(<<"uuids">>, JsonProps),
> -            etap:is(HasUuids, true, "should return _uuids");
> +    Url2 = server() ++ "_utils/index.html",
> +    case ibrowse:send_req(Url2, [], get, [], [{host_header, "example.com"}]) of
> +        {ok, _, _, Body2} ->
> +            "<!DOCTYPE" ++ _Foo = Body2,
> +            etap:is(true, true, "should serve /_utils even inside vhosts");
>         _Else -> false
>     end.
> 
>