couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject chttpd commit: updated refs/heads/master to 9ddbd04
Date Wed, 01 Jul 2015 10:08:25 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master e7f9ed83d -> 9ddbd0404


Account for binary keys for headers in CORS

We do have headers' keys represented as either lists or binaries.
Make sure we don't crash on `string:to_lower`.

COUCHDB-2733


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/9ddbd040
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/9ddbd040
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/9ddbd040

Branch: refs/heads/master
Commit: 9ddbd04045a833262ff850d63a4e6d6632caea43
Parents: e7f9ed8
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Mon Jun 29 05:45:37 2015 -0700
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Mon Jun 29 09:08:07 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/9ddbd040/src/chttpd_cors.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_cors.erl b/src/chttpd_cors.erl
index b109b45..cedb86e 100644
--- a/src/chttpd_cors.erl
+++ b/src/chttpd_cors.erl
@@ -217,9 +217,13 @@ maybe_apply_headers(CorsHeaders, RequestHeaders) ->
 
 
 simple_headers(Headers) ->
-    LCHeaders = [string:to_lower(H) || H <- Headers],
+    LCHeaders = [to_lower(H) || H <- Headers],
     lists:filter(fun(H) -> lists:member(H, ?SIMPLE_HEADERS) end, LCHeaders).
 
+to_lower(String) when is_binary(String) ->
+    to_lower(?b2l(String));
+to_lower(String) ->
+    string:to_lower(String).
 
 handle_headers(_Config, _Origin, []) ->
     [];


Mime
View raw message