couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ryanram...@apache.org
Subject [2/2] git commit: Check that the content-type from the RequestHeaders is not undefined. Fixes COUCHDB-1697 (cherry picked from commit bc3ef5b8cfd58b9d07868c1267c4099f994e53d8)
Date Sun, 17 Mar 2013 17:59:22 GMT
Updated Branches:
  refs/heads/1.3.x 202f4b964 -> c1af2072b


Check that the content-type from the RequestHeaders is not undefined. Fixes COUCHDB-1697
(cherry picked from commit bc3ef5b8cfd58b9d07868c1267c4099f994e53d8)


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

Branch: refs/heads/1.3.x
Commit: c1af2072b6e12c0c25b89b3ca0ba799a95ef7370
Parents: 5632d72
Author: Ryan Ramage <ryan.ramage@gmail.com>
Authored: Wed Mar 13 15:09:40 2013 -0600
Committer: Ryan Ramage <ryan.ramage@gmail.com>
Committed: Sun Mar 17 11:57:05 2013 -0600

----------------------------------------------------------------------
 src/couchdb/couch_httpd_cors.erl |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/c1af2072/src/couchdb/couch_httpd_cors.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_cors.erl b/src/couchdb/couch_httpd_cors.erl
index 1ce890e..ce41557 100644
--- a/src/couchdb/couch_httpd_cors.erl
+++ b/src/couchdb/couch_httpd_cors.erl
@@ -216,10 +216,14 @@ maybe_apply_cors_headers(CorsHeaders, RequestHeaders0) ->
     % now we need to check whether the Content-Type valus is
     % in ?SIMPLE_CONTENT_TYPE_VALUES and if it isn’t add Content-
     % Type to to ExposedHeaders
-    ContentType = string:to_lower(
-        proplists:get_value("Content-Type", RequestHeaders0)),
-
-    IncludeContentType = lists:member(ContentType, ?SIMPLE_CONTENT_TYPE_VALUES),
+    ContentType =  proplists:get_value("Content-Type", RequestHeaders0),
+    IncludeContentType = case ContentType of
+    undefined ->
+        false;
+    _ ->
+        ContentType_ = string:to_lower(ContentType),
+        lists:member(ContentType_, ?SIMPLE_CONTENT_TYPE_VALUES)
+    end,
     ExposedHeaders = case IncludeContentType of
     false ->
         lists:umerge(ExposedHeaders0, ["Content-Type"]);


Mime
View raw message