couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r950531 - in /couchdb/branches/0.11.x: share/www/custom_test.html share/www/script/couch_test_runner.js share/www/script/couch_tests.js src/couchdb/couch_httpd_auth.erl
Date Wed, 02 Jun 2010 12:24:53 GMT
Author: jan
Date: Wed Jun  2 12:24:53 2010
New Revision: 950531

URL: http://svn.apache.org/viewvc?rev=950531&view=rev
Log:
Merge r935737 from trunk:

Fix to close users db immediately after authentication.

Modified:
    couchdb/branches/0.11.x/share/www/custom_test.html
    couchdb/branches/0.11.x/share/www/script/couch_test_runner.js
    couchdb/branches/0.11.x/share/www/script/couch_tests.js
    couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl

Modified: couchdb/branches/0.11.x/share/www/custom_test.html
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/custom_test.html?rev=950531&r1=950530&r2=950531&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/custom_test.html (original)
+++ couchdb/branches/0.11.x/share/www/custom_test.html Wed Jun  2 12:24:53 2010
@@ -26,6 +26,8 @@ specific language governing permissions 
     <script src="script/futon.js?0.11.0"></script>
     <script src="script/jquery.resizer.js?0.11.0"></script>
     <script src="script/couch.js?0.11.0"></script>
+    <script src="script/couch_test_runner.js?0.11.0"></script>
+    
     <script>
       function T(arg, desc) {
         if(!arg) {

Modified: couchdb/branches/0.11.x/share/www/script/couch_test_runner.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/couch_test_runner.js?rev=950531&r1=950530&r2=950531&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/couch_test_runner.js (original)
+++ couchdb/branches/0.11.x/share/www/script/couch_test_runner.js Wed Jun  2 12:24:53 2010
@@ -328,3 +328,96 @@ function repr(val) {
   }
 }
 
+function makeDocs(start, end, templateDoc) {
+  var templateDocSrc = templateDoc ? JSON.stringify(templateDoc) : "{}"
+  if (end === undefined) {
+    end = start;
+    start = 0;
+  }
+  var docs = []
+  for (var i = start; i < end; i++) {
+    var newDoc = eval("(" + templateDocSrc + ")");
+    newDoc._id = (i).toString();
+    newDoc.integer = i;
+    newDoc.string = (i).toString();
+    docs.push(newDoc)
+  }
+  return docs;
+}
+
+function run_on_modified_server(settings, fun) {
+  try {
+    // set the settings
+    for(var i=0; i < settings.length; i++) {
+      var s = settings[i];
+      var xhr = CouchDB.request("PUT", "/_config/" + s.section + "/" + s.key, {
+        body: JSON.stringify(s.value),
+        headers: {"X-Couch-Persist": "false"}
+      });
+      CouchDB.maybeThrowError(xhr);
+      s.oldValue = xhr.responseText;
+    }
+    // run the thing
+    fun();
+  } finally {
+    // unset the settings
+    for(var j=0; j < i; j++) {
+      var s = settings[j];
+      if(s.oldValue == "\"\"\n") { // unset value
+        CouchDB.request("DELETE", "/_config/" + s.section + "/" + s.key, {
+          headers: {"X-Couch-Persist": "false"}
+        });
+      } else {
+        CouchDB.request("PUT", "/_config/" + s.section + "/" + s.key, {
+          body: s.oldValue,
+          headers: {"X-Couch-Persist": "false"}
+        });
+      }
+    }
+  }
+}
+
+function stringFun(fun) {
+  var string = fun.toSource ? fun.toSource() : "(" + fun.toString() + ")";
+  return string;
+}
+
+function waitForSuccess(fun, tag) {
+  var start = new Date();
+  while(true) {
+    if (new Date() - start > 5000) {
+      throw("timeout: "+tag);
+    } else {
+      try {
+        fun();
+        break;
+      } catch (e) {}
+      // sync http req allow async req to happen
+      CouchDB.request("GET", "/test_suite_db/?tag="+encodeURIComponent(tag));
+    }
+  }
+}
+
+function waitForRestart() {
+  var waiting = true;
+  while (waiting) {
+    try {
+      CouchDB.request("GET", "/");
+      CouchDB.request("GET", "/");
+      waiting = false;
+    } catch(e) {
+      // the request will fail until restart completes
+    }
+  }
+};
+
+function restartServer() {
+  var xhr;
+  try {
+    CouchDB.request("POST", "/_restart");
+  } catch(e) {
+    // this request may sometimes fail
+  }
+  waitForRestart();
+}
+

Modified: couchdb/branches/0.11.x/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/www/script/couch_tests.js?rev=950531&r1=950530&r2=950531&view=diff
==============================================================================
--- couchdb/branches/0.11.x/share/www/script/couch_tests.js [utf-8] (original)
+++ couchdb/branches/0.11.x/share/www/script/couch_tests.js [utf-8] Wed Jun  2 12:24:53 2010
@@ -93,62 +93,3 @@ loadTest("view_pagination.js");
 loadTest("view_sandboxing.js");
 loadTest("view_xml.js");
 // keep sorted
-
-
-function makeDocs(start, end, templateDoc) {
-  var templateDocSrc = templateDoc ? JSON.stringify(templateDoc) : "{}"
-  if (end === undefined) {
-    end = start;
-    start = 0;
-  }
-  var docs = []
-  for (var i = start; i < end; i++) {
-    var newDoc = eval("(" + templateDocSrc + ")");
-    newDoc._id = (i).toString();
-    newDoc.integer = i;
-    newDoc.string = (i).toString();
-    docs.push(newDoc)
-  }
-  return docs;
-}
-
-function run_on_modified_server(settings, fun) {
-  try {
-    // set the settings
-    for(var i=0; i < settings.length; i++) {
-      var s = settings[i];
-      var xhr = CouchDB.request("PUT", "/_config/" + s.section + "/" + s.key, {
-        body: JSON.stringify(s.value),
-        headers: {"X-Couch-Persist": "false"}
-      });
-      CouchDB.maybeThrowError(xhr);
-      s.oldValue = xhr.responseText;
-    }
-    // run the thing
-    fun();
-  } finally {
-    // unset the settings
-    for(var j=0; j < i; j++) {
-      var s = settings[j];
-      if(s.oldValue == "\"\"\n") { // unset value
-        CouchDB.request("DELETE", "/_config/" + s.section + "/" + s.key, {
-          headers: {"X-Couch-Persist": "false"}
-        });
-      } else {
-        CouchDB.request("PUT", "/_config/" + s.section + "/" + s.key, {
-          body: s.oldValue,
-          headers: {"X-Couch-Persist": "false"}
-        });
-      }
-    }
-  }
-}
-
-function stringFun(fun) {
-  var string = fun.toSource ? fun.toSource() : "(" + fun.toString() + ")";
-  return string;
-}
-
-function restartServer() {
-  CouchDB.request("POST", "/_restart");
-}

Modified: couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl?rev=950531&r1=950530&r2=950531&view=diff
==============================================================================
--- couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl (original)
+++ couchdb/branches/0.11.x/src/couchdb/couch_httpd_auth.erl Wed Jun  2 12:24:53 2010
@@ -202,6 +202,8 @@ get_user_props_from_db(UserName) ->
     catch
         throw:_Throw ->
             nil
+    after
+        couch_db:close(Db)
     end.
 
 % this should handle creating the ddoc



Mime
View raw message