couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasondav...@apache.org
Subject svn commit: r815813 - in /couchdb/trunk/share/www/script/test: cookie_auth.js oauth.js
Date Wed, 16 Sep 2009 14:46:53 GMT
Author: jasondavies
Date: Wed Sep 16 14:46:53 2009
New Revision: 815813

URL: http://svn.apache.org/viewvc?rev=815813&view=rev
Log:
Make generateSecret() generate valid UTF-8 in oauth and cookie_auth
tests.

Modified:
    couchdb/trunk/share/www/script/test/cookie_auth.js
    couchdb/trunk/share/www/script/test/oauth.js

Modified: couchdb/trunk/share/www/script/test/cookie_auth.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/cookie_auth.js?rev=815813&r1=815812&r2=815813&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/cookie_auth.js (original)
+++ couchdb/trunk/share/www/script/test/cookie_auth.js Wed Sep 16 14:46:53 2009
@@ -20,12 +20,14 @@
 
   // Simple secret key generator
   function generateSecret(length) {
+    var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
     var secret = '';
     for (var i=0; i<length; i++) {
-      secret += String.fromCharCode(Math.floor(Math.random() * 256));
+      secret += tab.charAt(Math.floor(Math.random() * 64));
     }
     return secret;
   }
+
   // this function will be called on the modified server
   var testFun = function () {
     try {

Modified: couchdb/trunk/share/www/script/test/oauth.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/oauth.js?rev=815813&r1=815812&r2=815813&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/oauth.js (original)
+++ couchdb/trunk/share/www/script/test/oauth.js Wed Sep 16 14:46:53 2009
@@ -29,9 +29,10 @@
 
   // Simple secret key generator
   function generateSecret(length) {
+    var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
     var secret = '';
     for (var i=0; i<length; i++) {
-      secret += String.fromCharCode(Math.floor(Math.random() * 256));
+      secret += tab.charAt(Math.floor(Math.random() * 64));
     }
     return secret;
   }



Mime
View raw message