You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ry...@apache.org on 2013/07/24 23:40:14 UTC

[1/3] git commit: updated refs/heads/master to b455740

Updated Branches:
  refs/heads/master 54fd258ed -> b45574065


Test for COUCHDB-1679. Showing how the etag breaks cors


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

Branch: refs/heads/master
Commit: 02357223d3618467494a858ec9bae38352238261
Parents: 2cc0630
Author: Ryan Ramage <ry...@gmail.com>
Authored: Wed Mar 13 15:04:34 2013 -0600
Committer: Ryan Ramage <ry...@gmail.com>
Committed: Wed Mar 13 15:04:34 2013 -0600

----------------------------------------------------------------------
 test/etap/231-cors.t | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/02357223/test/etap/231-cors.t
----------------------------------------------------------------------
diff --git a/test/etap/231-cors.t b/test/etap/231-cors.t
index a150867..ce52747 100644
--- a/test/etap/231-cors.t
+++ b/test/etap/231-cors.t
@@ -256,6 +256,20 @@ test_doc_with_attachment_range_request() ->
         etap:is(false, true, "ibrowse failed")
     end.
 
+% COUCHDB-1697
+test_if_none_match_header() ->
+    Url = server() ++ "etap-test-db/doc2",
+    Headers = [{"Origin", "http://example.com"}],
+    {ok, _, _RespHeaders, _} = ibrowse:send_req(Url, Headers, get, []),
+    ETag = proplists:get_value("ETag", _RespHeaders),
+    Headers2 = [{"Origin", "http://example.com"}, {"If-None-Match", ETag}],
+    case ibrowse:send_req(Url, Headers2, get, []) of
+    {ok, Code, _RespHeaders2, _} ->
+        etap:is(Code, "304", "Responded with Not Modified");
+    _ ->
+        etap:is(false, true, "ibrowse failed")
+    end.
+
 test_db_request_credentials_header_off() ->
     Headers = [{"Origin", "http://example.com"}],
     Url = server() ++ "etap-test-db",


[2/3] git commit: updated refs/heads/master to b455740

Posted by ry...@apache.org.
Check that the content-type from the RequestHeaders is not undefined. Fixes COUCHDB-1697


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

Branch: refs/heads/master
Commit: bc3ef5b8cfd58b9d07868c1267c4099f994e53d8
Parents: 0235722
Author: Ryan Ramage <ry...@gmail.com>
Authored: Wed Mar 13 15:09:40 2013 -0600
Committer: Ryan Ramage <ry...@gmail.com>
Committed: Wed Mar 13 15:09:40 2013 -0600

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


http://git-wip-us.apache.org/repos/asf/couchdb/blob/bc3ef5b8/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"]);


[3/3] git commit: updated refs/heads/master to b455740

Posted by ry...@apache.org.
Merge branch '1697-fix-if-non-match-cors'


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

Branch: refs/heads/master
Commit: b45574065b7a7eebc8d017d789b64807fdd05fa7
Parents: 54fd258 bc3ef5b
Author: Ryan Ramage <ry...@gmail.com>
Authored: Wed Jul 24 15:37:10 2013 -0600
Committer: Ryan Ramage <ry...@gmail.com>
Committed: Wed Jul 24 15:37:10 2013 -0600

----------------------------------------------------------------------
 src/couchdb/couch_httpd_cors.erl | 12 ++++++++----
 test/etap/231-cors.t             | 14 ++++++++++++++
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------