From da86949a927d2baa95e564bd93772e63e2a73bd4 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 26 Jun 2013 11:15:17 -0700 Subject: [PATCH] Fix UI's debug JSON verification Fixes https://code.google.com/p/camlistore/issues/detail?id=163 Change-Id: I6bdd57b9c47b6465ba01336a3a5f0487889ea327 --- server/camlistored/ui/server_connection.js | 9 +++------ server/camlistored/ui/sigdebug.js | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/server/camlistored/ui/server_connection.js b/server/camlistored/ui/server_connection.js index 02b1f632b..f67ac34bc 100644 --- a/server/camlistored/ui/server_connection.js +++ b/server/camlistored/ui/server_connection.js @@ -362,27 +362,24 @@ function(clearObj, success, opt_fail) { }; /** - * @param {Object} sObj Signed object. + * @param {Object} signed Signed JSON blob (string) to verify. * @param {Function} success Success callback. * @param {?Function} opt_fail Optional fail callback. * @private */ camlistore.ServerConnection.prototype.verify_ = -function(sObj, success, opt_fail) { +function(signed, success, opt_fail) { var sigConf = this.config_.signing; if (!sigConf || !sigConf.publicKeyBlobRef) { this.safeFail_(opt_fail)("Missing Camli.config.signing.publicKeyBlobRef"); return; } - - var clearText = JSON.stringify(sObj); - this.sendXhr_( sigConf.verifyHandler, goog.bind(this.handlePost_, this, success, this.safeFail_(opt_fail)), "POST", - "sjson=" + encodeURIComponent(clearText), + "sjson=" + encodeURIComponent(signed), {"Content-Type": "application/x-www-form-urlencoded"} ); }; diff --git a/server/camlistored/ui/sigdebug.js b/server/camlistored/ui/sigdebug.js index 10750e2e8..7b7d743d5 100644 --- a/server/camlistored/ui/sigdebug.js +++ b/server/camlistored/ui/sigdebug.js @@ -175,8 +175,7 @@ camlistore.DebugPage.prototype.doVerify_ = function() { return; } var signedta = goog.dom.getElement("signedjson"); - var sObj = JSON.parse(signedta.value); - this.connection_.verify_(sObj, + this.connection_.verify_(signedta.value, function(response) { var text = "
" + response + "
"; goog.dom.getElement("verifyinfo").innerHTML = text;