couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject couch commit: updated refs/heads/2080-port-cors-to-chttpd to d20fb11
Date Thu, 06 Nov 2014 22:55:38 GMT
Repository: couchdb-couch
Updated Branches:
  refs/heads/2080-port-cors-to-chttpd [created] d20fb1132


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/d20fb113
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/d20fb113
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/d20fb113

Branch: refs/heads/2080-port-cors-to-chttpd
Commit: d20fb113237da8153386feee2359395d2d07b5d9
Parents: cb52507
Author: Russell Branca <chewbranca@apache.org>
Authored: Thu Nov 6 14:53:28 2014 -0800
Committer: Russell Branca <chewbranca@apache.org>
Committed: Thu Nov 6 14:53:28 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/d20fb113/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


Mime
View raw message