Rest range incorrect for count < 2
In dojox/rpc/Rest.js, on line 99 when count is 0 or 1 the resulting Range header will be incorrect. Assuming start === 0, the current code produces items=0- for count === 0 and count === 1. The correct value is items=0-0 for both of those cases.
I offer the following replacement for the super long current line:
if (args && (args.start >= 0 || args.count >= 0)) {
var start = args.start || 0;
var range = 'items=' + start + '-';
if (args.count !== undefined && args.count != Infinity) {
if (args.count === 0) {
// minimum is one because last-pos must be >= first-pos
// according to 14.35 in http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
range += start;
} else {
range += args.count + start - 1;
}
}
request.headers.Range = range;
}
Change History (4)
Cc: |
Dustin Machi added
|
Owner: |
changed from anonymous to Kris Zyp
|
Resolution: |
→ fixed
|
Status: |
new →
closed
|
(In [23369]) Fix range handling when count is 0 or 1, fixes #11850