Skip to main content

Bug Tracker

Side navigation

Ticket #4044: jQuery-1.3.1-xhr-proxy.patch


File jQuery-1.3.1-xhr-proxy.patch, 0.8 KB (added by garrett, February 02, 2009 08:02PM UTC)

fix for jQuery 1.3.1

commit 423ffe1063d62e8f48e6641f7238b6fa0ee5c107
Author: Garrett LeSage 
Date:   Mon Feb 2 20:43:35 2009 +0100

    adding proxy workaround for Firefox not sending a Content-Length header for empty-bodied POSTs

diff --git a/jquery/src/ajax.js b/jquery/src/ajax.js
index 8262bc7..c719670 100644
--- a/jquery/src/ajax.js
+++ b/jquery/src/ajax.js
@@ -404,6 +404,13 @@ jQuery.extend({
 
 		// Send the data
 		try {
+			if (jQuery.browser.mozilla && type == "POST" && s.data === null) {
+				// Firefox fails to send the Content-Length header on
+				// POST requests with null passed to send,
+				// causing an issue with Squid proxies.
+				// (Setting a "Content-Length: 0" header does not work.)
+				s.data = '';
+			}
 			xhr.send(s.data);
 		} catch(e) {
 			jQuery.handleError(s, xhr, null, e);

Download in other formats:

Original Format