Ticket #4044 (closed bug: invalid)
$.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: | ||
| Blocking: | Blocked by: |
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
Change History
Changed 4 years ago by garrett
-
attachment
jQuery-1.2.6-xhr-proxy.patch
added
comment:2 Changed 4 years ago by dmethvin
- Summary changed from sending XHR posts with null bodies through a proxy (such as Squid) does not work in Firefox to $.ajax POST in Firefox fails with a null data parameter
Another vote to fix in dup #4667.
comment:3 Changed 4 years ago by jamon
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.
comment:5 follow-up: ↓ 6 Changed 3 years ago by snover
- Owner set to garrett
- Status changed from new to pending
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.
comment:6 in reply to: ↑ 5 ; follow-up: ↓ 7 Changed 3 years ago by jess.hottenstein@…
Replying to 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+.
comment:7 in reply to: ↑ 6 Changed 3 years ago by jess.hottenstein@…
Replying to 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
comment:8 Changed 2 years ago by trac-o-bot
- Status changed from pending to closed
- Resolution set to invalid
Automatically closed due to 14 days of inactivity.
comment:10 in reply to: ↑ 9 Changed 2 years ago by jitter
comment:11 Changed 2 years ago by katiegengler
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.
comment:12 Changed 2 months ago by anonymous
Same problem still exists
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

fix for jQuery 1.2.6