commit 5f1c753f9fbe9812a79a27ca4bf00696fae64dbd Author: Chang Lan changlan9@gmail.com Date: Mon Mar 31 18:15:20 2014 -0700
base64 decode/encode --- chrome/extension/background.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/chrome/extension/background.js b/chrome/extension/background.js index 5d337fb..edb99ee 100644 --- a/chrome/extension/background.js +++ b/chrome/extension/background.js @@ -37,7 +37,7 @@ chrome.runtime.onMessageExternal.addListener(function(request, header, sendRespo xhr.onreadystatechange = function() { if (xhr.readyState == 4) { chrome.webRequest.onBeforeSendHeaders.removeListener(onBeforeSendHeadersCallback); - var response = {status: xhr.status, body: xhr.responseText }; + var response = {status: xhr.status, body: btoa(xhr.responseText) }; sendResponse(response); } }; @@ -55,7 +55,9 @@ chrome.runtime.onMessageExternal.addListener(function(request, header, sendRespo } var body = null; if (request.body != undefined) { - body = request.body; + body = atob(request.body); + xhr.setRequestHeader("Content-Type", "application/octet-stream"); + console.log(body); }
chrome.webRequest.onBeforeSendHeaders.addListener(onBeforeSendHeadersCallback, {
tor-commits@lists.torproject.org