Permalink
Browse files

Merge branch 'master' into carddav

  • Loading branch information...
2 parents 1644295 + d832188 commit 4aff10a7417787d0e834080c90180bd49e6959c1 @mikedeboer committed Jan 7, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/DAV/handler.js
View
@@ -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;
@@ -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();

0 comments on commit 4aff10a

Please sign in to comment.