--- a/src/main/resources/scripts/Utils.js Fri Aug 26 10:04:06 2011 -0400
+++ b/src/main/resources/scripts/Utils.js Fri Aug 26 11:39:26 2011 -0400
@@ -6,7 +6,6 @@
// wait for at least 2 consecutive GPS data before declaring the GPS ready
gps_max_errors : 2
-
};
var Util = {
@@ -147,6 +146,11 @@
xhr.setRequestHeader("Content-Type", (!!resource.contentType)? resource.contentType : "application/octet-stream");
xhr.setRequestHeader("Content-Length", resource.data.length);
xhr.setRequestHeader("Accept", "text/plain");
+ if (!!resource.userId && !!resource.passwd) {
+ // we do basic auth
+ xhr.setRequestHeader("Authorization",
+ Base64.encode('Basic ' + resource.userId + ':' + resource.passwd));
+ }
xhr.send(resource.data);
} catch (e) {
Util.log("Failed to send to server " + e);