diff options
author | Jason David Davies <jasondavies@apache.org> | 2009-09-16 14:46:53 +0000 |
---|---|---|
committer | Jason David Davies <jasondavies@apache.org> | 2009-09-16 14:46:53 +0000 |
commit | b476d9dcbff061759e5eda840c3e08190fde4d36 (patch) | |
tree | 062a4ef534e1e0957710febd4e9089fd817662c5 /share/www | |
parent | 505e1110371c6f88bfb4d293b68033a09284895b (diff) |
Make generateSecret() generate valid UTF-8 in oauth and cookie_auth
tests.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@815813 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r-- | share/www/script/test/cookie_auth.js | 4 | ||||
-rw-r--r-- | share/www/script/test/oauth.js | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/share/www/script/test/cookie_auth.js b/share/www/script/test/cookie_auth.js index d029e851..d82d302a 100644 --- a/share/www/script/test/cookie_auth.js +++ b/share/www/script/test/cookie_auth.js @@ -20,12 +20,14 @@ couchTests.cookie_auth = function(debug) { // 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 { diff --git a/share/www/script/test/oauth.js b/share/www/script/test/oauth.js index 8b71d745..ebe817b2 100644 --- a/share/www/script/test/oauth.js +++ b/share/www/script/test/oauth.js @@ -29,9 +29,10 @@ couchTests.oauth = function(debug) { // 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; } |