couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1023276 - /couchdb/trunk/src/couchdb/couch_rep_httpc.erl
Date Sat, 16 Oct 2010 13:02:44 GMT
Author: fdmanana
Date: Sat Oct 16 13:02:43 2010
New Revision: 1023276

URL: http://svn.apache.org/viewvc?rev=1023276&view=rev
Log:
Replicator: use pattern matching with the #url record instead of the raw tuple.

Modified:
    couchdb/trunk/src/couchdb/couch_rep_httpc.erl

Modified: couchdb/trunk/src/couchdb/couch_rep_httpc.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep_httpc.erl?rev=1023276&r1=1023275&r2=1023276&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep_httpc.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep_httpc.erl Sat Oct 16 13:02:43 2010
@@ -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) ->



Mime
View raw message