summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/couchdb/couch_doc.erl2
-rw-r--r--src/couchdb/couch_httpd.erl2
-rw-r--r--src/couchdb/couch_httpd_auth.erl18
-rw-r--r--src/couchdb/couch_httpd_db.erl13
-rw-r--r--src/couchdb/couch_native_process.erl21
-rw-r--r--src/couchdb/couch_query_servers.erl5
-rw-r--r--src/couchdb/couch_rep_reader.erl2
7 files changed, 24 insertions, 39 deletions
diff --git a/src/couchdb/couch_doc.erl b/src/couchdb/couch_doc.erl
index bbcbd0ba..efb0f6a5 100644
--- a/src/couchdb/couch_doc.erl
+++ b/src/couchdb/couch_doc.erl
@@ -295,7 +295,7 @@ att_to_iolist(#att{data=Bin}) when is_binary(Bin) ->
Bin;
att_to_iolist(#att{data=Iolist}) when is_list(Iolist) ->
Iolist;
-att_to_iolist(#att{data={Fd,Sp}}=Att) ->
+att_to_iolist(#att{data={_Fd,_Sp}}=Att) ->
lists:reverse(att_foldl(Att,
fun(Bin,Acc) -> [Bin|Acc] end, []));
att_to_iolist(#att{data=DataFun, att_len=Len}) when is_function(DataFun)->
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index a36782db..856ab2a4 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -278,7 +278,7 @@ accepted_encodings(#httpd{mochi_req=MochiReq}) ->
EncList
end.
-serve_file(#httpd{mochi_req=MochiReq}=Req, RelativePath, DocumentRoot) ->
+serve_file(Req, RelativePath, DocumentRoot) ->
serve_file(Req, RelativePath, DocumentRoot, []).
serve_file(#httpd{mochi_req=MochiReq}=Req, RelativePath, DocumentRoot, ExtraHeaders) ->
diff --git a/src/couchdb/couch_httpd_auth.erl b/src/couchdb/couch_httpd_auth.erl
index d1081611..505194a9 100644
--- a/src/couchdb/couch_httpd_auth.erl
+++ b/src/couchdb/couch_httpd_auth.erl
@@ -118,7 +118,7 @@ get_user(UserName) ->
{<<"salt">>, ?l2b(Salt)},
{<<"password_sha">>, ?l2b(HashedPwd)}]
end;
- Else ->
+ _Else ->
get_user_props_from_db(UserName)
end.
@@ -139,12 +139,12 @@ get_user_props_from_db(UserName) ->
?LOG_ERROR("Invalid user doc. Id: ~p",[DocId]),
nil
end;
- Else ->
+ _Else ->
throw({unauthorized, <<"User document conflict must be resolved before login.">>})
end
catch
- throw:Throw ->
- nil
+ throw:_Throw ->
+ nil
end.
% this should handle creating the ddoc
@@ -163,7 +163,7 @@ ensure_auth_ddoc_exists(Db, DDocId) ->
try couch_httpd_db:couch_doc_open(Db, DDocId, nil, []) of
_Foo -> ok
catch
- _:Error ->
+ _:_Error ->
% create the design document
{ok, AuthDesign} = auth_design_doc(DDocId),
{ok, _Rev} = couch_db:update_doc(Db, AuthDesign, []),
@@ -248,9 +248,9 @@ cookie_authentication_handler(#httpd{mochi_req=MochiReq}=Req) ->
Cookie ->
[User, TimeStr | HashParts] = try
AuthSession = couch_util:decodeBase64Url(Cookie),
- [A, B | Cs] = string:tokens(?b2l(AuthSession), ":")
+ [_A, _B | _Cs] = string:tokens(?b2l(AuthSession), ":")
catch
- _:Error ->
+ _:_Error ->
Reason = <<"Malformed AuthSession cookie. Please clear your cookies.">>,
throw({bad_request, Reason})
end,
@@ -416,11 +416,9 @@ handle_session_req(#httpd{method='DELETE'}=Req) ->
handle_session_req(Req) ->
send_method_not_allowed(Req, "GET,HEAD,POST,DELETE").
-maybe_value(Key, undefined, Fun) -> [];
+maybe_value(_Key, undefined, _Fun) -> [];
maybe_value(Key, Else, Fun) ->
[{Key, Fun(Else)}].
-maybe_value(Key, undefined) -> [];
-maybe_value(Key, Else) -> [{Key, Else}].
auth_name(String) when is_list(String) ->
[_,_,_,_,_,Name|_] = re:split(String, "[\\W_]", [{return, list}]),
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 5421c214..78aa2d2a 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -237,7 +237,7 @@ make_filter_fun(Req, Db) ->
couch_util:get_nested_json_value({Props}, [<<"filters">>, FName]),
fun(DocInfos) ->
Docs = [Doc || {ok, Doc} <- [
- {ok, Doc} = couch_db:open_doc(Db, DInfo, [deleted, conflicts])
+ {ok, _Doc} = couch_db:open_doc(Db, DInfo, [deleted, conflicts])
|| DInfo <- DocInfos]],
{ok, Passes} = couch_query_servers:filter_docs(Req, Db, DDoc, FName, Docs),
[{[{rev, couch_doc:rev_to_str(Rev)}]}
@@ -1154,17 +1154,6 @@ get_md5_header(Req) ->
<<>>
end.
-parse_doc_format(FormatStr) when is_binary(FormatStr) ->
- parse_doc_format(?b2l(FormatStr));
-parse_doc_format(FormatStr) when is_list(FormatStr) ->
- SplitFormat = lists:splitwith(fun($/) -> false; (_) -> true end, FormatStr),
- case SplitFormat of
- {DesignName, [$/ | ShowName]} -> {?l2b(DesignName), ?l2b(ShowName)};
- _Else -> throw({bad_request, <<"Invalid doc format">>})
- end;
-parse_doc_format(_BadFormatStr) ->
- throw({bad_request, <<"Invalid doc format">>}).
-
parse_doc_query(Req) ->
lists:foldl(fun({Key,Value}, Args) ->
case {Key, Value} of
diff --git a/src/couchdb/couch_native_process.erl b/src/couchdb/couch_native_process.erl
index 65e4e131..5600c421 100644
--- a/src/couchdb/couch_native_process.erl
+++ b/src/couchdb/couch_native_process.erl
@@ -40,7 +40,8 @@
-module(couch_native_process).
-behaviour(gen_server).
--export([start_link/0,init/1,terminate/2,handle_call/3,handle_cast/2]).
+-export([start_link/0,init/1,terminate/2,handle_call/3,handle_cast/2,code_change/3,
+ handle_info/2]).
-export([set_timeout/2, prompt/2]).
-define(STATE, native_proc_state).
@@ -76,16 +77,18 @@ handle_call({prompt, Data}, _From, State) ->
throw:{error, Why} ->
{State, [<<"error">>, Why, Why]}
end,
-
+
case Resp of
{error, Reason} ->
Msg = io_lib:format("couch native server error: ~p", [Reason]),
{reply, [<<"error">>, <<"native_query_server">>, list_to_binary(Msg)], NewState};
[<<"error">> | Rest] ->
- Msg = io_lib:format("couch native server error: ~p", [Rest]),
+ % Msg = io_lib:format("couch native server error: ~p", [Rest]),
+ % TODO: markh? (jan)
{reply, [<<"error">> | Rest], NewState};
[<<"fatal">> | Rest] ->
- Msg = io_lib:format("couch native server error: ~p", [Rest]),
+ % Msg = io_lib:format("couch native server error: ~p", [Rest]),
+ % TODO: markh? (jan)
{stop, fatal, [<<"error">> | Rest], NewState};
Resp ->
{reply, Resp, NewState}
@@ -169,11 +172,11 @@ ddoc(State, {DDoc}, [FunPath, Args]) ->
BFun = lists:foldl(fun
(Key, {Props}) when is_list(Props) ->
proplists:get_value(Key, Props, nil);
- (Key, Fun) when is_binary(Fun) ->
+ (_Key, Fun) when is_binary(Fun) ->
Fun;
- (Key, nil) ->
+ (_Key, nil) ->
throw({error, not_found});
- (Key, Fun) ->
+ (_Key, _Fun) ->
throw({error, malformed_ddoc})
end, {DDoc}, FunPath),
ddoc(State, makefun(State, BFun, {DDoc}), FunPath, Args).
@@ -238,7 +241,7 @@ load_ddoc(DDocs, DDocId) ->
try dict:fetch(DDocId, DDocs) of
{DDoc} -> {DDoc}
catch
- _:Else -> throw({error, ?l2b(io_lib:format("Native Query Server missing DDoc with Id: ~s",[DDocId]))})
+ _:_Else -> throw({error, ?l2b(io_lib:format("Native Query Server missing DDoc with Id: ~s",[DDocId]))})
end.
bindings(State, Sig) ->
@@ -300,7 +303,7 @@ bindings(State, Sig, DDoc) ->
{'FoldRows', FoldRows}
],
case DDoc of
- {Props} ->
+ {_Props} ->
Bindings ++ [{'DDoc', DDoc}];
_Else -> Bindings
end.
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl
index dd5fee94..a90681c5 100644
--- a/src/couchdb/couch_query_servers.erl
+++ b/src/couchdb/couch_query_servers.erl
@@ -406,11 +406,6 @@ get_ddoc_process(#doc{} = DDoc, DDocKey) ->
throw(Error)
end.
-ret_ddoc_process(Proc) ->
- true = gen_server:call(couch_query_servers, {ret_proc, Proc}),
- catch unlink(Proc#proc.pid),
- ok.
-
get_os_process(Lang) ->
case gen_server:call(couch_query_servers, {get_proc, Lang}) of
{ok, Proc, QueryConfig} ->
diff --git a/src/couchdb/couch_rep_reader.erl b/src/couchdb/couch_rep_reader.erl
index b8326fb3..4f03008f 100644
--- a/src/couchdb/couch_rep_reader.erl
+++ b/src/couchdb/couch_rep_reader.erl
@@ -51,7 +51,7 @@ start_link(Parent, Source, MissingRevs_or_DocIds, PostProps) ->
next(Pid) ->
gen_server:call(Pid, next_docs, infinity).
-init([Parent, Source, MissingRevs_or_DocIds, PostProps]) ->
+init([Parent, Source, MissingRevs_or_DocIds, _PostProps]) ->
process_flag(trap_exit, true),
if is_record(Source, http_db) ->
#url{host=Host, port=Port} = ibrowse_lib:parse_url(Source#http_db.url),