Opened 11 years ago

Closed 11 years ago

#8228 closed defect (fixed)

[patch][ccla]IE7: dojox.json.Rest range is undefined, causes exception

Reported by: Adam Peller Owned by: Dustin Machi
Priority: high Milestone: 1.3
Component: RPC Version: 1.2.2
Keywords: Cc: hbadenes@…, Kris Zyp
Blocked By: Blocking:

Description

This comes from Hernan Badenes (IBM, CCLA)

In dojox.json.Rest, a request object is created that is later used to build a XHR object. These arguments object contains the headers that will be sent in the HTTP GET (or POST, or ...): "Accept" and "Range". When querying for an individual object, the Range is assigned the value undefined. This throws an exception "Invalid procedure call or argument" in Internet Explorer (I tested IE7). (The exact place is in dojo._base.xhr, line 664, "xhr.setRequestHeader(hdr, args.headers[hdr]);")

The problem is that IE7 does not accept to setRequestHeader(propName, undefined). To avoid this, I think that dojox.rpc.Rest should not set that Range===undefined, but just skip it from the parameters when not using it.

Attached is a testcase that exposes this problem by just doing:

var store = new dojox.data.JsonRestStore?({ target: "/foo" }); store.byId({ identity: "42" });

this should perform a GET and likely yield in a http 404. But in IE7 it throws an exception. The code to patch is in Rest.js:

service._getRequest = getRequest
function(id, args){

return {

(...) headers: {

(...)

Range: args && (args.start >= 0
args.count >= 0) ? "items=" + (args.start '0') + '-'

+ ((args.count && (args.count + (args.start 0) - 1)) ) : undefined

}

};

};

that "Range" property should be avoided. A proposed patch is attached as well.

Attachments (2)

rpc.patch (1.2 KB) - added by Adam Peller 11 years ago.
don't set Range in headers unless it's going to be defined
test8228.html (890 bytes) - added by Adam Peller 11 years ago.
test from Hernan

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by Adam Peller

Attachment: rpc.patch added

don't set Range in headers unless it's going to be defined

comment:1 Changed 11 years ago by Adam Peller

Cc: hbadenes@… Kris Zyp added

comment:2 Changed 11 years ago by Adam Peller

Summary: IE7: dojox.json.Rest range is undefined, causes exception[patch][ccla]IE7: dojox.json.Rest range is undefined, causes exception

Changed 11 years ago by Adam Peller

Attachment: test8228.html added

test from Hernan

comment:3 Changed 11 years ago by Adam Peller

Milestone: tbd1.3

comment:4 Changed 11 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [16106]) Don't set Range in headers unless it's going to be defined. Fixes #8228. Thanks, Hernan.

Note: See TracTickets for help on using tickets.