s/allows_credentials/credentials for consistency just use credentials. spotted by @tigolvi
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/425acda4 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/425acda4 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/425acda4 Branch: refs/heads/431-feature-cors Commit: 425acda4d5feb3c4f1d957227ef91898a84610e5 Parents: 85058f6 Author: benoitc <[email protected]> Authored: Thu Nov 1 21:50:54 2012 +0100 Committer: Jan Lehnardt <[email protected]> Committed: Sun Nov 11 16:11:14 2012 +0000 ---------------------------------------------------------------------- etc/couchdb/default.ini.tpl.in | 4 ++-- src/couchdb/couch_httpd_cors.erl | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/425acda4/etc/couchdb/default.ini.tpl.in ---------------------------------------------------------------------- diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in index 3960ab6..01ae4d9 100644 --- a/etc/couchdb/default.ini.tpl.in +++ b/etc/couchdb/default.ini.tpl.in @@ -69,7 +69,7 @@ allow_persistent_cookies = false ; set to true to allow persistent cookies iterations = 10000 ; iterations for password hashing [cors] -allows_credentials = false +credentials = false ; List of origins separated by a comma ;origins = ; List of accepted headers separated by a comma @@ -80,7 +80,7 @@ allows_credentials = false ; Configuration for a vhost ;[cors:example.com] -; allows_credentials = false +; credentials = false ; List of origins separated by a comma ;origins = ; List of accepted headers separated by a comma http://git-wip-us.apache.org/repos/asf/couchdb/blob/425acda4/src/couchdb/couch_httpd_cors.erl ---------------------------------------------------------------------- diff --git a/src/couchdb/couch_httpd_cors.erl b/src/couchdb/couch_httpd_cors.erl index 69f57ed..4f8bf48 100644 --- a/src/couchdb/couch_httpd_cors.erl +++ b/src/couchdb/couch_httpd_cors.erl @@ -71,7 +71,7 @@ cors_headers(#httpd{mochi_req=MochiReq}) -> handle_cors_headers("*", _Host, _AcceptedOrigins) -> [{"Access-Control-Allow-Origin", "*"}]; handle_cors_headers(Origin, Host, []) -> - case allows_credentials(Origin, Host) of + case credentials(Origin, Host) of true -> [{"Access-Control-Allow-Origin", Origin}, {"Access-Control-Allow-Credentials", "true"}]; @@ -79,9 +79,9 @@ handle_cors_headers(Origin, Host, []) -> [{"Access-Control-Allow-Origin", Origin}] end; handle_cors_headers(Origin, Host, AcceptedOrigins) -> - AllowsCredentials = allows_credentials(Origin, Host), + AllowCredentials = credentials(Origin, Host), case lists:member(Origin, AcceptedOrigins) of - true when AllowsCredentials =:= true -> + true when AllowCredentials =:= true -> [{"Access-Control-Allow-Origin", Origin}, {"Access-Control-Allow-Credentials", "true"}]; true -> @@ -133,7 +133,7 @@ handle_preflight_request(Origin, Host, MochiReq) -> % get max age MaxAge = cors_config(Host, "max_age", "12345"), - PreflightHeaders0 = case allows_credentials(Origin, Host) of + PreflightHeaders0 = case credentials(Origin, Host) of true -> [{"Access-Control-Allow-Origin", Origin}, {"Access-Control-Allow-Credentials", "true"}, @@ -183,13 +183,13 @@ handle_preflight_request(Origin, Host, MochiReq) -> end. -allows_credentials("*", _Host) -> +credentials("*", _Host) -> false; -allows_credentials(_Origin, Host) -> - Default = get_bool_config("cors", "allows_credentials", +credentials(_Origin, Host) -> + Default = get_bool_config("cors", "credentials", false), - get_bool_config(cors_section(Host), "allows_credentials", + get_bool_config(cors_section(Host), "credentials", Default).
