Skip to main content

Bug Tracker

Side navigation

#4044 closed bug (invalid)

Opened February 02, 2009 07:59PM UTC

Closed December 02, 2010 08:07AM UTC

Last modified March 21, 2013 06:29PM UTC

$.ajax POST in Firefox fails with a null data parameter

Reported by: garrett Owned by: garrett
Priority: major Milestone: 1.4.3
Component: ajax Version: 1.3.1
Keywords: Cc:
Blocked by: Blocking:
Description

Firefox has a bug where it does not send a Content-Length of 0 in a post when the post's body is omitted. Ordinarily, this works well with popular webservers... however, Squid (and possibly other proxies) complain and refuse to actually post.

Simply setting a Content-Length does not solve this issue; Firefox does not transmit custom Content-Length headers. The solution is to send an empty string instead of null. This makes Firefox send a Content-Length, and as a result, Squid is happy.

I am attaching patches for both jQuery 1.2.6 and 1.3.1 which fix this issue.

Attachments (2)
Change History (12)

Changed May 16, 2009 03:19AM UTC by dmethvin comment:1

See als dup #4664.

Changed May 19, 2009 12:20AM UTC by dmethvin comment:2

summary: sending XHR posts with null bodies through a proxy (such as Squid) does not work in Firefox$.ajax POST in Firefox fails with a null data parameter

Another vote to fix in dup #4667.

Changed June 23, 2009 09:21PM UTC by jamon comment:3

This problem also exists with other HTTP methods that have content. In our case, we ran into it with "PROPFIND" (writing a Webdav client in jquery). The latest patch does not resolve this case.

Changed June 15, 2010 02:43AM UTC by dmethvin comment:4

milestone: 1.3.21.4.3

Changed October 31, 2010 09:19AM UTC by snover comment:5

owner: → garrett
status: newpending

Please confirm this is still an issue in the latest version of jQuery and supported versions of Firefox (3+ only). If this issue no longer occurs, you do not need to respond; the ticket will close automatically in 30 days.

Changed November 12, 2010 07:20PM UTC by jess.hottenstein@gmail.com comment:6

Replying to [comment:5 snover]:

Please confirm this is still an issue in the latest version of jQuery and supported versions of Firefox (3+ only). If this issue no longer occurs, you do not need to respond; the ticket will close automatically in 30 days.

This is still a problem in jQuery 1.4.3 with Firefox 3.0+.

Changed November 12, 2010 08:25PM UTC by jess.hottenstein@gmail.com comment:7

Replying to [comment:6 jess.hottenstein@…]:

This is still a problem in jQuery 1.4.3 with Firefox 3.0+.

Correction. This is a problem in jQuery 1.4.x with Firefox 3.0.x. As this only occurs with a squid proxy, I do not know how to duplicate this with fiddler. I have attached the request and response headers to my empty post request.

Response Headers

Date Fri, 12 Nov 2010 19:45:30 GMT

Server squid/2.6.STABLE21

Content-Type text/html; charset=UTF-8

Content-Length 2054

Expires Fri, 12 Nov 2010 19:45:30 GMT

X-Squid-Error ERR_INVALID_REQ 0

X-Cache MISS from fw.example.com

X-Cache-Lookup NONE from fw.example.com:3128

Via 1.0 fw.example.com:3128 (squid/2.6.STABLE21)

Connection close

Request Headers

Host ********

User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.19) Gecko/2010031706 Red Hat/3.0.19-1.el5_5 Firefox/3.0.19

Accept text/javascript, application/javascript, */*; q=0.01

Accept-Language en-us,en;q=0.5

Accept-Encoding gzip,deflate

Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive 300

Connection keep-alive

X-Requested-With XMLHttpRequest

Referer https://**************

Cookie ************

Pragma no-cache

Cache-Control no-cache

Changed December 02, 2010 08:07AM UTC by trac-o-bot comment:8

resolution: → invalid
status: pendingclosed

Automatically closed due to 14 days of inactivity.

Changed February 17, 2011 08:58PM UTC by katiegengler comment:9

This is still happening in jQuery 1.5

Changed February 18, 2011 02:22PM UTC by jitter comment:10

Replying to [comment:9 katiegengler]:

This is still happening in jQuery 1.5

How to report bugs

Changed February 18, 2011 03:56PM UTC by katiegengler comment:11

The same problem exists in jQuery 1.5; the problem was already described sufficiently. It is the combination of Squid, FF3 and jQuery. As this bug was closed invalid by a bot for inactivity, that does not necessarily mean that it should never be fixed.

Changed March 21, 2013 06:29PM UTC by anonymous comment:12

Same problem still exists