[1/2] couch commit: updated refs/heads/master to db58e79
Repository: couchdb-couch Updated Branches: refs/heads/master 55e98c44c - db58e794f Fix export declarations Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/28a7f575 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/28a7f575 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/28a7f575 Branch: refs/heads/master Commit: 28a7f57538b9dc7eb05d9c6e2ab2f275dd04ce35 Parents: 55e98c4 Author: Paul J. Davis paul.joseph.da...@gmail.com Authored: Fri Sep 5 17:34:28 2014 -0500 Committer: Paul J. Davis paul.joseph.da...@gmail.com Committed: Fri Sep 5 17:34:28 2014 -0500 -- src/couch_proc_manager.erl | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/28a7f575/src/couch_proc_manager.erl -- diff --git a/src/couch_proc_manager.erl b/src/couch_proc_manager.erl index 2b86af6..9232fd7 100644 --- a/src/couch_proc_manager.erl +++ b/src/couch_proc_manager.erl @@ -15,9 +15,6 @@ -behaviour(config_listener). -vsn(1). --export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, -code_change/3]). - -export([ start_link/0, get_proc_count/0, @@ -27,8 +24,18 @@ terminate_stale_procs/0 ]). -% config_listener api --export([handle_config_change/5]). +-export([ +init/1, +terminate/2, +handle_call/3, +handle_cast/2, +handle_info/2, +code_change/3 +]). + +-export([ +handle_config_change/5 +]). -include_lib(couch/include/couch_db.hrl).
[2/2] couch commit: updated refs/heads/master to db58e79
Fix bugs with couch_proc_manager limits This fixes the couch_proc_manager limit counting by rearranging the increment and decrements when processes are created and destroyed. It ensures that each time we remove a process from the ets table that we decrement appropriately. For incrementing, things are a bit more complicated in that we need to increment before inserting to the table. This is so that our hard limit applies even if one of our asynchronous spawn calls is opening a new process. This is accomplished by incrementing the counter and storing the async open call information in a new ets table. If the open is successful the counter is left untouched. If the open fails then we need to decrement the counter. This also simplifies starting waiting clients when a processes is either returned, exits, or fails to start by isolating the logic and calling it in each place as necessary. Closes COUCHDB-2321 Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/db58e794 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/db58e794 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/db58e794 Branch: refs/heads/master Commit: db58e794f937a52b6b61c964942e56afa7d03d8b Parents: 28a7f57 Author: Paul J. Davis paul.joseph.da...@gmail.com Authored: Fri Sep 5 17:35:14 2014 -0500 Committer: Paul J. Davis paul.joseph.da...@gmail.com Committed: Fri Sep 5 18:18:59 2014 -0500 -- src/couch_proc_manager.erl | 484 +++- 1 file changed, 276 insertions(+), 208 deletions(-) -- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/db58e794/src/couch_proc_manager.erl -- diff --git a/src/couch_proc_manager.erl b/src/couch_proc_manager.erl index 9232fd7..8f29c00 100644 --- a/src/couch_proc_manager.erl +++ b/src/couch_proc_manager.erl @@ -39,12 +39,16 @@ -include_lib(couch/include/couch_db.hrl). +-define(PROCS, couch_proc_manager_procs). +-define(WAITERS, couch_proc_manager_waiters). +-define(OPENING, couch_proc_manager_opening). + -record(state, { -tab, config, -proc_counts, -waiting, -threshold_ts +counts, +threshold_ts, +hard_limit, +soft_limit }). -record(client, { @@ -58,7 +62,7 @@ -record(proc_int, { pid, lang, -client = nil, +client, ddoc_keys = [], prompt_fun, set_timeout_fun, @@ -66,51 +70,70 @@ t0 = os:timestamp() }). + start_link() - gen_server:start_link({local, ?MODULE}, ?MODULE, [], []). + get_proc_count() - gen_server:call(?MODULE, get_proc_count). + get_stale_proc_count() - gen_server:call(?MODULE, get_stale_proc_count). + reload() - -gen_server:call(?MODULE, bump_threshold_ts). +gen_server:call(?MODULE, set_threshold_ts). + terminate_stale_procs() - gen_server:call(?MODULE, terminate_stale_procs). + init([]) - process_flag(trap_exit, true), -ok = config:listen_for_changes(?MODULE, nil), +ok = config:listen_for_changes(?MODULE, undefined), + +TableOpts = [public, named_table, ordered_set], +ets:new(?PROCS, TableOpts ++ [{keypos, #proc_int.pid}]), +ets:new(?WAITERS, TableOpts ++ [{keypos, #client.timestamp}]), +ets:new(?OPENING, [public, named_table, set]), + {ok, #state{ -tab = ets:new(procs, [ordered_set, {keypos, #proc_int.pid}]), config = get_proc_config(), -proc_counts = dict:new(), -waiting = ets:new(couch_proc_manage_waiting, -[ordered_set, {keypos, #client.timestamp}]) +counts = dict:new(), +threshold_ts = os:timestamp(), +hard_limit = get_hard_limit(), +soft_limit = get_soft_limit() }}. -handle_call(get_table, _From, State) - -{reply, State#state.tab, State}; + +terminate(_Reason, _State) - +ets:foldl(fun(#proc_int{pid=P}, _) - +couch_util:shutdown_sync(P) +end, 0, ?PROCS), +ok. + handle_call(get_proc_count, _From, State) - -{reply, ets:info(State#state.tab, size), State}; +NumProcs = ets:info(?PROCS, size), +NumOpening = ets:info(?OPENING, size), +{reply, NumProcs + NumOpening, State}; handle_call(get_stale_proc_count, _From, State) - -#state{tab = Tab, threshold_ts = T0} = State, +#state{threshold_ts = T0} = State, MatchSpec = [{#proc_int{t0='$1', _='_'}, [{'', '$1', T0}], [true]}], -{reply, ets:select_count(Tab, MatchSpec), State}; +{reply, ets:select_count(?PROCS, MatchSpec), State}; handle_call({get_proc, #doc{body={Props}}=DDoc, DDocKey}, From, State) - {ClientPid, _} = From, -Lang = couch_util:to_binary( -couch_util:get_value(language, Props, javascript)), +LangStr = couch_util:get_value(language,
couch commit: updated refs/notes/commits to d17e01a
Repository: couchdb-couch Updated Branches: refs/notes/commits [created] d17e01ae5 Notes added by 'git notes add' Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/d17e01ae Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/d17e01ae Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/d17e01ae Branch: refs/notes/commits Commit: d17e01ae55ce20caef5f41eae0039adac5cf77d4 Parents: Author: Robert Newson rnew...@apache.org Authored: Sat Sep 6 12:29:26 2014 +0100 Committer: Robert Newson rnew...@apache.org Committed: Sat Sep 6 12:29:26 2014 +0100 -- db58e794f937a52b6b61c964942e56afa7d03d8b | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/d17e01ae/db58e794f937a52b6b61c964942e56afa7d03d8b -- diff --git a/db58e794f937a52b6b61c964942e56afa7d03d8b b/db58e794f937a52b6b61c964942e56afa7d03d8b new file mode 100644 index 000..2ebf33d --- /dev/null +++ b/db58e794f937a52b6b61c964942e56afa7d03d8b @@ -0,0 +1 @@ +actually COUCHDB-2322
couch commit: updated refs/heads/fix-csp to 6f626a2
Repository: couchdb-couch Updated Branches: refs/heads/fix-csp [created] 6f626a27d Fix default CSP setting for Ace Editor Like @sebastianrothbucher noticed in apache/couchdb-fauxton#5 the Ace editor needs base64 image data as image source for their icons Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/6f626a27 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/6f626a27 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/6f626a27 Branch: refs/heads/fix-csp Commit: 6f626a27d05c5944a5357535bb119e14f70e89ce Parents: db58e79 Author: Robert Kowalski r...@kowalski.gd Authored: Tue Jul 22 19:22:02 2014 +0200 Committer: Robert Kowalski r...@kowalski.gd Committed: Sat Sep 6 17:04:29 2014 +0200 -- src/couch_httpd_misc_handlers.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/6f626a27/src/couch_httpd_misc_handlers.erl -- diff --git a/src/couch_httpd_misc_handlers.erl b/src/couch_httpd_misc_handlers.erl index 8101cdf..d13042e 100644 --- a/src/couch_httpd_misc_handlers.erl +++ b/src/couch_httpd_misc_handlers.erl @@ -81,7 +81,7 @@ handle_utils_dir_req(Req, _) - send_method_not_allowed(Req, GET,HEAD). maybe_add_csp_headers(Headers, true) - -DefaultValues = default-src 'self'; img-src 'self'; font-src 'self'; +DefaultValues = default-src 'self'; img-src 'self' data:; font-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline';, Value = config:get(csp, header_value, DefaultValues), [{Content-Security-Policy, Value} | Headers];
couch commit: updated refs/heads/fix-csp to 8c9e0c7
Repository: couchdb-couch Updated Branches: refs/heads/fix-csp 6f626a27d - 8c9e0c79d fix test Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/8c9e0c79 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/8c9e0c79 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/8c9e0c79 Branch: refs/heads/fix-csp Commit: 8c9e0c79d6f2638a8be6432ab3d5d7f7003068ee Parents: 6f626a2 Author: Robert Kowalski r...@kowalski.gd Authored: Sat Sep 6 17:24:36 2014 +0200 Committer: Robert Kowalski r...@kowalski.gd Committed: Sat Sep 6 17:24:36 2014 +0200 -- test/couchdb_csp_tests.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/8c9e0c79/test/couchdb_csp_tests.erl -- diff --git a/test/couchdb_csp_tests.erl b/test/couchdb_csp_tests.erl index 3dbe6e3..5eb33f9 100644 --- a/test/couchdb_csp_tests.erl +++ b/test/couchdb_csp_tests.erl @@ -57,7 +57,7 @@ should_not_return_any_csp_headers_when_disabled(Url) - should_apply_default_policy(Url) - ?_assertEqual( -default-src 'self'; img-src 'self'; font-src 'self'; +default-src 'self'; img-src 'self' data:; font-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline';, begin {ok, _, Headers, _} = test_request:get(Url),
Git Push Summary
Repository: couchdb-couch Updated Branches: refs/heads/fix-csp [deleted] 8c9e0c79d
[2/2] couchdb commit: updated refs/heads/enable-csp-default to e16abc9
Enable CSP support for /_utils per default With the new 2.0 release Futon, which had too much inline- JavaScript etc., is not used any more. Fauxton is able to work with our default CSP settings. Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/e16abc95 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/e16abc95 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/e16abc95 Branch: refs/heads/enable-csp-default Commit: e16abc958a89cf554f4fe1bf78e3cfb5b92147e6 Parents: 7cae823 Author: Robert Kowalski r...@kowalski.gd Authored: Sat Sep 6 20:49:12 2014 +0200 Committer: Robert Kowalski r...@kowalski.gd Committed: Sat Sep 6 20:49:12 2014 +0200 -- rel/overlay/etc/default.ini| 4 ++-- share/doc/src/experimental.rst | 17 - 2 files changed, 2 insertions(+), 19 deletions(-) -- http://git-wip-us.apache.org/repos/asf/couchdb/blob/e16abc95/rel/overlay/etc/default.ini -- diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index fe19b1e..8bf641a 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -91,9 +91,9 @@ credentials = false ; List of accepted methods ; methods = -; Experimental CSP (Content Security Policy) Support for _utils +; CSP (Content Security Policy) Support for _utils [csp] -enable = false +enable = true ; header_value = default-src 'self'; img-src 'self'; font-src *; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; ; Configuration for a vhost http://git-wip-us.apache.org/repos/asf/couchdb/blob/e16abc95/share/doc/src/experimental.rst -- diff --git a/share/doc/src/experimental.rst b/share/doc/src/experimental.rst index fae925c..077fcaa 100644 --- a/share/doc/src/experimental.rst +++ b/share/doc/src/experimental.rst @@ -79,20 +79,3 @@ Plugins === See `src/couch_plugins/README.md`. - - -Content-Security-Policy (CSP) Header Support for /_utils (Fauxton) -== - -This will just work with Fauxton, and not Futon. You can enable it -in your config: you can enable the feature in general and change -the default header that is sent for everything in /_utils. - -.. code-block:: ini - - [csp] - enable = true - -Then restart CouchDB. - -Have fun!
[1/2] couchdb commit: updated refs/heads/enable-csp-default to e16abc9
Repository: couchdb Updated Branches: refs/heads/enable-csp-default [created] e16abc958 csp: remove duplicated configuration Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/7cae8235 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/7cae8235 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/7cae8235 Branch: refs/heads/enable-csp-default Commit: 7cae8235dd41036862adce04130681878b61d7c8 Parents: f8a6765 Author: Robert Kowalski r...@kowalski.gd Authored: Sat Sep 6 20:41:15 2014 +0200 Committer: Robert Kowalski r...@kowalski.gd Committed: Sat Sep 6 20:41:15 2014 +0200 -- rel/overlay/etc/default.ini | 4 1 file changed, 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/couchdb/blob/7cae8235/rel/overlay/etc/default.ini -- diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini index 491c76a..fe19b1e 100644 --- a/rel/overlay/etc/default.ini +++ b/rel/overlay/etc/default.ini @@ -79,10 +79,6 @@ iterations = 10 ; iterations for password hashing ; comma-separated list of public fields, 404 if empty ; public_fields = -; Experimental CSP (Content Security Policy) Support for _utils -[csp] -enable = false -; header_value = default-src 'self'; img-src 'self'; font-src *; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; [cors] credentials = false
couchdb commit: updated refs/heads/master to 70e9d57
Repository: couchdb Updated Branches: refs/heads/master f8a6765fd - 70e9d571a Travis: Drop R15 build, add 17.1 Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/70e9d571 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/70e9d571 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/70e9d571 Branch: refs/heads/master Commit: 70e9d571a35bcfb9fe0120fed07a930c388ba88b Parents: f8a6765 Author: Joan Touzet woh...@apache.org Authored: Sat Sep 6 20:01:09 2014 -0400 Committer: Joan Touzet woh...@apache.org Committed: Sat Sep 6 20:01:09 2014 -0400 -- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/couchdb/blob/70e9d571/.travis.yml -- diff --git a/.travis.yml b/.travis.yml index c9fd820..10dbfad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,9 @@ script: - grunt test language: erlang otp_release: + - 17.1 - 17.0 - R16B03-1 - - R15B03 - R14B04 git: depth: 10