couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r819735 - in /couchdb/branches/0.10.x: ./ etc/default/couchdb share/www/script/test/uuids.js src/couchdb/couch_httpd_misc_handlers.erl
Date Mon, 28 Sep 2009 21:11:22 GMT
Author: davisp
Date: Mon Sep 28 21:11:22 2009
New Revision: 819735

URL: http://svn.apache.org/viewvc?rev=819735&view=rev
Log:
Backport the fix for the UUID's tests.


Modified:
    couchdb/branches/0.10.x/   (props changed)
    couchdb/branches/0.10.x/etc/default/couchdb   (props changed)
    couchdb/branches/0.10.x/share/www/script/test/uuids.js
    couchdb/branches/0.10.x/src/couchdb/couch_httpd_misc_handlers.erl

Propchange: couchdb/branches/0.10.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 21:11:22 2009
@@ -3,4 +3,4 @@
 /couchdb/branches/form:729440-730015
 /couchdb/branches/list-iterator:782292-784593
 /couchdb/branches/tail_header:775760-778477
-/couchdb/trunk:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817278,817398,817400,817403,817749,817793,818249,819436
+/couchdb/trunk:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817278,817398,817400,817403,817749,817793,818249,819091,819436

Propchange: couchdb/branches/0.10.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 28 21:11:22 2009
@@ -3,5 +3,5 @@
 /couchdb/branches/form/etc/default/couchdb:729440-730015
 /couchdb/branches/list-iterator/etc/default/couchdb:782292-784593
 /couchdb/branches/tail_header/etc/default/couchdb:775760-778477
-/couchdb/trunk/etc/default/couchdb:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817277-817278,817398,817400,817403,817749,817793,818249,819436
+/couchdb/trunk/etc/default/couchdb:806983,807208-807478,807771,808574,808632,808716,808876,809134,809977,810015,810028,810350,810358,810435,811910,813803,815921,817277-817278,817398,817400,817403,817749,817793,818249,819091,819436
 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440

Modified: couchdb/branches/0.10.x/share/www/script/test/uuids.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/share/www/script/test/uuids.js?rev=819735&r1=819734&r2=819735&view=diff
==============================================================================
--- couchdb/branches/0.10.x/share/www/script/test/uuids.js (original)
+++ couchdb/branches/0.10.x/share/www/script/test/uuids.js Mon Sep 28 21:11:22 2009
@@ -11,16 +11,25 @@
 // the License.
 
 couchTests.uuids = function(debug) {
+  var etags = [];
   var testHashBustingHeaders = function(xhr) {
     T(xhr.getResponseHeader("Cache-Control").match(/no-cache/));
     T(xhr.getResponseHeader("Pragma") == "no-cache");
 
-    var currentTime = new Date();
-    var expiresHeader = Date.parse(xhr.getResponseHeader("Expires"));
-    var dateHeader = Date.parse(xhr.getResponseHeader("Date"));
+    var newetag = xhr.getResponseHeader("ETag");
+    T(etags.indexOf(newetag) < 0);
+    etags[etags.length] = newetag;
+    
+    // Removing the time based tests as they break easily when
+    // running CouchDB on a remote server in regards to the browser
+    // running the Futon test suite.
+    //
+    //var currentTime = new Date();
+    //var expiresHeader = Date.parse(xhr.getResponseHeader("Expires"));
+    //var dateHeader = Date.parse(xhr.getResponseHeader("Date"));
 
-    T(expiresHeader < currentTime);
-    T(currentTime - dateHeader < 3000);
+    //T(expiresHeader < currentTime);
+    //T(currentTime - dateHeader < 3000);
   };
 
   var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});

Modified: couchdb/branches/0.10.x/src/couchdb/couch_httpd_misc_handlers.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.10.x/src/couchdb/couch_httpd_misc_handlers.erl?rev=819735&r1=819734&r2=819735&view=diff
==============================================================================
--- couchdb/branches/0.10.x/src/couchdb/couch_httpd_misc_handlers.erl (original)
+++ couchdb/branches/0.10.x/src/couchdb/couch_httpd_misc_handlers.erl Mon Sep 28 21:11:22
2009
@@ -106,14 +106,20 @@
 
 handle_uuids_req(#httpd{method='GET'}=Req) ->
     Count = list_to_integer(couch_httpd:qs_value(Req, "count", "1")),
-    CacheBustingHeaders = [{"Date", httpd_util:rfc1123_date()},
-                           {"Cache-Control", "no-cache"},
-                           {"Expires", "Fri, 01 Jan 1990 00:00:00 GMT"},  % Past date, ON
PURPOSE!
-                           {"Pragma", "no-cache"}],
     % generate the uuids
     UUIDs = [ couch_util:new_uuid() || _ <- lists:seq(1,Count)],
     % send a JSON response
-    send_json(Req, 200, CacheBustingHeaders, {[{<<"uuids">>, UUIDs}]});
+    couch_httpd:etag_respond(Req, erlang:md5(UUIDs), fun() ->
+        CacheBustingHeaders = [
+            {"Date", httpd_util:rfc1123_date()},
+            {"Cache-Control", "no-cache"},
+            % Past date, ON PURPOSE!
+            {"Expires", "Fri, 01 Jan 1990 00:00:00 GMT"},
+            {"Pragma", "no-cache"},
+            {"ETag", erlang:md5(UUIDs)}
+        ],
+        send_json(Req, 200, CacheBustingHeaders, {[{<<"uuids">>, UUIDs}]})
+    end);
 handle_uuids_req(Req) ->
     send_method_not_allowed(Req, "GET").
 



Mime
View raw message