You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2015/06/02 21:36:21 UTC

[50/50] couch commit: updated refs/heads/2080-port-cors-to-chttpd to 529339b

Allow couch_httpd_cors to be disable by the calling process

In chttpd we call into couch_httpd for the low level http functions
like send_json. The function couch_httpd:send_response/4 calls out to
couch_httpd_cors, which will cause duplicate CORS headers to be set
when we've already gone through chttpd_cors.

This is a bit of a hack but it's a good temporary measure until we
consolidate couch_httpd and chttpd down to one http stack.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/529339b6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/529339b6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/529339b6

Branch: refs/heads/2080-port-cors-to-chttpd
Commit: 529339b6c326cea998129198b1373f31caed66f0
Parents: aa5d63f
Author: Russell Branca <ch...@apache.org>
Authored: Thu Nov 6 14:53:28 2014 -0800
Committer: Russell Branca <ch...@apache.org>
Committed: Tue Jun 2 19:35:04 2015 +0000

----------------------------------------------------------------------
 src/couch_httpd_cors.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/529339b6/src/couch_httpd_cors.erl
----------------------------------------------------------------------
diff --git a/src/couch_httpd_cors.erl b/src/couch_httpd_cors.erl
index 57b4f6b..abcd9a7 100644
--- a/src/couch_httpd_cors.erl
+++ b/src/couch_httpd_cors.erl
@@ -309,7 +309,12 @@ cors_section(Host0) ->
     "cors:" ++ Host.
 
 enable_cors() ->
-    get_bool_config("httpd", "enable_cors", false).
+    case get('disable_couch_httpd_cors') of
+        undefined ->
+            get_bool_config("httpd", "enable_cors", false);
+        _ ->
+            false
+    end.
 
 get_bool_config(Section, Key, Default) ->
     case config:get(Section, Key) of