Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 43690 invoked from network); 2 Jun 2010 12:56:28 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Jun 2010 12:56:28 -0000 Received: (qmail 68919 invoked by uid 500); 2 Jun 2010 12:56:28 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 68873 invoked by uid 500); 2 Jun 2010 12:56:28 -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 68866 invoked by uid 99); 2 Jun 2010 12:56:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jun 2010 12:56:28 +0000 X-ASF-Spam-Status: No, hits=-1696.8 required=10.0 tests=ALL_TRUSTED,AWL 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; Wed, 02 Jun 2010 12:56:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E7BF22388A2C; Wed, 2 Jun 2010 12:56:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r950547 - /couchdb/branches/0.11.x/src/couchdb/ Date: Wed, 02 Jun 2010 12:56:05 -0000 To: commits@couchdb.apache.org From: jan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100602125605.E7BF22388A2C@eris.apache.org> Author: jan Date: Wed Jun 2 12:56:04 2010 New Revision: 950547 URL: http://svn.apache.org/viewvc?rev=950547&view=rev Log: trailing whitespace pedantry Modified: couchdb/branches/0.11.x/src/couchdb/couch_btree.erl couchdb/branches/0.11.x/src/couchdb/couch_config.erl couchdb/branches/0.11.x/src/couchdb/couch_db.erl couchdb/branches/0.11.x/src/couchdb/couch_db_updater.erl couchdb/branches/0.11.x/src/couchdb/couch_doc.erl couchdb/branches/0.11.x/src/couchdb/couch_file.erl couchdb/branches/0.11.x/src/couchdb/couch_httpd.erl couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl couchdb/branches/0.11.x/src/couchdb/couch_httpd_db.erl couchdb/branches/0.11.x/src/couchdb/couch_httpd_oauth.erl couchdb/branches/0.11.x/src/couchdb/couch_httpd_show.erl couchdb/branches/0.11.x/src/couchdb/couch_httpd_view.erl couchdb/branches/0.11.x/src/couchdb/couch_key_tree.erl couchdb/branches/0.11.x/src/couchdb/couch_native_process.erl couchdb/branches/0.11.x/src/couchdb/couch_query_servers.erl couchdb/branches/0.11.x/src/couchdb/couch_rep.erl couchdb/branches/0.11.x/src/couchdb/couch_rep_att.erl couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl couchdb/branches/0.11.x/src/couchdb/couch_rep_httpc.erl couchdb/branches/0.11.x/src/couchdb/couch_rep_missing_revs.erl couchdb/branches/0.11.x/src/couchdb/couch_rep_reader.erl couchdb/branches/0.11.x/src/couchdb/couch_server.erl couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl Modified: couchdb/branches/0.11.x/src/couchdb/couch_btree.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_btree.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_btree.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_btree.erl Wed Jun 2 12:56:04 2010 @@ -147,10 +147,10 @@ fold(#btree{root=Root}=Bt, Fun, Acc, Opt Result = case proplists:get_value(start_key, Options) of undefined -> - stream_node(Bt, [], Bt#btree.root, InRange, Dir, + stream_node(Bt, [], Bt#btree.root, InRange, Dir, convert_fun_arity(Fun), Acc); StartKey -> - stream_node(Bt, [], Bt#btree.root, StartKey, InRange, Dir, + stream_node(Bt, [], Bt#btree.root, StartKey, InRange, Dir, convert_fun_arity(Fun), Acc) end, case Result of Modified: couchdb/branches/0.11.x/src/couchdb/couch_config.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_config.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_config.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_config.erl Wed Jun 2 12:56:04 2010 @@ -231,7 +231,7 @@ parse_ini_file(IniFile) -> [[]] -> % empty line means delete this key ets:delete(?MODULE, {AccSectionName, ValueName}), - {AccSectionName, AccValues}; + {AccSectionName, AccValues}; [LineValue | _Rest] -> {AccSectionName, [{{AccSectionName, ValueName}, LineValue} | AccValues]} Modified: couchdb/branches/0.11.x/src/couchdb/couch_db.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_db.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_db.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_db.erl Wed Jun 2 12:56:04 2010 @@ -151,9 +151,9 @@ find_missing([{Id, Revs}|RestIdRevs], [{ % Find the revs that are possible parents of this rev PossibleAncestors = lists:foldl(fun({LeafPos, LeafRevId}, Acc) -> - % this leaf is a "possible ancenstor" of the missing + % this leaf is a "possible ancenstor" of the missing % revs if this LeafPos lessthan any of the missing revs - case lists:any(fun({MissingPos, _}) -> + case lists:any(fun({MissingPos, _}) -> LeafPos < MissingPos end, MissingRevs) of true -> [{LeafPos, LeafRevId} | Acc]; @@ -261,7 +261,7 @@ check_is_reader(#db{user_ctx=#user_ctx{n ReaderRoles = proplists:get_value(<<"roles">>, Readers,[]), WithAdminRoles = [<<"_admin">> | ReaderRoles], ReaderNames = proplists:get_value(<<"names">>, Readers,[]), - case ReaderRoles ++ ReaderNames of + case ReaderRoles ++ ReaderNames of [] -> ok; % no readers == public access _Else -> case WithAdminRoles -- Roles of @@ -425,12 +425,12 @@ prep_and_validate_update(Db, #doc{id=Id, prep_and_validate_updates(_Db, [], [], _AllowConflict, AccPrepped, AccFatalErrors) -> {AccPrepped, AccFatalErrors}; -prep_and_validate_updates(Db, [DocBucket|RestBuckets], [not_found|RestLookups], +prep_and_validate_updates(Db, [DocBucket|RestBuckets], [not_found|RestLookups], AllowConflict, AccPrepped, AccErrors) -> [#doc{id=Id}|_]=DocBucket, % no existing revs are known, {PreppedBucket, AccErrors3} = lists:foldl( - fun(#doc{revs=Revs}=Doc, {AccBucket, AccErrors2}) -> + fun(#doc{revs=Revs}=Doc, {AccBucket, AccErrors2}) -> case couch_doc:has_stubs(Doc) of true -> couch_doc:merge_doc(Doc, #doc{}); % will throw exception @@ -471,7 +471,7 @@ prep_and_validate_updates(Db, [DocBucket end end, {[], AccErrors}, DocBucket), - prep_and_validate_updates(Db, RestBuckets, RestLookups, AllowConflict, + prep_and_validate_updates(Db, RestBuckets, RestLookups, AllowConflict, [PreppedBucket | AccPrepped], AccErrors3). @@ -487,7 +487,7 @@ prep_and_validate_replicated_updates(Db, case OldInfo of not_found -> {ValidatedBucket, AccErrors3} = lists:foldl( - fun(Doc, {AccPrepped2, AccErrors2}) -> + fun(Doc, {AccPrepped2, AccErrors2}) -> case couch_doc:has_stubs(Doc) of true -> couch_doc:merge_doc(Doc, #doc{}); % will throw exception @@ -877,7 +877,7 @@ changes_since(Db, Style, StartSeq, Fun, end, Fun(Infos, Acc2) end, - {ok, _LastReduction, AccOut} = couch_btree:fold(Db#db.docinfo_by_seq_btree, + {ok, _LastReduction, AccOut} = couch_btree:fold(Db#db.docinfo_by_seq_btree, Wrapper, Acc, [{start_key, StartSeq + 1}] ++ Options), {ok, AccOut}. Modified: couchdb/branches/0.11.x/src/couchdb/couch_db_updater.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_db_updater.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_db_updater.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_db_updater.erl Wed Jun 2 12:56:04 2010 @@ -187,11 +187,11 @@ handle_cast({compact_done, CompactFilepa end. -handle_info({update_docs, Client, GroupedDocs, NonRepDocs, MergeConflicts, +handle_info({update_docs, Client, GroupedDocs, NonRepDocs, MergeConflicts, FullCommit}, Db) -> GroupedDocs2 = [[{Client, D} || D <- DocGroup] || DocGroup <- GroupedDocs], if NonRepDocs == [] -> - {GroupedDocs3, Clients, FullCommit2} = collect_updates(GroupedDocs2, + {GroupedDocs3, Clients, FullCommit2} = collect_updates(GroupedDocs2, [Client], MergeConflicts, FullCommit); true -> GroupedDocs3 = GroupedDocs2, @@ -199,7 +199,7 @@ handle_info({update_docs, Client, Groupe Clients = [Client] end, NonRepDocs2 = [{Client, NRDoc} || NRDoc <- NonRepDocs], - try update_docs_int(Db, GroupedDocs3, NonRepDocs2, MergeConflicts, + try update_docs_int(Db, GroupedDocs3, NonRepDocs2, MergeConflicts, FullCommit2) of {ok, Db2} -> ok = gen_server:call(Db#db.main_pid, {db_updated, Db2}), @@ -254,7 +254,7 @@ collect_updates(GroupedDocsAcc, ClientsA {update_docs, Client, GroupedDocs, [], MergeConflicts, FullCommit2} -> GroupedDocs2 = [[{Client, Doc} || Doc <- DocGroup] || DocGroup <- GroupedDocs], - GroupedDocsAcc2 = + GroupedDocsAcc2 = merge_updates(GroupedDocsAcc, GroupedDocs2, []), collect_updates(GroupedDocsAcc2, [Client | ClientsAcc], MergeConflicts, (FullCommit or FullCommit2)) @@ -505,7 +505,7 @@ merge_rev_trees(MergeConflicts, [NewDocs % this means we are recreating a brand new document % into a state that already existed before. % put the rev into a subsequent edit of the deletion - #doc_info{revs=[#rev_info{rev={OldPos,OldRev}}|_]} = + #doc_info{revs=[#rev_info{rev={OldPos,OldRev}}|_]} = couch_doc:to_doc_info(OldDocInfo), NewRevId = couch_db:new_revid( NewDoc#doc{revs={OldPos, [OldRev]}}), @@ -513,7 +513,7 @@ merge_rev_trees(MergeConflicts, [NewDocs {NewTree2, _} = couch_key_tree:merge(AccTree, [couch_db:doc_to_tree(NewDoc2)]), % we changed the rev id, this tells the caller we did - send_result(Client, Id, {Pos-1,PrevRevs}, + send_result(Client, Id, {Pos-1,PrevRevs}, {ok, {OldPos + 1, NewRevId}}), NewTree2; true -> @@ -527,7 +527,7 @@ merge_rev_trees(MergeConflicts, [NewDocs {NewTree, _} = couch_key_tree:merge(AccTree, [couch_db:doc_to_tree(NewDoc)]), NewTree - end + end end, OldTree, NewDocs), if NewRevTree == OldTree -> @@ -813,7 +813,7 @@ copy_compact(Db, NewDb0, Retry) -> couch_task_status:set_update_frequency(500), {ok, _, {NewDb2, Uncopied, TotalChanges}} = - couch_btree:foldl(Db#db.docinfo_by_seq_btree, EnumBySeqFun, + couch_btree:foldl(Db#db.docinfo_by_seq_btree, EnumBySeqFun, {NewDb, [], 0}, [{start_key, NewDb#db.update_seq + 1}]), Modified: couchdb/branches/0.11.x/src/couchdb/couch_doc.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_doc.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_doc.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_doc.erl Wed Jun 2 12:56:04 2010 @@ -92,7 +92,7 @@ to_json_attachments(Atts, RevPosIncludeA {<<"content_type">>, Att#att.type}, {<<"revpos">>, Att#att.revpos} ] ++ - if Att#att.revpos > RevPosIncludeAfter -> + if Att#att.revpos > RevPosIncludeAfter -> if DataToFollow -> [{<<"length">>, DiskLen}, {<<"follows">>, true}]; true -> @@ -102,7 +102,7 @@ to_json_attachments(Atts, RevPosIncludeA _ -> att_to_iolist(Att) end, - [{<<"data">>, + [{<<"data">>, couch_util:encodeBase64(AttData)}] end; true -> @@ -202,7 +202,7 @@ transfer_fields([{<<"_attachments">>, {J case proplists:get_value(<<"follows">>, BinProps) of true -> Len = proplists:get_value(<<"length">>, BinProps), - #att{name=Name, data=follows, type=Type, + #att{name=Name, data=follows, type=Type, att_len=Len, disk_len=Len, revpos=RevPos}; _ -> Value = proplists:get_value(<<"data">>, BinProps), @@ -354,7 +354,7 @@ len_doc_to_multi_part_stream(Boundary,Js size(Boundary) + + lists:foldl(fun(#att{revpos=RevPos,disk_len=DiskLen}, AccAttsSize) -> if RevPos > AttsSinceRevPos -> - AccAttsSize + + AccAttsSize + 4 + % "\r\n\r\n" DiskLen + 4 + % "\r\n--" @@ -373,7 +373,7 @@ doc_to_multi_part_stream(Boundary,JsonBy atts_to_mp([], _Boundary, WriteFun, _AttsSinceRevPos) -> WriteFun(<<"--">>); -atts_to_mp([#att{revpos=RevPos} = Att | RestAtts], Boundary, WriteFun, +atts_to_mp([#att{revpos=RevPos} = Att | RestAtts], Boundary, WriteFun, AttsSinceRevPos) when RevPos > AttsSinceRevPos -> WriteFun(<<"\r\n\r\n">>), AttFun = case Att#att.comp of @@ -390,7 +390,7 @@ atts_to_mp([_ | RestAtts], Boundary, Wri doc_from_multi_part_stream(ContentType, DataFun) -> - Parser = spawn_link(fun() -> + Parser = spawn_link(fun() -> couch_httpd:parse_multipart_request(ContentType, DataFun, fun(Next)-> mp_parse_doc(Next, []) end) end), Modified: couchdb/branches/0.11.x/src/couchdb/couch_file.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_file.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_file.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_file.erl Wed Jun 2 12:56:04 2010 @@ -88,7 +88,7 @@ append_binary(Fd, Bin) -> append_binary_md5(Fd, Bin) -> Size = iolist_size(Bin), - gen_server:call(Fd, {append_bin, + gen_server:call(Fd, {append_bin, [<<1:1/integer,Size:31/integer>>, erlang:md5(Bin), Bin]}, infinity). @@ -127,11 +127,11 @@ pread_iolist(Fd, Pos) -> case erlang:md5(IoList) of Md5 -> ok; _ -> throw(file_corruption) - end, + end, {ok, IoList}; <<0:1/integer,Len:31/integer>> -> {ok, Iolist, _} = read_raw_iolist(Fd, NextPos, Len), - {ok, Iolist} + {ok, Iolist} end. Modified: couchdb/branches/0.11.x/src/couchdb/couch_httpd.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_httpd.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_httpd.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_httpd.erl Wed Jun 2 12:56:04 2010 @@ -345,7 +345,7 @@ absolute_uri(#httpd{mochi_req=MochiReq}, Host = case MochiReq:get_header_value(XHost) of undefined -> case MochiReq:get_header_value("Host") of - undefined -> + undefined -> {ok, {Address, Port}} = inet:sockname(MochiReq:get(socket)), inet_parse:ntoa(Address) ++ ":" ++ integer_to_list(Port); Value1 -> @@ -575,11 +575,11 @@ start_jsonp(Req) -> try % make sure jsonp is configured on (default off) case couch_config:get("httpd", "allow_jsonp", "false") of - "true" -> + "true" -> validate_callback(CallBack), CallBack ++ "("; - _Else -> - % this could throw an error message, but instead we just ignore the + _Else -> + % this could throw an error message, but instead we just ignore the % jsonp parameter % throw({bad_request, <<"JSONP must be configured before using.">>}) put(jsonp, no_jsonp), @@ -737,9 +737,9 @@ parse_multipart_request(ContentType, Dat buffer= <<>>, data_fun=DataFun, callback=Callback}, - {Mp2, _NilCallback} = read_until(Mp, <<"--", Boundary0/binary>>, + {Mp2, _NilCallback} = read_until(Mp, <<"--", Boundary0/binary>>, fun(Next)-> nil_callback(Next) end), - #mp{buffer=Buffer, data_fun=DataFun2, callback=Callback2} = + #mp{buffer=Buffer, data_fun=DataFun2, callback=Callback2} = parse_part_header(Mp2), {Buffer, DataFun2, Callback2}. Modified: couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl Wed Jun 2 12:56:04 2010 @@ -100,18 +100,18 @@ default_authentication_handler(Req) -> null_authentication_handler(Req) -> Req#httpd{user_ctx=#user_ctx{roles=[<<"_admin">>]}}. -%% @doc proxy auth handler. +%% @doc proxy auth handler. % -% This handler allows creation of a userCtx object from a user authenticated remotly. -% The client just pass specific headers to CouchDB and the handler create the userCtx. +% This handler allows creation of a userCtx object from a user authenticated remotly. +% The client just pass specific headers to CouchDB and the handler create the userCtx. % Headers name can be defined in local.ini. By thefault they are : % -% * X-Auth-CouchDB-UserName : contain the username, (x_auth_username in +% * X-Auth-CouchDB-UserName : contain the username, (x_auth_username in % couch_httpd_auth section) -% * X-Auth-CouchDB-Roles : contain the user roles, list of roles separated by a +% * X-Auth-CouchDB-Roles : contain the user roles, list of roles separated by a % comma (x_auth_roles in couch_httpd_auth section) -% * X-Auth-CouchDB-Token : token to authenticate the authorization (x_auth_token -% in couch_httpd_auth section). This token is an hmac-sha1 created from secret key +% * X-Auth-CouchDB-Token : token to authenticate the authorization (x_auth_token +% in couch_httpd_auth section). This token is an hmac-sha1 created from secret key % and username. The secret key should be the same in the client and couchdb node. s % ecret key is the secret key in couch_httpd_auth section of ini. This token is optional % if value of proxy_use_secret key in couch_httpd_auth section of ini isn't true. @@ -127,14 +127,14 @@ proxy_auth_user(Req) -> "X-Auth-CouchDB-UserName"), XHeaderRoles = couch_config:get("couch_httpd_auth", "x_auth_roles", "X-Auth-CouchDB-Roles"), - XHeaderToken = couch_config:get("couch_httpd_auth", "x_auth_token", + XHeaderToken = couch_config:get("couch_httpd_auth", "x_auth_token", "X-Auth-CouchDB-Token"), case header_value(Req, XHeaderUserName) of undefined -> nil; UserName -> Roles = case header_value(Req, XHeaderRoles) of undefined -> []; - Else -> + Else -> [?l2b(R) || R <- string:tokens(Else, ",")] end, case couch_config:get("couch_httpd_auth", "proxy_use_secret", "false") of @@ -153,7 +153,7 @@ proxy_auth_user(Req) -> end; _ -> Req#httpd{user_ctx=#user_ctx{name=?l2b(UserName), roles=Roles}} - end + end end. % maybe we can use hovercraft to simplify running this view query @@ -165,7 +165,7 @@ get_user(UserName) -> % which has a matching name, salt, and password_sha [HashedPwd, Salt] = string:tokens(HashedPwdAndSalt, ","), case get_user_props_from_db(UserName) of - nil -> + nil -> [{<<"roles">>, [<<"_admin">>]}, {<<"salt">>, ?l2b(Salt)}, {<<"password_sha">>, ?l2b(HashedPwd)}]; @@ -187,12 +187,12 @@ get_user_props_from_db(UserName) -> #doc{meta=Meta}=Doc -> % check here for conflict state and throw error if conflicted case proplists:get_value(conflicts,Meta,[]) of - [] -> + [] -> {DocProps} = couch_query_servers:json_doc(Doc), case proplists:get_value(<<"type">>, DocProps) of <<"user">> -> DocProps; - _Else -> + _Else -> ?LOG_ERROR("Invalid user doc. Id: ~p",[DocId]), nil end; @@ -212,17 +212,17 @@ ensure_users_db_exists(DbName) -> {ok, Db} -> ensure_auth_ddoc_exists(Db, <<"_design/_auth">>), {ok, Db}; - _Error -> + _Error -> {ok, Db} = couch_db:create(DbName, [{user_ctx, #user_ctx{roles=[<<"_admin">>]}}]), ensure_auth_ddoc_exists(Db, <<"_design/_auth">>), {ok, Db} end. -ensure_auth_ddoc_exists(Db, DDocId) -> +ensure_auth_ddoc_exists(Db, DDocId) -> try couch_httpd_db:couch_doc_open(Db, DDocId, nil, []) of _Foo -> ok - catch - _:_Error -> + catch + _:_Error -> % create the design document {ok, AuthDesign} = auth_design_doc(DDocId), {ok, _Rev} = couch_db:update_doc(Db, AuthDesign, []), @@ -241,7 +241,7 @@ auth_design_doc(DocId) -> throw({forbidden : 'doc.type must be user'}); } // we only validate user docs for now if (newDoc._deleted === true) { - // allow deletes by admins and matching users + // allow deletes by admins and matching users // without checking the other fields if ((userCtx.roles.indexOf('_admin') != -1) || (userCtx.name == oldDoc.name)) { return; @@ -304,7 +304,7 @@ cookie_authentication_handler(#httpd{moc case MochiReq:get_cookie_value("AuthSession") of undefined -> Req; [] -> Req; - Cookie -> + Cookie -> [User, TimeStr | HashParts] = try AuthSession = couch_util:decodeBase64Url(Cookie), [_A, _B | _Cs] = string:tokens(?b2l(AuthSession), ":") @@ -317,7 +317,7 @@ cookie_authentication_handler(#httpd{moc {NowMS, NowS, _} = erlang:now(), CurrentTime = NowMS * 1000000 + NowS, case couch_config:get("couch_httpd_auth", "secret", nil) of - nil -> + nil -> ?LOG_ERROR("cookie auth secret is not set",[]), Req; SecretStr -> @@ -457,7 +457,7 @@ handle_session_req(#httpd{method='GET', {authentication_db, ?l2b(couch_config:get("couch_httpd_auth", "authentication_db"))}, {authentication_handlers, [auth_name(H) || H <- couch_httpd:make_fun_spec_strs( couch_config:get("httpd", "authentication_handlers"))]} - ] ++ maybe_value(authenticated, UserCtx#user_ctx.handler, fun(Handler) -> + ] ++ maybe_value(authenticated, UserCtx#user_ctx.handler, fun(Handler) -> auth_name(?b2l(Handler)) end)}} ]}) @@ -476,7 +476,7 @@ handle_session_req(Req) -> send_method_not_allowed(Req, "GET,HEAD,POST,DELETE"). maybe_value(_Key, undefined, _Fun) -> []; -maybe_value(Key, Else, Fun) -> +maybe_value(Key, Else, Fun) -> [{Key, Fun(Else)}]. auth_name(String) when is_list(String) -> @@ -484,7 +484,7 @@ auth_name(String) when is_list(String) - ?l2b(Name). to_int(Value) when is_binary(Value) -> - to_int(?b2l(Value)); + to_int(?b2l(Value)); to_int(Value) when is_list(Value) -> list_to_integer(Value); to_int(Value) when is_integer(Value) -> Modified: couchdb/branches/0.11.x/src/couchdb/couch_httpd_db.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_httpd_db.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_httpd_db.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_httpd_db.erl Wed Jun 2 12:56:04 2010 @@ -162,7 +162,7 @@ create_db_req(#httpd{user_ctx=UserCtx}=R ok = couch_httpd:verify_is_server_admin(Req), LDbName = ?b2l(DbName), case couch_config:get("couch_httpd_auth", "authentication_db") of - LDbName -> + LDbName -> % make sure user's db always has the auth ddoc {ok, Db} = couch_httpd_auth:ensure_users_db_exists(DbName), couch_db:close(Db), @@ -192,7 +192,7 @@ do_db_req(#httpd{user_ctx=UserCtx,path_p LDbName = ?b2l(DbName), % I hope this lookup is cheap. case couch_config:get("couch_httpd_auth", "authentication_db") of - LDbName -> + LDbName -> % make sure user's db always has the auth ddoc {ok, ADb} = couch_httpd_auth:ensure_users_db_exists(DbName), couch_db:close(ADb); @@ -329,7 +329,7 @@ db_req(#httpd{method='POST',path_parts=[ send_json(Req, 417, ErrorsJson) end; false -> - Docs = lists:map(fun(JsonObj) -> + Docs = lists:map(fun(JsonObj) -> Doc = couch_doc:from_json_obj(JsonObj), validate_attachment_names(Doc), Doc @@ -390,17 +390,17 @@ db_req(#httpd{path_parts=[_,<<"_missing_ db_req(#httpd{method='POST',path_parts=[_,<<"_revs_diff">>]}=Req, Db) -> {JsonDocIdRevs} = couch_httpd:json_body_obj(Req), - JsonDocIdRevs2 = + JsonDocIdRevs2 = [{Id, couch_doc:parse_revs(RevStrs)} || {Id, RevStrs} <- JsonDocIdRevs], {ok, Results} = couch_db:get_missing_revs(Db, JsonDocIdRevs2), - Results2 = + Results2 = lists:map(fun({Id, MissingRevs, PossibleAncestors}) -> {Id, - {[{missing, couch_doc:revs_to_strs(MissingRevs)}] ++ + {[{missing, couch_doc:revs_to_strs(MissingRevs)}] ++ if PossibleAncestors == [] -> []; - true -> - [{possible_ancestors, + true -> + [{possible_ancestors, couch_doc:revs_to_strs(PossibleAncestors)}] end}} end, Results), @@ -548,11 +548,11 @@ db_doc_req(#httpd{method='DELETE'}=Req, couch_doc_open(Db, DocId, nil, []), case couch_httpd:qs_value(Req, "rev") of undefined -> - update_doc(Req, Db, DocId, + update_doc(Req, Db, DocId, couch_doc_from_req(Req, DocId, {[{<<"_deleted">>,true}]})); Rev -> - update_doc(Req, Db, DocId, - couch_doc_from_req(Req, DocId, + update_doc(Req, Db, DocId, + couch_doc_from_req(Req, DocId, {[{<<"_rev">>, ?l2b(Rev)},{<<"_deleted">>,true}]})) end; @@ -716,7 +716,7 @@ send_doc(Req, Doc, Options) -> [] -> DiskEtag = couch_httpd:doc_etag(Doc), % output etag only when we have no meta - couch_httpd:etag_respond(Req, DiskEtag, fun() -> + couch_httpd:etag_respond(Req, DiskEtag, fun() -> send_doc_efficiently(Req, Doc, [{"Etag", DiskEtag}], Options) end); _ -> @@ -727,7 +727,7 @@ send_doc(Req, Doc, Options) -> send_doc_efficiently(Req, #doc{atts=[]}=Doc, Headers, Options) -> send_json(Req, 200, Headers, couch_doc:to_json_obj(Doc, Options)); send_doc_efficiently(Req, #doc{atts=Atts}=Doc, Headers, Options) -> - case lists:member(attachments, Options) orelse + case lists:member(attachments, Options) orelse proplists:is_defined(atts_after_revpos, Options) of true -> AcceptedTypes = case couch_httpd:header_value(Req, "Accept") of @@ -743,7 +743,7 @@ send_doc_efficiently(Req, #doc{atts=Atts AttsSinceRevPos = proplists:get_value(atts_after_revpos, Options, 0), Len = couch_doc:len_doc_to_multi_part_stream(Boundary,JsonBytes,Atts, AttsSinceRevPos), - CType = {<<"Content-Type">>, + CType = {<<"Content-Type">>, <<"multipart/related; boundary=\"", Boundary/binary, "\"">>}, {ok, Resp} = start_response_length(Req, 200, [CType|Headers], Len), couch_doc:doc_to_multi_part_stream(Boundary,JsonBytes,Atts, Modified: couchdb/branches/0.11.x/src/couchdb/couch_httpd_oauth.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_httpd_oauth.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_httpd_oauth.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_httpd_oauth.erl Wed Jun 2 12:56:04 2010 @@ -20,7 +20,7 @@ oauth_authentication_handler(#httpd{moch serve_oauth(Req, fun(URL, Params, Consumer, Signature) -> AccessToken = proplists:get_value("oauth_token", Params), case couch_config:get("oauth_token_secrets", AccessToken) of - undefined -> + undefined -> couch_httpd:send_error(Req, 400, <<"invalid_token">>, <<"Invalid OAuth token.">>); TokenSecret -> Modified: couchdb/branches/0.11.x/src/couchdb/couch_httpd_show.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_httpd_show.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_httpd_show.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_httpd_show.erl Wed Jun 2 12:56:04 2010 @@ -24,7 +24,7 @@ % /db/_design/foo/_show/bar/docid -% show converts a json doc to a response of any content-type. +% show converts a json doc to a response of any content-type. % it looks up the doc an then passes it to the query server. % then it sends the response from the query server to the http client. @@ -77,7 +77,7 @@ handle_doc_show(Req, Db, DDoc, ShowName, couch_httpd:etag_respond(Req, CurrentEtag, fun() -> JsonReq = couch_httpd_external:json_req_obj(Req, Db, DocId), JsonDoc = couch_query_servers:json_doc(Doc), - [<<"resp">>, ExternalResp] = + [<<"resp">>, ExternalResp] = couch_query_servers:ddoc_prompt(DDoc, [<<"shows">>, ShowName], [JsonDoc, JsonReq]), JsonResp = apply_etag(ExternalResp, CurrentEtag), couch_httpd_external:send_external_response(Req, JsonResp) @@ -183,10 +183,10 @@ handle_view_list_req(Req, _Db, _DDoc) -> handle_view_list(Req, Db, DDoc, LName, {ViewDesignName, ViewName}, Keys) -> ViewDesignId = <<"_design/", ViewDesignName/binary>>, {ViewType, View, Group, QueryArgs} = couch_httpd_view:load_view(Req, Db, {ViewDesignId, ViewName}, Keys), - Etag = list_etag(Req, Db, Group, {couch_httpd:doc_etag(DDoc), Keys}), + Etag = list_etag(Req, Db, Group, {couch_httpd:doc_etag(DDoc), Keys}), couch_httpd:etag_respond(Req, Etag, fun() -> output_list(ViewType, Req, Db, DDoc, LName, View, QueryArgs, Etag, Keys) - end). + end). list_etag(#httpd{user_ctx=UserCtx}=Req, Db, Group, More) -> Accept = couch_httpd:header_value(Req, "Accept"), @@ -215,12 +215,12 @@ output_map_list(Req, Db, DDoc, LName, Vi reduce_count = fun couch_view:reduce_to_count/1, start_response = StartListRespFun = make_map_start_resp_fun(QServer, Db, LName), send_row = make_map_send_row_fun(QServer) - }, + }, {ok, _, FoldResult} = case Keys of nil -> - FoldlFun = couch_httpd_view:make_view_fold_fun(Req, QueryArgs, Etag, Db, RowCount, ListFoldHelpers), - couch_view:fold(View, FoldlFun, FoldAccInit, + FoldlFun = couch_httpd_view:make_view_fold_fun(Req, QueryArgs, Etag, Db, RowCount, ListFoldHelpers), + couch_view:fold(View, FoldlFun, FoldAccInit, couch_httpd_view:make_key_options(QueryArgs)); Keys -> lists:foldl( @@ -257,16 +257,16 @@ output_reduce_list(Req, Db, DDoc, LName, FoldAccInit = {Limit, SkipCount, undefined, []}, {ok, FoldResult} = case Keys of nil -> - couch_view:fold_reduce(View, RespFun, FoldAccInit, [{key_group_fun, GroupRowsFun} | + couch_view:fold_reduce(View, RespFun, FoldAccInit, [{key_group_fun, GroupRowsFun} | couch_httpd_view:make_key_options(QueryArgs)]); Keys -> lists:foldl( fun(Key, {ok, FoldAcc}) -> couch_view:fold_reduce(View, RespFun, FoldAcc, - [{key_group_fun, GroupRowsFun} | + [{key_group_fun, GroupRowsFun} | couch_httpd_view:make_key_options( QueryArgs#view_query_args{start_key=Key, end_key=Key})] - ) + ) end, {ok, FoldAccInit}, Keys) end, finish_list(Req, QServer, Etag, FoldResult, StartListRespFun, null) @@ -286,7 +286,7 @@ make_reduce_start_resp_fun(QueryServer, start_list_resp(QServer, LName, Req, Db, Head, Etag) -> JsonReq = couch_httpd_external:json_req_obj(Req, Db), - [<<"start">>,Chunks,JsonResp] = couch_query_servers:ddoc_proc_prompt(QServer, + [<<"start">>,Chunks,JsonResp] = couch_query_servers:ddoc_proc_prompt(QServer, [<<"lists">>, LName], [Head, JsonReq]), JsonResp2 = apply_etag(JsonResp, Etag), #extern_resp_args{ @@ -351,7 +351,7 @@ finish_list(Req, {Proc, _DDocId}, Etag, {_, _, undefined, _, _} -> {ok, Resp, BeginBody} = render_head_for_empty_list(StartFun, Req, Etag, TotalRows), - [<<"end">>, Chunks] = couch_query_servers:proc_prompt(Proc, [<<"list_end">>]), + [<<"end">>, Chunks] = couch_query_servers:proc_prompt(Proc, [<<"list_end">>]), Chunk = BeginBody ++ ?b2l(?l2b(Chunks)), send_non_empty_chunk(Resp, Chunk); {_, _, Resp, stop, _} -> Modified: couchdb/branches/0.11.x/src/couchdb/couch_httpd_view.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_httpd_view.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_httpd_view.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_httpd_view.erl Wed Jun 2 12:56:04 2010 @@ -114,9 +114,9 @@ output_map_view(Req, View, Group, Db, Qu {ok, RowCount} = couch_view:get_row_count(View), FoldlFun = make_view_fold_fun(Req, QueryArgs, CurrentEtag, Db, RowCount, #view_fold_helper_funs{reduce_count=fun couch_view:reduce_to_count/1}), FoldAccInit = {Limit, SkipCount, undefined, []}, - {ok, LastReduce, FoldResult} = couch_view:fold(View, + {ok, LastReduce, FoldResult} = couch_view:fold(View, FoldlFun, FoldAccInit, make_key_options(QueryArgs)), - finish_view_fold(Req, RowCount, + finish_view_fold(Req, RowCount, couch_view:reduce_to_count(LastReduce), FoldResult) end); @@ -137,7 +137,7 @@ output_map_view(Req, View, Group, Db, Qu #view_fold_helper_funs{ reduce_count = fun couch_view:reduce_to_count/1 }), - {ok, LastReduce, FoldResult} = couch_view:fold(View, FoldlFun, FoldAcc, + {ok, LastReduce, FoldResult} = couch_view:fold(View, FoldlFun, FoldAcc, make_key_options(QueryArgs#view_query_args{start_key=Key, end_key=Key})), {LastReduce, FoldResult} end, {{[],[]}, FoldAccInit}, Keys), @@ -210,7 +210,7 @@ load_view(Req, Db, {ViewDesignId, ViewNa MapView = couch_view:extract_map_view(ReduceView), {map, MapView, Group, QueryArgs}; _ -> - QueryArgs = couch_httpd_view:parse_view_params(Req, Keys, reduce), + QueryArgs = couch_httpd_view:parse_view_params(Req, Keys, reduce), {reduce, ReduceView, Group, QueryArgs} end; {not_found, Reason} -> @@ -512,7 +512,7 @@ apply_default_helper_funs(#reduce_fold_h }. make_key_options(#view_query_args{direction = Dir}=QueryArgs) -> - [{dir,Dir} | make_start_key_option(QueryArgs) ++ + [{dir,Dir} | make_start_key_option(QueryArgs) ++ make_end_key_option(QueryArgs)]. make_start_key_option( Modified: couchdb/branches/0.11.x/src/couchdb/couch_key_tree.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_key_tree.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_key_tree.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_key_tree.erl Wed Jun 2 12:56:04 2010 @@ -290,7 +290,7 @@ map(Fun, [{Pos, Tree}|Rest]) -> map_simple(_Fun, _Pos, []) -> []; map_simple(Fun, Pos, [{Key, Value, SubTree} | RestTree]) -> - Value2 = Fun({Pos, Key}, Value, + Value2 = Fun({Pos, Key}, Value, if SubTree == [] -> leaf; true -> branch end), [{Key, Value2, map_simple(Fun, Pos + 1, SubTree)} | map_simple(Fun, Pos, RestTree)]. Modified: couchdb/branches/0.11.x/src/couchdb/couch_native_process.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_native_process.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_native_process.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_native_process.erl Wed Jun 2 12:56:04 2010 @@ -1,16 +1,16 @@ -% Licensed under the Apache License, Version 2.0 (the "License"); -% you may not use this file except in compliance with the License. +% Licensed under the Apache License, Version 2.0 (the "License"); +% you may not use this file except in compliance with the License. % % You may obtain a copy of the License at % http://www.apache.org/licenses/LICENSE-2.0 % -% Unless required by applicable law or agreed to in writing, -% software distributed under the License is distributed on an -% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -% either express or implied. +% Unless required by applicable law or agreed to in writing, +% software distributed under the License is distributed on an +% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +% either express or implied. % % See the License for the specific language governing permissions -% and limitations under the License. +% and limitations under the License. % % This file drew much inspiration from erlview, which was written by and % copyright Michael McDaniel [http://autosys.us], and is also under APL 2.0 @@ -32,7 +32,7 @@ % which should be roughly the same as the javascript: % emit(doc._id, null); % -% This module exposes enough functions such that a native erlang server can +% This module exposes enough functions such that a native erlang server can % act as a fully-fleged view server, but no 'helper' functions specifically % for simplifying your erlang view code. It is expected other third-party % extensions will evolve which offer useful layers on top of this view server @@ -370,7 +370,7 @@ start_list_resp(Self, Sig) -> undefined -> {[{<<"headers">>, {[]}}]}; CurrHdrs -> CurrHdrs end, - Chunks = + Chunks = case erlang:get(Sig) of undefined -> []; CurrChunks -> CurrChunks Modified: couchdb/branches/0.11.x/src/couchdb/couch_query_servers.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_query_servers.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_query_servers.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_query_servers.erl Wed Jun 2 12:56:04 2010 @@ -90,7 +90,7 @@ group_reductions_results(List) -> rereduce(_Lang, [], _ReducedValues) -> {ok, []}; rereduce(Lang, RedSrcs, ReducedValues) -> - Grouped = group_reductions_results(ReducedValues), + Grouped = group_reductions_results(ReducedValues), Results = lists:zipwith( fun (<<"_", _/binary>> = FunSrc, Values) -> @@ -165,7 +165,7 @@ builtin_sum_rows(KVs) -> % use the function stored in ddoc.validate_doc_update to test an update. validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) -> JsonEditDoc = couch_doc:to_json_obj(EditDoc, [revs]), - JsonDiskDoc = json_doc(DiskDoc), + JsonDiskDoc = json_doc(DiskDoc), case ddoc_prompt(DDoc, [<<"validate_doc_update">>], [JsonEditDoc, JsonDiskDoc, Ctx, SecObj]) of 1 -> ok; @@ -190,7 +190,7 @@ filter_docs(Req, Db, DDoc, FName, Docs) [true, Passes] = ddoc_prompt(DDoc, [<<"filters">>, FName], [JsonDocs, JsonReq]), {ok, Passes}. -ddoc_proc_prompt({Proc, DDocId}, FunPath, Args) -> +ddoc_proc_prompt({Proc, DDocId}, FunPath, Args) -> proc_prompt(Proc, [<<"ddoc">>, DDocId, FunPath, Args]). ddoc_prompt(DDoc, FunPath, Args) -> @@ -250,7 +250,7 @@ terminate(_Reason, {_Langs, PidProcs, _L handle_call({get_proc, #doc{body={Props}}=DDoc, DDocKey}, _From, {Langs, PidProcs, LangProcs}=Server) -> % Note to future self. Add max process limit. - Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>), + Lang = proplists:get_value(<<"language">>, Props, <<"javascript">>), case ets:lookup(LangProcs, Lang) of [{Lang, [P|Rest]}] -> % find a proc in the set that has the DDoc @@ -258,7 +258,7 @@ handle_call({get_proc, #doc{body={Props} {ok, Proc} -> rem_from_list(LangProcs, Lang, Proc), {reply, {ok, Proc, get_query_server_config()}, Server}; - Error -> + Error -> {reply, Error, Server} end; _ -> @@ -268,7 +268,7 @@ handle_call({get_proc, #doc{body={Props} case proc_with_ddoc(DDoc, DDocKey, [Proc]) of {ok, Proc2} -> {reply, {ok, Proc2, get_query_server_config()}, Server}; - Error -> + Error -> {reply, Error, Server} end; Error -> @@ -290,7 +290,7 @@ handle_call({get_proc, Lang}, _From, {La {reply, Error, Server} end end; -handle_call({unlink_proc, Pid}, _From, {_, PidProcs, _}=Server) -> +handle_call({unlink_proc, Pid}, _From, {_, PidProcs, _}=Server) -> rem_value(PidProcs, Pid), unlink(Pid), {reply, ok, Server}; @@ -349,7 +349,7 @@ new_process(Langs, Lang) -> end. proc_with_ddoc(DDoc, DDocKey, LangProcs) -> - DDocProcs = lists:filter(fun(#proc{ddoc_keys=Keys}) -> + DDocProcs = lists:filter(fun(#proc{ddoc_keys=Keys}) -> lists:any(fun(Key) -> Key == DDocKey end, Keys) Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_rep.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_rep.erl Wed Jun 2 12:56:04 2010 @@ -12,7 +12,7 @@ -module(couch_rep). -behaviour(gen_server). --export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -export([replicate/2, checkpoint/1]). @@ -442,7 +442,7 @@ has_session_id(SessionId, [{Props} | Res maybe_append_options(Options, Props) -> lists:foldl(fun(Option, Acc) -> - Acc ++ + Acc ++ case proplists:get_value(Option, Props, false) of true -> "+" ++ ?b2l(Option); @@ -456,7 +456,7 @@ make_replication_id({Props}, UserCtx) -> {ok, HostName} = inet:gethostname(), % Port = mochiweb_socket_server:get(couch_httpd, port), Src = get_rep_endpoint(UserCtx, proplists:get_value(<<"source">>, Props)), - Tgt = get_rep_endpoint(UserCtx, proplists:get_value(<<"target">>, Props)), + Tgt = get_rep_endpoint(UserCtx, proplists:get_value(<<"target">>, Props)), Base = [HostName, Src, Tgt] ++ case proplists:get_value(<<"filter">>, Props) of undefined -> @@ -536,7 +536,7 @@ open_db(<<"https://",_/binary>>=Url, _, open_db({[{<<"url">>,Url}]}, [], CreateTarget); open_db(<>, UserCtx, CreateTarget) -> case CreateTarget of - true -> + true -> ok = couch_httpd:verify_is_server_admin(UserCtx), couch_server:create(DbName, [{user_ctx, UserCtx}]); false -> ok @@ -591,7 +591,7 @@ do_checkpoint(State) -> {<<"missing_found">>, ets:lookup_element(Stats, missing_revs, 2)}, {<<"docs_read">>, ets:lookup_element(Stats, docs_read, 2)}, {<<"docs_written">>, ets:lookup_element(Stats, docs_written, 2)}, - {<<"doc_write_failures">>, + {<<"doc_write_failures">>, ets:lookup_element(Stats, doc_write_failures, 2)} ]}, % limit history to 50 entries Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep_att.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep_att.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_rep_att.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_rep_att.erl Wed Jun 2 12:56:04 2010 @@ -29,11 +29,11 @@ convert_stub(#att{data=stub, name=Name} Attachment#att{data=RcvFun}. cleanup() -> - receive + receive {ibrowse_async_response, _, _} -> %% TODO maybe log, didn't expect to have data here cleanup(); - {ibrowse_async_response_end, _} -> + {ibrowse_async_response_end, _} -> cleanup(); {ibrowse_async_headers, _, _, _} -> cleanup() Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_rep_changes_feed.erl Wed Jun 2 12:56:04 2010 @@ -12,7 +12,7 @@ -module(couch_rep_changes_feed). -behaviour(gen_server). --export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -export([start_link/4, next/1, stop/1]). @@ -383,6 +383,6 @@ start_http_request(RawUrl) -> {inactivity_timeout, 31000}, {response_format, binary} ], - {ibrowse_req_id, Id} = + {ibrowse_req_id, Id} = ibrowse:send_req_direct(Pid, RawUrl, [], get, [], Opts, infinity), {Pid, Id}. Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep_httpc.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep_httpc.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_rep_httpc.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_rep_httpc.erl Wed Jun 2 12:56:04 2010 @@ -46,7 +46,7 @@ do_request(Req) -> nil -> []; _Else -> - iolist_to_binary(?JSON_ENCODE(B)) + iolist_to_binary(?JSON_ENCODE(B)) end, Resp = case Conn of nil -> @@ -115,7 +115,7 @@ full_url(Req) -> resource = Resource, qs = QS } = Req, - QStr = lists:map(fun({K,V}) -> io_lib:format("~s=~s", + QStr = lists:map(fun({K,V}) -> io_lib:format("~s=~s", [couch_util:to_list(K), couch_util:to_list(V)]) end, QS), lists:flatten([Url, Resource, "?", string:join(QStr, "&")]). Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep_missing_revs.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep_missing_revs.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_rep_missing_revs.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_rep_missing_revs.erl Wed Jun 2 12:56:04 2010 @@ -12,7 +12,7 @@ -module(couch_rep_missing_revs). -behaviour(gen_server). --export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -export([start_link/4, next/1, stop/1]). Modified: couchdb/branches/0.11.x/src/couchdb/couch_rep_reader.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_rep_reader.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_rep_reader.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_rep_reader.erl Wed Jun 2 12:56:04 2010 @@ -12,7 +12,7 @@ -module(couch_rep_reader). -behaviour(gen_server). --export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, +-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). -export([start_link/4, next/1]). Modified: couchdb/branches/0.11.x/src/couchdb/couch_server.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_server.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_server.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_server.erl Wed Jun 2 12:56:04 2010 @@ -108,7 +108,7 @@ hash_admin_passwords(Persist) -> ({User, ClearPassword}) -> Salt = ?b2l(couch_uuids:random()), Hashed = couch_util:to_hex(crypto:sha(ClearPassword ++ Salt)), - couch_config:set("admins", + couch_config:set("admins", User, "-hashed-" ++ Hashed ++ "," ++ Salt, Persist) end, couch_config:get("admins")). @@ -148,7 +148,7 @@ init([]) -> start_time=httpd_util:rfc1123_date()}}. terminate(_Reason, _Srv) -> - [couch_util:shutdown_sync(Pid) || {_, {Pid, _LruTime}} <- + [couch_util:shutdown_sync(Pid) || {_, {Pid, _LruTime}} <- ets:tab2list(couch_dbs_by_name)], ok. @@ -232,7 +232,7 @@ handle_call({open_result, DbName, {ok, O link(OpenedDbPid), [{DbName, {opening,Opener,Froms}}] = ets:lookup(couch_dbs_by_name, DbName), lists:foreach(fun({FromPid,_}=From) -> - gen_server:reply(From, + gen_server:reply(From, catch couch_db:open_ref_counted(OpenedDbPid, FromPid)) end, Froms), LruTime = now(), @@ -242,11 +242,11 @@ handle_call({open_result, DbName, {ok, O true = ets:insert(couch_dbs_by_pid, {OpenedDbPid, DbName}), true = ets:insert(couch_dbs_by_lru, {LruTime, DbName}), {reply, ok, Server}; -handle_call({open_result, DbName, Error}, _From, Server) -> +handle_call({open_result, DbName, Error}, _From, Server) -> [{DbName, {opening,Opener,Froms}}] = ets:lookup(couch_dbs_by_name, DbName), lists:foreach(fun(From) -> gen_server:reply(From, Error) - end, Froms), + end, Froms), true = ets:delete(couch_dbs_by_name, DbName), true = ets:delete(couch_dbs_by_pid, Opener), {reply, ok, Server#server{dbs_open=Server#server.dbs_open - 1}}; Modified: couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl?rev=950547&r1=950546&r2=950547&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl Wed Jun 2 12:56:04 2010 @@ -178,7 +178,7 @@ handle_cast({compact_done, #group{curren when NewSeq >= OldSeq -> #group_state{ group = #group{name=GroupId, fd=OldFd, sig=GroupSig} = Group, - init_args = {RootDir, DbName, _}, + init_args = {RootDir, DbName, _}, updater_pid = UpdaterPid, ref_counter = RefCounter } = State,