From 425585fafeaf9d3cc796bc01c2a7c050149b2ceb Mon Sep 17 00:00:00 2001 From: wolfgang Date: Tue, 22 Jan 2008 21:21:30 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1334 d1b88da0-ebda-0310-925b-ed51d893ca5b --- UI/WebServerResources/ContactsUI.js | 1 + UI/WebServerResources/SchedulerUI.js | 1 + UI/WebServerResources/generic.js | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/UI/WebServerResources/ContactsUI.js b/UI/WebServerResources/ContactsUI.js index 5b6599c8..bb30036a 100644 --- a/UI/WebServerResources/ContactsUI.js +++ b/UI/WebServerResources/ContactsUI.js @@ -398,6 +398,7 @@ function uixDeleteSelectedContacts(sender) { 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; diff --git a/UI/WebServerResources/SchedulerUI.js b/UI/WebServerResources/SchedulerUI.js index 012688b2..1cc1cca4 100644 --- a/UI/WebServerResources/SchedulerUI.js +++ b/UI/WebServerResources/SchedulerUI.js @@ -1261,6 +1261,7 @@ function updateTaskStatus(event) { http.open("POST", url, false /* not async */); http.url = url; http.send(""); + http.setRequestHeader("Content-Length", 0); if (isHttpStatus204(http.status)) refreshTasks(); } else diff --git a/UI/WebServerResources/generic.js b/UI/WebServerResources/generic.js index d1650aa0..eee7bbc3 100644 --- a/UI/WebServerResources/generic.js +++ b/UI/WebServerResources/generic.js @@ -334,7 +334,7 @@ function triggerAjaxRequest(url, callback, userdata, content, headers) { checkAjaxRequestsState(); } } - catch( e ) { + catch (e) { activeAjaxRequests -= 1; checkAjaxRequestsState(); log("AJAX Request, Caught Exception: " + e.name); @@ -342,9 +342,19 @@ function triggerAjaxRequest(url, callback, userdata, content, headers) { 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); } @@ -1355,6 +1365,7 @@ function loadPreferences() { var http = createHTTPClient(); http.open("GET", url, false); http.send(""); + if (http.status == 200) { if (http.responseText.length > 0) userDefaults = http.responseText.evalJSON(true); -- 2.39.5