You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/10/27 14:29:04 UTC

chttpd commit: updated refs/heads/master to 038a933

Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 7a2bd8f31 -> 038a933a0


Fix replication when source/target are URLs

Commit 895715a6 introduced a bug when we quote all the values
while we only need to escape values that references to local
databases.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/038a933a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/038a933a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/038a933a

Branch: refs/heads/master
Commit: 038a933a09ad90c814e39b0327463aca1b194982
Parents: 7a2bd8f
Author: Alexander Shorin <kx...@apache.org>
Authored: Tue Oct 27 16:23:22 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Tue Oct 27 16:24:24 2015 +0300

----------------------------------------------------------------------
 src/chttpd.erl                 | 4 ++--
 test/chttpd_handlers_tests.erl | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/038a933a/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 4f2183e..1b22c9a 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -381,7 +381,7 @@ fix_uri(Req, Props, Type) ->
         true ->
             Props;
         false ->
-            Uri = make_uri(Req, Uri0),
+            Uri = make_uri(Req, quote(Uri0)),
             [{Type,Uri}|proplists:delete(Type,Props)]
         end
     end.
@@ -391,7 +391,7 @@ replication_uri(Type, PostProps) ->
     {Props} ->
         couch_util:get_value(<<"url">>, Props);
     Else ->
-        quote(Else)
+        Else
     end.
 
 is_http(<<"http://", _/binary>>) ->

http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/038a933a/test/chttpd_handlers_tests.erl
----------------------------------------------------------------------
diff --git a/test/chttpd_handlers_tests.erl b/test/chttpd_handlers_tests.erl
index 05a21b7..f3e8f5d 100644
--- a/test/chttpd_handlers_tests.erl
+++ b/test/chttpd_handlers_tests.erl
@@ -47,17 +47,17 @@ replicate_test_() ->
 should_escape_dbname_on_replicate(Url) ->
     ?_test(
         begin
+            UrlBin = ?l2b(Url),
             Request = couch_util:json_encode({[
-                {<<"source">>, <<"foo/bar">>},
+                {<<"source">>, <<UrlBin/binary, "/foo%2Fbar">>},
                 {<<"target">>, <<"bar/baz">>},
                 {<<"create_target">>, true}
             ]}),
             {ok, 200, _, Body} = request_replicate(Url ++ "/_replicate", Request),
             JSON = couch_util:json_decode(Body),
 
-            Source = json_value(JSON, [<<"source">>, <<"url">>]),
+            Source = json_value(JSON, [<<"source">>]),
             Target = json_value(JSON, [<<"target">>, <<"url">>]),
-            UrlBin = ?l2b(Url),
             ?assertEqual(<<UrlBin/binary, "/foo%2Fbar">>, Source),
             ?assertEqual(<<UrlBin/binary, "/bar%2Fbaz">>, Target)
         end).