From commits-return-5309-apmail-couchdb-commits-archive=couchdb.apache.org@couchdb.apache.org Sat Oct 16 13:03:43 2010 Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 68688 invoked from network); 16 Oct 2010 13:03:43 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Oct 2010 13:03:43 -0000 Received: (qmail 82967 invoked by uid 500); 16 Oct 2010 13:03:43 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 82846 invoked by uid 500); 16 Oct 2010 13:03:41 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 82839 invoked by uid 99); 16 Oct 2010 13:03:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Oct 2010 13:03:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Oct 2010 13:03:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1C0132388A02; Sat, 16 Oct 2010 13:02:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1023276 - /couchdb/trunk/src/couchdb/couch_rep_httpc.erl Date: Sat, 16 Oct 2010 13:02:44 -0000 To: commits@couchdb.apache.org From: fdmanana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101016130244.1C0132388A02@eris.apache.org> 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) ->