Skip to main content

Bug Tracker

Side navigation

#4664 closed bug (duplicate)

Opened May 15, 2009 08:35PM UTC

Closed May 16, 2009 03:19AM UTC

$.ajax() WITH null data property in config object results in missing Content-Length header in FF3

Reported by: rmurphey Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

(See the full thread at http://groups.google.com/group/jquery-dev/browse_thread/thread/fe76bdc97c6f727b/c178b67e55b2d3d6?lnk=gst&q=length)

I had an ajax request as follows:

var myData = null;

$.ajax({
  'url' : 'foo.php',
  'data' : myData,
  'type' : 'POST',
  'dataType' : 'json',
  'success' : function(j) {
    // whatever
  }

});

Client was reporting a 411 HTTP response code on the request -- their proxy was expecting a Content-Length header on the request, and wasn't getting one. This also occurred if myData was undefined. It did *not* occur when myData was {}.

We hadn't detected this error internally because our requests weren't proxy'd. It seems Content-Length "should" always be there

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13

and should be 0 if myData is null or undefined.

I'm not sure whether this is just a Firefox issue, or something that jQuery should address in the spirit of abstracting away browser differences?

Attachments (0)
Change History (1)

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

resolution: → duplicate
status: newclosed

Dup of #4044.