Skip to content

Commit

Permalink
Merge branch 'master' into carddav
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedeboer committed Jan 7, 2013
2 parents 1644295 + d832188 commit 4aff10a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/DAV/handler.js
Expand Up @@ -472,8 +472,11 @@ exports.STATUS_MAP = {
var offlen = end - start + 1;
// Prevent buffer error
// https://github.com/joyent/node/blob/v0.4.5/lib/buffer.js#L337
if (offlen < start)
start = offlen;
if (end < start) {
var swapTmp = end;
end = start;
start = swapTmp;
}

// report a different end offset, corrected by 1:
var clientEnd = end > 0 ? end - 1 : end;
Expand All @@ -485,7 +488,7 @@ exports.STATUS_MAP = {
self.httpResponse.writeHead(206, httpHeaders);
};

node.getStream(start, offlen, function(err, data) {
node.getStream(start, end, function(err, data) {
if (err) {
if (!writeStreamingHeader) {
self.httpResponse.end();
Expand Down

0 comments on commit 4aff10a

Please sign in to comment.