summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-10-16 13:02:43 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-10-16 13:02:43 +0000
commitec69a1b7916b8952fb8bcc8f054654d5681a9457 (patch)
treea78e724efbfc5adc9f8cdb4141b2b2496d2bad9a
parentd48a657b344be6a19d8fa57a7564ea8ac8c89421 (diff)
Replicator: use pattern matching with the #url record instead of the raw tuple.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1023276 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/couchdb/couch_rep_httpc.erl9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/couchdb/couch_rep_httpc.erl b/src/couchdb/couch_rep_httpc.erl
index 4b698eb9..bc4d7054 100644
--- a/src/couchdb/couch_rep_httpc.erl
+++ b/src/couchdb/couch_rep_httpc.erl
@@ -106,15 +106,18 @@ db_exists(Req, CanonicalUrl, CreateDB) ->
redirect_url(RespHeaders, OrigUrl) ->
MochiHeaders = mochiweb_headers:make(RespHeaders),
RedUrl = mochiweb_headers:get_value("Location", MochiHeaders),
- {url, _, Base, Port, _, _, Path, Proto} = ibrowse_lib:parse_url(RedUrl),
- {url, _, _, _, User, Passwd, _, _} = ibrowse_lib:parse_url(OrigUrl),
+ #url{
+ host = Host, port = Port,
+ path = Path, protocol = Proto
+ } = ibrowse_lib:parse_url(RedUrl),
+ #url{username = User, password = Passwd} = ibrowse_lib:parse_url(OrigUrl),
Creds = case is_list(User) andalso is_list(Passwd) of
true ->
User ++ ":" ++ Passwd ++ "@";
false ->
[]
end,
- atom_to_list(Proto) ++ "://" ++ Creds ++ Base ++ ":" ++
+ atom_to_list(Proto) ++ "://" ++ Creds ++ Host ++ ":" ++
integer_to_list(Port) ++ Path.
full_url(#http_db{url=Url} = Req) when is_binary(Url) ->