http = createHTTPClient();
http.open("POST", url, false /* not async */);
http.send("");
+ http.setRequestHeader("Content-Length", 0);
if (http.status != 200) { /* request failed */
failCount++;
http = null;
http.open("POST", url, false /* not async */);
http.url = url;
http.send("");
+ http.setRequestHeader("Content-Length", 0);
if (isHttpStatus204(http.status))
refreshTasks();
} else
checkAjaxRequestsState();
}
}
- catch( e ) {
+ catch (e) {
activeAjaxRequests -= 1;
checkAjaxRequestsState();
log("AJAX Request, Caught Exception: " + e.name);
log(backtrace());
}
};
+ var hasContentLength = false;
if (headers) {
- for (var i in headers)
+ for (var i in headers) {
+ if (i.toLowerCase() == "content-length")
+ hasContentLength = true;
http.setRequestHeader(i, headers[i]);
+ }
+ }
+ if (!hasContentLength) {
+ var cLength = "0";
+ if (content)
+ cLength = "" + content.length;
+ http.setRequestHeader("Content-Length", "" + cLength);
}
http.send(content);
}
var http = createHTTPClient();
http.open("GET", url, false);
http.send("");
+
if (http.status == 200) {
if (http.responseText.length > 0)
userDefaults = http.responseText.evalJSON(true);