You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/02/12 23:53:16 UTC
[1/2] chttpd commit: updated refs/heads/1843-feature-bigcouch to
927a8d1
Updated Branches:
refs/heads/1843-feature-bigcouch a1b8b070e -> 927a8d11b
Switch to couch_log
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/30e7912a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/30e7912a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/30e7912a
Branch: refs/heads/1843-feature-bigcouch
Commit: 30e7912a8524cc8833d19e452519372f94215a2d
Parents: a1b8b07
Author: Robert Newson <ro...@cloudant.com>
Authored: Wed Feb 12 20:10:59 2014 +0000
Committer: Robert Newson <ro...@cloudant.com>
Committed: Wed Feb 12 20:10:59 2014 +0000
----------------------------------------------------------------------
src/chttpd.app.src | 2 +-
src/chttpd.erl | 10 +++++-----
src/chttpd_db.erl | 4 ++--
src/chttpd_rewrite.erl | 4 ++--
4 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/30e7912a/src/chttpd.app.src
----------------------------------------------------------------------
diff --git a/src/chttpd.app.src b/src/chttpd.app.src
index 9ab91c8..3ce0c72 100644
--- a/src/chttpd.app.src
+++ b/src/chttpd.app.src
@@ -32,7 +32,7 @@
{applications, [
kernel,
stdlib,
- twig,
+ couch_log,
config,
couch,
fabric
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/30e7912a/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index b7f8013..4c6cfc4 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -168,7 +168,7 @@ handle_request(MochiReq) ->
MethodOverride = MochiReq:get_primary_header_value("X-HTTP-Method-Override"),
Method2 = case lists:member(MethodOverride, ["GET", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT", "COPY"]) of
true ->
- twig:log(notice, "MethodOverride: ~s (real method was ~s)", [MethodOverride, Method1]),
+ couch_log:log(notice, "MethodOverride: ~s (real method was ~s)", [MethodOverride, Method1]),
case Method1 of
'POST' -> couch_util:to_existing_atom(MethodOverride);
_ ->
@@ -215,7 +215,7 @@ handle_request(MochiReq) ->
throw:{invalid_json, _} ->
send_error(HttpReq, {bad_request, "invalid UTF-8 JSON"});
exit:{mochiweb_recv_error, E} ->
- twig:log(notice, LogForClosedSocket ++ " - ~p", [E]),
+ couch_log:log(notice, LogForClosedSocket ++ " - ~p", [E]),
exit(normal);
throw:Error ->
send_error(HttpReq, Error);
@@ -231,7 +231,7 @@ handle_request(MochiReq) ->
exit(normal); % Client disconnect (R14)
_Else ->
JsonStack = json_stack({Error, nil, Stack}),
- twig:log(error, "req_err ~p:~p ~p", [Tag, Error, JsonStack]),
+ couch_log:log(error, "req_err ~p:~p ~p", [Tag, Error, JsonStack]),
send_error(HttpReq, {Error, nil, Stack})
end
end,
@@ -246,7 +246,7 @@ handle_request(MochiReq) ->
{aborted, Resp:get(code)}
end,
Host = MochiReq:get_header_value("Host"),
- twig:log(notice, "~s ~s ~s ~s ~B ~p ~B", [Peer, Host,
+ couch_log:log(notice, "~s ~s ~s ~s ~B ~p ~B", [Peer, Host,
atom_to_list(Method1), RawUri, Code, Status, round(RequestTime)]),
couch_stats_collector:record({couchdb, request_time}, RequestTime),
case Result of
@@ -255,7 +255,7 @@ handle_request(MochiReq) ->
{ok, Resp};
{aborted, _, Reason} ->
couch_stats_collector:increment({httpd, aborted_requests}),
- twig:log(error, "Response abnormally terminated: ~p", [Reason]),
+ couch_log:log(error, "Response abnormally terminated: ~p", [Reason]),
exit(normal)
end.
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/30e7912a/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index de99828..eb1a1c0 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -234,7 +234,7 @@ db_req(#httpd{method='POST', path_parts=[DbName], user_ctx=Ctx}=Req, Db) ->
{ok, _} -> ok;
{accepted, _} -> ok;
Error ->
- twig:log(debug, "Batch doc error (~s): ~p",[DocId, Error])
+ couch_log:log(debug, "Batch doc error (~s): ~p",[DocId, Error])
end
end),
@@ -646,7 +646,7 @@ db_doc_req(#httpd{method='PUT', user_ctx=Ctx}=Req, Db, DocId) ->
{ok, _} -> ok;
{accepted, _} -> ok;
Error ->
- twig:log(notice, "Batch doc error (~s): ~p",[DocId, Error])
+ couch_log:log(notice, "Batch doc error (~s): ~p",[DocId, Error])
end
end),
send_json(Req, 202, [], {[
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/30e7912a/src/chttpd_rewrite.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_rewrite.erl b/src/chttpd_rewrite.erl
index a18fa00..c8df271 100644
--- a/src/chttpd_rewrite.erl
+++ b/src/chttpd_rewrite.erl
@@ -165,7 +165,7 @@ handle_rewrite_req(#httpd{
% normalize final path (fix levels "." and "..")
RawPath1 = ?b2l(iolist_to_binary(normalize_path(RawPath))),
- twig:log(debug, "rewrite to ~p ~n", [RawPath1]),
+ couch_log:log(debug, "rewrite to ~p ~n", [RawPath1]),
% build a new mochiweb request
MochiReq1 = mochiweb_request:new(MochiReq:get(socket),
@@ -415,7 +415,7 @@ path_to_list([<<"..">>|R], Acc, DotDotCount) when DotDotCount == 2 ->
"false" ->
path_to_list(R, [<<"..">>|Acc], DotDotCount+1);
_Else ->
- twig:log(notice, "insecure_rewrite_rule ~p blocked", [lists:reverse(Acc) ++ [<<"..">>] ++ R]),
+ couch_log:log(notice, "insecure_rewrite_rule ~p blocked", [lists:reverse(Acc) ++ [<<"..">>] ++ R]),
throw({insecure_rewrite_rule, "too many ../.. segments"})
end;
path_to_list([<<"..">>|R], Acc, DotDotCount) ->
[2/2] chttpd commit: updated refs/heads/1843-feature-bigcouch to
927a8d1
Posted by rn...@apache.org.
Ask couch_httpd:log_request not to log a duplicate line
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/927a8d11
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/927a8d11
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/927a8d11
Branch: refs/heads/1843-feature-bigcouch
Commit: 927a8d11ba127484ab46a5c46ccc7c5b95db1acf
Parents: 30e7912
Author: Robert Newson <ro...@cloudant.com>
Authored: Wed Feb 12 22:52:20 2014 +0000
Committer: Robert Newson <ro...@cloudant.com>
Committed: Wed Feb 12 22:52:20 2014 +0000
----------------------------------------------------------------------
src/chttpd.erl | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/927a8d11/src/chttpd.erl
----------------------------------------------------------------------
diff --git a/src/chttpd.erl b/src/chttpd.erl
index 4c6cfc4..2ff7189 100644
--- a/src/chttpd.erl
+++ b/src/chttpd.erl
@@ -198,6 +198,9 @@ handle_request(MochiReq) ->
% put small token on heap to keep requests synced to backend calls
erlang:put(nonce, couch_util:to_hex(crypto:rand_bytes(4))),
+ % suppress duplicate log
+ erlang:put(dont_log_request, true),
+
Result =
try
case authenticate_request(HttpReq, AuthenticationFuns) of