summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason David Davies <jasondavies@apache.org>2009-10-13 22:19:37 +0000
committerJason David Davies <jasondavies@apache.org>2009-10-13 22:19:37 +0000
commit55b43e00a9276942b4dd06245701ff93dec3dc75 (patch)
tree788b473ba8129f92ec7098ecebb51ffe722a5b4b /src
parent022ce7a40c0be1c5cf90f05fdb223f5e1f140cfa (diff)
Fix new create_target replication option when OAuth is being used.
Closes COUCHDB-525. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@824954 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_rep_httpc.erl16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/couchdb/couch_rep_httpc.erl b/src/couchdb/couch_rep_httpc.erl
index ba863746..bbc5ccec 100644
--- a/src/couchdb/couch_rep_httpc.erl
+++ b/src/couchdb/couch_rep_httpc.erl
@@ -74,18 +74,20 @@ db_exists(Req, CanonicalUrl, CreateDB) ->
headers = Headers0,
url = Url
} = Req,
- Headers = case proplists:get_value(<<"oauth">>, Auth) of
- undefined ->
- Headers0;
- {OAuthProps} ->
- [oauth_header(Url, [], head, OAuthProps) | Headers0]
+ HeadersFun = fun(Method) ->
+ case proplists:get_value(<<"oauth">>, Auth) of
+ undefined ->
+ Headers0;
+ {OAuthProps} ->
+ [oauth_header(Url, [], Method, OAuthProps) | Headers0]
+ end
end,
case CreateDB of
true ->
- catch ibrowse:send_req(Url, Headers, put);
+ catch ibrowse:send_req(Url, HeadersFun(put), put);
_Else -> ok
end,
- case catch ibrowse:send_req(Url, Headers, head) of
+ case catch ibrowse:send_req(Url, HeadersFun(head), head) of
{ok, "200", _, _} ->
Req#http_db{url = CanonicalUrl};
{ok, "301", RespHeaders, _} ->