Repository: couchdb-chttpd Updated Branches: refs/heads/master 77b3af447 -> 07493ef4c
Use `chttpd:qs*` instead of `couch_httpd:qs*` Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/57427cf1 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/57427cf1 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/57427cf1 Branch: refs/heads/master Commit: 57427cf103e9b3f77a715acf2298b2a55b5bd2a3 Parents: 3866725 Author: ILYA Khlopotov <[email protected]> Authored: Thu Jul 23 13:15:44 2015 -0700 Committer: ILYA Khlopotov <[email protected]> Committed: Thu Jul 23 13:18:31 2015 -0700 ---------------------------------------------------------------------- src/chttpd_db.erl | 30 +++++++++++++++--------------- src/chttpd_misc.erl | 2 +- src/chttpd_rewrite.erl | 2 +- src/chttpd_show.erl | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/57427cf1/src/chttpd_db.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl index c50c53f..53e217f 100644 --- a/src/chttpd_db.erl +++ b/src/chttpd_db.erl @@ -59,7 +59,7 @@ handle_request(#httpd{path_parts=[DbName|RestParts],method=Method}=Req)-> {'DELETE', []} -> % if we get ?rev=... the user is using a faulty script where the % document id is empty by accident. Let them recover safely. - case couch_httpd:qs_value(Req, "rev", false) of + case chttpd:qs_value(Req, "rev", false) of false -> delete_db_req(Req, DbName); _Rev -> throw({bad_request, "You tried to DELETE a database with a ?=rev parameter. " @@ -262,9 +262,9 @@ handle_design_info_req(Req, _Db, _DDoc) -> create_db_req(#httpd{}=Req, DbName) -> couch_httpd:verify_is_server_admin(Req), - N = couch_httpd:qs_value(Req, "n", config:get("cluster", "n", "3")), - Q = couch_httpd:qs_value(Req, "q", config:get("cluster", "q", "8")), - P = couch_httpd:qs_value(Req, "placement", config:get("cluster", "placement")), + N = chttpd:qs_value(Req, "n", config:get("cluster", "n", "3")), + Q = chttpd:qs_value(Req, "q", config:get("cluster", "q", "8")), + P = chttpd:qs_value(Req, "placement", config:get("cluster", "placement")), DocUrl = absolute_uri(Req, "/" ++ couch_util:url_encode(DbName)), case fabric:create_db(DbName, [{n,N}, {q,Q}, {placement,P}]) of ok -> @@ -303,7 +303,7 @@ db_req(#httpd{method='GET',path_parts=[DbName]}=Req, _Db) -> db_req(#httpd{method='POST', path_parts=[DbName], user_ctx=Ctx}=Req, Db) -> couch_httpd:validate_ctype(Req, "application/json"), - W = couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), + W = chttpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), Options = [{user_ctx,Ctx}, {w,W}], Doc = couch_doc:from_json_obj(chttpd:json_body(Req)), @@ -314,7 +314,7 @@ db_req(#httpd{method='POST', path_parts=[DbName], user_ctx=Ctx}=Req, Db) -> Doc end, DocId = Doc2#doc.id, - case couch_httpd:qs_value(Req, "batch") of + case chttpd:qs_value(Req, "batch") of "ok" -> % async_batching spawn(fun() -> @@ -374,7 +374,7 @@ db_req(#httpd{method='POST',path_parts=[_,<<"_bulk_docs">>], user_ctx=Ctx}=Req, Value when is_integer(Value) -> integer_to_list(Value); _ -> - couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))) + chttpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))) end, case chttpd:header_value(Req, "X-Couch-Full-Commit") of "true" -> @@ -664,7 +664,7 @@ db_doc_req(#httpd{method='POST', user_ctx=Ctx}=Req, Db, DocId) -> couch_doc:validate_docid(DocId), couch_httpd:validate_ctype(Req, "multipart/form-data"), - W = couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), + W = chttpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), Options = [{user_ctx,Ctx}, {w,W}], Form = couch_httpd:parse_form(Req), @@ -715,7 +715,7 @@ db_doc_req(#httpd{method='PUT', user_ctx=Ctx}=Req, Db, DocId) -> } = parse_doc_query(Req), couch_doc:validate_docid(DocId), - W = couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), + W = chttpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), Options = [{user_ctx,Ctx}, {w,W}], Loc = absolute_uri(Req, [$/, Db#db.name, $/, couch_util:url_encode(DocId)]), @@ -736,7 +736,7 @@ db_doc_req(#httpd{method='PUT', user_ctx=Ctx}=Req, Db, DocId) -> throw(Err) end; _Else -> - case couch_httpd:qs_value(Req, "batch") of + case chttpd:qs_value(Req, "batch") of "ok" -> % batch Doc = couch_doc_from_req(Req, DocId, chttpd:json_body(Req)), @@ -763,7 +763,7 @@ db_doc_req(#httpd{method='PUT', user_ctx=Ctx}=Req, Db, DocId) -> db_doc_req(#httpd{method='COPY', user_ctx=Ctx}=Req, Db, SourceDocId) -> SourceRev = - case extract_header_rev(Req, couch_httpd:qs_value(Req, "rev")) of + case extract_header_rev(Req, chttpd:qs_value(Req, "rev")) of missing_rev -> nil; Rev -> Rev end, @@ -900,7 +900,7 @@ send_updated_doc(Req, Db, DocId, Doc, Headers) -> send_updated_doc(#httpd{user_ctx=Ctx} = Req, Db, DocId, #doc{deleted=Deleted}=Doc, Headers, UpdateType) -> - W = couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), + W = chttpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), Options = case couch_httpd:header_value(Req, "X-Couch-Full-Commit") of "true" -> @@ -972,7 +972,7 @@ update_doc(Db, DocId, #doc{deleted=Deleted}=Doc, Options) -> couch_doc_from_req(Req, DocId, #doc{revs=Revs} = Doc) -> validate_attachment_names(Doc), - Rev = case couch_httpd:qs_value(Req, "rev") of + Rev = case chttpd:qs_value(Req, "rev") of undefined -> undefined; QSRev -> @@ -1179,7 +1179,7 @@ db_attachment_req(#httpd{method=Method, user_ctx=Ctx}=Req, Db, DocId, FileNamePa ])] end, - Doc = case extract_header_rev(Req, couch_httpd:qs_value(Req, "rev")) of + Doc = case extract_header_rev(Req, chttpd:qs_value(Req, "rev")) of missing_rev -> % make the new doc couch_doc:validate_docid(DocId), #doc{id=DocId}; @@ -1393,7 +1393,7 @@ parse_changes_query(Req) -> _Else -> % unknown key value pair, ignore. Args end - end, #changes_args{}, couch_httpd:qs(Req)), + end, #changes_args{}, chttpd:qs(Req)), %% if it's an EventSource request with a Last-event-ID header %% that should override the `since` query string, since it's %% probably the browser reconnecting. http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/57427cf1/src/chttpd_misc.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_misc.erl b/src/chttpd_misc.erl index f23926b..2d058ad 100644 --- a/src/chttpd_misc.erl +++ b/src/chttpd_misc.erl @@ -318,7 +318,7 @@ call_node(Node, Mod, Fun, Args) when is_atom(Node) -> end. flush(Node, Req) -> - case couch_util:get_value("flush", couch_httpd:qs(Req)) of + case couch_util:get_value("flush", chttpd:qs(Req)) of "true" -> call_node(Node, couch_stats_aggregator, flush, []); _Else -> http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/57427cf1/src/chttpd_rewrite.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_rewrite.erl b/src/chttpd_rewrite.erl index 2a0cf64..902f6e9 100644 --- a/src/chttpd_rewrite.erl +++ b/src/chttpd_rewrite.erl @@ -117,7 +117,7 @@ handle_rewrite_req(#httpd{ % we are in a design handler DesignId = <<"_design/", DesignName/binary>>, Prefix = <<"/", DbName/binary, "/", DesignId/binary>>, - QueryList = lists:map(fun decode_query_value/1, couch_httpd:qs(Req)), + QueryList = lists:map(fun decode_query_value/1, chttpd:qs(Req)), #doc{body={Props}} = DDoc, http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/57427cf1/src/chttpd_show.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_show.erl b/src/chttpd_show.erl index 18f64cb..4254e7a 100644 --- a/src/chttpd_show.erl +++ b/src/chttpd_show.erl @@ -118,7 +118,7 @@ send_doc_update_response(Req, Db, DDoc, UpdateName, Doc, DocId) -> JsonReq = chttpd_external:json_req_obj(Req, Db, DocId), JsonDoc = couch_query_servers:json_doc(Doc), Cmd = [<<"updates">>, UpdateName], - W = couch_httpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), + W = chttpd:qs_value(Req, "w", integer_to_list(mem3:quorum(Db))), UpdateResp = couch_query_servers:ddoc_prompt(DDoc, Cmd, [JsonDoc, JsonReq]), JsonResp = case UpdateResp of [<<"up">>, {NewJsonDoc}, {JsonResp0}] ->
