jQuery: The Write Less, Do More JavaScript Library

Ticket #1450 (closed bug: fixed)

Opened 1 year ago

Last modified 9 months ago

IE mangles HTTP response status code 204 to 1223

Reported by: amartone Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.2.2 Component: ajax
Version: 1.1.3 Keywords: xmlhttprequest IE 204 1223
Cc: Needs: Review

Description

I've come across some strange behavior in IE7. Sometimes when an XmlHttpRequest? receives a 204 (No Content) HTTP status code on the response, IE sets the XmlHttpRequest? object's status property to 1223. In my code, this seems to be happening when my server is returning a 204 from a PUT request - IE seems to be handling the 204 from a DELETE request okay.

Anyhow, jQuery's httpSuccess function is (quite understandably) interpreting the 1223 response as a failure. I tacked on another condition to the end of the if statement (line 1939 in jquery-1.1.3.1.js):

jQuery.browser.msie && r.status == 1223

This seems to fix the problem. However, my overall jQuery knowledge is pretty limited, so I'm not aware of any potential side effects.

A quick Google search turns up a few references to this bug on the intertubes, but I can't find anything on MSDN (surprise surprise). Yahoo's toolkit normalizes the 1223 response back to 204 (search for 1223 below):

http://developer.yahoo.com/yui/docs/connection.js.html

Any chance a fix for this can make it into the next version of jQuery?

Attachments

Change History

Changed 9 months ago by davidserduke

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 1.1.4 to 1.2.2

Fixed in [3977]. Now 1223 status is treated as success. I couldn't write code to normalize the status because jQuery uses the actual XHR object. Also I couldn't reproduce the bug since I don't know exactly what causes it, but I did a fair amount of internet reading and it does appear to be an actual bug so I think the fix is still warrented.

Note: See TracTickets for help on using tickets.