You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by iilyak <gi...@git.apache.org> on 2015/07/31 23:08:56 UTC
[GitHub] couchdb-couch pull request: Epi hooks
GitHub user iilyak opened a pull request:
https://github.com/apache/couchdb-couch/pull/81
Epi hooks
This is one of the series of PRs to make couchdb plugable.
This PR depends on:
- https://github.com/apache/couchdb-chttpd/pull/53
- https://github.com/apache/couchdb-couch-index/pull/7
- https://github.com/apache/couchdb-couch-mrview/pull/23
- https://github.com/apache/couchdb-couch-replicator/pull/14
- https://github.com/apache/couchdb-fabric/pull/24
- https://github.com/apache/couchdb-global-changes/pull/8
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cloudant/couchdb-couch epi_hooks
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/couchdb-couch/pull/81.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #81
----
commit 4e46ca8ec3cdb3b364124982777034a123bc8797
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-06-19T17:28:20Z
Remove shards timestamp when normalize_dbname
commit 45b83e13678edac5c98a501fe22e0873f1598b4d
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-07-29T19:11:50Z
Don't quess authentication handler name
commit 78320730fd9941f98c6a057dd048ae011ae5fc85
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-07-29T19:13:13Z
Update `#chttpd{}` and introduce `#httpd_res{}` records
commit 03c3f822b5580c922a98cb6c02cc43ad4a16e5da
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-06-19T17:32:39Z
Add couch_db_plugin:validate_dbname/2
commit eac41309e133b0ed84410785390c2e3830b5322a
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-06-19T17:41:32Z
Add couch_db_plugin:before_doc_update/2
commit 1977403ed1721b4a6427789070f57c9d19a05e35
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-06-19T17:47:05Z
Add couch_db_plugin:after_doc_read/2
commit e32f5cd7117f5b5a54be5b4fbe9b64070b44c9b6
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-06-19T17:50:58Z
Add couch_db_plugin:validate_docid/1
commit c127db8dcfc8a3022f05dbbff505c580f8cccb81
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-06-19T17:58:35Z
Add couch_db_plugin:check_is_admin/1
commit 191fb3e6f47202db9e19d4a2c5a5f69506746170
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-06-19T18:07:07Z
Export couch_db:is_admin/1
commit 647bc739c7ce4f3b2804ef5fd0a414c66e2c6d3b
Author: ILYA Khlopotov <ii...@ca.ibm.com>
Date: 2015-07-31T18:16:23Z
Return `{error, {illegal_database_name, Name}}`
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36312190
--- Diff: src/couch_httpd.erl ---
@@ -872,7 +872,7 @@ error_info({bad_ctype, Reason}) ->
{415, <<"bad_content_type">>, Reason};
error_info(requested_range_not_satisfiable) ->
{416, <<"requested_range_not_satisfiable">>, <<"Requested range not satisfiable">>};
-error_info({error, illegal_database_name, Name}) ->
+error_info({error, {illegal_database_name, Name}}) ->
--- End diff --
This is hard to accomplish. Because of [this](https://github.com/cloudant/couchdb-couch/blob/epi_hooks/src/couch_db_plugin.erl#L32). `couch_epi:any` would succeed when any of the plugins would return `true`. So there is no way to inject custom error message. Since for next plugin the same dbname could be valid. I can see two ways to do custom messages. None of them perfect.
1. `throw({illegal_database_name, DbName, Msg})` and handle this error in `chttpd_plugin:handle_error` handler in your plugin.
2. Re-implement couch_db_plugin:validate_dbname to return list of `{true, ""} | {false, Error}`. If there are no `true` value in the list concatenate error messages.
3. Implement `couch_db_plugin:invalid_database_message/2` hook.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36313615
--- Diff: src/couch_httpd_auth.erl ---
@@ -346,10 +346,10 @@ handle_session_req(#httpd{method='GET', user_ctx=UserCtx}=Req, _AuthModule) ->
]}},
{info, {[
{authentication_db, ?l2b(config:get("couch_httpd_auth", "authentication_db"))},
- {authentication_handlers, [auth_name(H) || H <- couch_httpd:make_fun_spec_strs(
- config:get("httpd", "authentication_handlers"))]}
--- End diff --
Well, quite naive one: move these to own micro-plugins (which could be still live in this repo) and provide config options to enable/disable these handlers directly.
As for filling UserCtx fields, may be just backport that logic from httpd? Sounds not harmful for the first sight.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36728387
--- Diff: src/couch_httpd.erl ---
@@ -161,8 +161,15 @@ set_auth_handlers() ->
AuthenticationSrcs = make_fun_spec_strs(
config:get("httpd", "authentication_handlers", "")),
AuthHandlers = lists:map(
- fun(A) -> {make_arity_1_fun(A), ?l2b(A)} end, AuthenticationSrcs),
- ok = application:set_env(couch, auth_handlers, AuthHandlers).
+ fun(A) -> {auth_handler_name(A), make_arity_1_fun(A)} end, AuthenticationSrcs),
+ AuthenticationFuns = AuthHandlers ++ [
+ {<<"local">>, fun couch_httpd_auth:local_admin_handler/1} %% should be last
+ ],
+ ok = application:set_env(couch, auth_handlers, AuthenticationFuns).
+
+auth_handler_name(SpecStr) ->
+ [_,_,_,_,_,Name|_] = re:split(SpecStr, "[\\W_]", []),
--- End diff --
`lists:nth` would be clearer.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36028477
--- Diff: src/couch_httpd.erl ---
@@ -872,7 +872,7 @@ error_info({bad_ctype, Reason}) ->
{415, <<"bad_content_type">>, Reason};
error_info(requested_range_not_satisfiable) ->
{416, <<"requested_range_not_satisfiable">>, <<"Requested range not satisfiable">>};
-error_info({error, illegal_database_name, Name}) ->
+error_info({error, {illegal_database_name, Name}}) ->
--- End diff --
I guess if I provide my own validate_dbname hook with different regexp constraint, this error message will be true no more, right?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by davisp <gi...@git.apache.org>.
Github user davisp commented on the pull request:
https://github.com/apache/couchdb-couch/pull/81#issuecomment-129570841
Mostly minor comments from me on this and the related PRs. The overall structure and bulk of the work looks great. Just a few weird things that look like churn from development that didn't get flattened out before making the PR and then some possibly unrelated stuff that may have just been found during this work (which I'm fine with as long as there's a good commit message to explain what is going on with some of the subtler changes).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36728270
--- Diff: src/couch_httpd.erl ---
@@ -161,8 +161,15 @@ set_auth_handlers() ->
AuthenticationSrcs = make_fun_spec_strs(
config:get("httpd", "authentication_handlers", "")),
AuthHandlers = lists:map(
- fun(A) -> {make_arity_1_fun(A), ?l2b(A)} end, AuthenticationSrcs),
- ok = application:set_env(couch, auth_handlers, AuthHandlers).
+ fun(A) -> {auth_handler_name(A), make_arity_1_fun(A)} end, AuthenticationSrcs),
+ AuthenticationFuns = AuthHandlers ++ [
+ {<<"local">>, fun couch_httpd_auth:local_admin_handler/1} %% should be last
+ ],
+ ok = application:set_env(couch, auth_handlers, AuthenticationFuns).
--- End diff --
hrm, this is unpleasant, application env is not persistent, are we using here as a cache?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36315485
--- Diff: src/couch_httpd.erl ---
@@ -872,7 +872,7 @@ error_info({bad_ctype, Reason}) ->
{415, <<"bad_content_type">>, Reason};
error_info(requested_range_not_satisfiable) ->
{416, <<"requested_range_not_satisfiable">>, <<"Requested range not satisfiable">>};
-error_info({error, illegal_database_name, Name}) ->
+error_info({error, {illegal_database_name, Name}}) ->
--- End diff --
I think the first option is the most sane and correct - validate function is only holds the knowledge about database name restrictions and throwing error with descriptive message from there is correct. chttpd need just transform this error into HTTP response.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/couchdb-couch/pull/81
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36313029
--- Diff: src/couch_httpd_auth.erl ---
@@ -346,10 +346,10 @@ handle_session_req(#httpd{method='GET', user_ctx=UserCtx}=Req, _AuthModule) ->
]}},
{info, {[
{authentication_db, ?l2b(config:get("couch_httpd_auth", "authentication_db"))},
- {authentication_handlers, [auth_name(H) || H <- couch_httpd:make_fun_spec_strs(
- config:get("httpd", "authentication_handlers"))]}
--- End diff --
The way `authentication_handlers` were implemented is inconsistent anyway. The chttpd app has them hardcoded. It also doesn't set the value for `UserCtx#user_ctx.handler`. So `authenticated` field is completely missing if called on clustered interface. I'll think about it more. What would be your suggestions? Any hints?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:
https://github.com/apache/couchdb-couch/pull/81#issuecomment-126841860
I'm quite confused by multiple DbName conversion from list to binary and back. Can we always use DbName as binary and just fix error message generation and `?SYSTEM_DATABASES`? Should simplify some code a bit.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36749055
--- Diff: include/couch_db.hrl ---
@@ -91,10 +91,17 @@
design_url_handlers,
auth,
default_fun,
- url_handlers
+ url_handlers,
+ authentication_handlers = [],
+ absolute_uri,
+ auth_module,
+ begin_ts,
+ original_method,
+ nonce,
+ cors_config,
+ qs
}).
-
--- End diff --
should I double space all records or it will be a change non related to PR?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on the pull request:
https://github.com/apache/couchdb-couch/pull/81#issuecomment-129798305
good stuff, some comments to address from myself and kxepal. will re-review after.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36028094
--- Diff: src/couch_db_plugin.erl ---
@@ -0,0 +1,65 @@
+% 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. See the
+% License for the specific language governing permissions and limitations under
+% the License.
+
+-module(couch_db_plugin).
+
+-export([
+ validate_dbname/2,
+ before_doc_update/2,
+ after_doc_read/2,
+ validate_docid/1,
+ check_is_admin/1
+]).
+
+-include_lib("couch/include/couch_db.hrl").
+
+%% ------------------------------------------------------------------
+%% API Function Definitions
+%% ------------------------------------------------------------------
+
+validate_dbname(DbName, Normalized) ->
+ Handle = couch_epi:get_handle(couch_db),
--- End diff --
In other apps, you defined `?SERVICE_ID` macro for handle name. Why not here as well?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36728152
--- Diff: src/couch_db.erl ---
@@ -1480,3 +1497,32 @@ normalize_dbname(<<"shards/", _/binary>> = Path) ->
lists:last(binary:split(mem3:dbname(Path), <<"/">>, [global]));
normalize_dbname(DbName) ->
DbName.
+
+validate_dbname(DbName) when is_list(DbName) ->
+ validate_dbname(?l2b(DbName));
+validate_dbname(DbName) when is_binary(DbName) ->
+ Normalized = normalize_dbname(DbName),
+ case couch_db_plugin:validate_dbname(DbName, Normalized) of
+ true ->
+ ok;
+ false ->
+ validate_dbname_int(DbName, Normalized)
+ end.
+
+validate_dbname_int(DbName, Normalized) ->
--- End diff --
an is_binary(DbName) here would be a useful check, it's guaranteed by `validate_dbname` above.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on the pull request:
https://github.com/apache/couchdb-couch/pull/81#issuecomment-129563435
@davisp: I fixed most of you comments. The one which is left is about the typo in a commit message. I'll fix it on squash.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36028344
--- Diff: include/couch_db.hrl ---
@@ -91,10 +91,27 @@
design_url_handlers,
auth,
default_fun,
- url_handlers
+ url_handlers,
+ authentication_handlers = [],
+ absolute_uri,
+ auth_module,
+ begin_ts,
+ original_method,
+ nonce,
+ cors_config,
+ qs
+}).
+
+-record(httpd_res, {
--- End diff --
Shouldn't this record and changes about be in chttpd module?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36028820
--- Diff: src/couch_httpd_auth.erl ---
@@ -346,10 +346,10 @@ handle_session_req(#httpd{method='GET', user_ctx=UserCtx}=Req, _AuthModule) ->
]}},
{info, {[
{authentication_db, ?l2b(config:get("couch_httpd_auth", "authentication_db"))},
- {authentication_handlers, [auth_name(H) || H <- couch_httpd:make_fun_spec_strs(
- config:get("httpd", "authentication_handlers"))]}
--- End diff --
It's not possible any more to enable disabled by default auth handlers like [`proxy_authentication_handler`](https://github.com/apache/couchdb-couch/blob/master/src/couch_httpd_auth.erl#L118-L138) or [`null_authentication_handler`](https://github.com/apache/couchdb-couch/blob/master/src/couch_httpd_auth.erl#L115-L116). Also, JavaScript test suite is broken by impossibility to set [`
special_test_authentication_handler`](https://github.com/apache/couchdb-couch/blob/master/src/couch_httpd_auth.erl#L33-L52).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36728038
--- Diff: include/couch_db.hrl ---
@@ -91,10 +91,17 @@
design_url_handlers,
auth,
default_fun,
- url_handlers
+ url_handlers,
+ authentication_handlers = [],
+ absolute_uri,
+ auth_module,
+ begin_ts,
+ original_method,
+ nonce,
+ cors_config,
+ qs
}).
-
--- End diff --
double spacing was intentional.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on the pull request:
https://github.com/apache/couchdb-couch/pull/81#issuecomment-130263719
+1
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36315130
--- Diff: include/couch_db.hrl ---
@@ -91,10 +91,27 @@
design_url_handlers,
auth,
default_fun,
- url_handlers
+ url_handlers,
+ authentication_handlers = [],
+ absolute_uri,
+ auth_module,
+ begin_ts,
+ original_method,
+ nonce,
+ cors_config,
+ qs
+}).
+
+-record(httpd_res, {
--- End diff --
I think that ok if end user goes to extend HTTP layer.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36728326
--- Diff: src/couch_httpd.erl ---
@@ -161,8 +161,15 @@ set_auth_handlers() ->
AuthenticationSrcs = make_fun_spec_strs(
config:get("httpd", "authentication_handlers", "")),
AuthHandlers = lists:map(
- fun(A) -> {make_arity_1_fun(A), ?l2b(A)} end, AuthenticationSrcs),
- ok = application:set_env(couch, auth_handlers, AuthHandlers).
+ fun(A) -> {auth_handler_name(A), make_arity_1_fun(A)} end, AuthenticationSrcs),
+ AuthenticationFuns = AuthHandlers ++ [
+ {<<"local">>, fun couch_httpd_auth:local_admin_handler/1} %% should be last
+ ],
+ ok = application:set_env(couch, auth_handlers, AuthenticationFuns).
--- End diff --
ah, but I guess is predates your work. See my comment on the name. summary: party_mode_handler would be more descriptive (and suitably scary)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] couchdb-couch pull request: Epi hooks
Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/81#discussion_r36309591
--- Diff: include/couch_db.hrl ---
@@ -91,10 +91,27 @@
design_url_handlers,
auth,
default_fun,
- url_handlers
+ url_handlers,
+ authentication_handlers = [],
+ absolute_uri,
+ auth_module,
+ begin_ts,
+ original_method,
+ nonce,
+ cors_config,
+ qs
+}).
+
+-record(httpd_res, {
--- End diff --
I can move it. However this would mean that the plugin developer would need to do:
```
-include_lib("chttpd/include/chttpd.hrl").
```
Which is alright.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---