Skip to content

Commit

Permalink
tests: debug send change
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Feb 5, 2015
1 parent 4797855 commit 0e35ab9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
10 changes: 8 additions & 2 deletions lib/response.js
Expand Up @@ -978,11 +978,17 @@ function sendfile(res, file, options, callback) {
}

// finished
function onfinish(err) {console.error(new Error('finish').stack);console.dir(arguments[1]);console.dir(STREAM);
function onfinish(err) {
console.error(new Error('finish').stack);console.dir(arguments[1]);console.dir(STREAM);
console.dir([
arguments[1]._header.length,
arguments[1]._header.length + arguments[1]._headers['content-length'],
arguments[1].req.socket._bytesDispatched
]);
if (err) return onerror(err);
if (done) return;

setImmediate(function () {console.dir(arguments[1]);console.dir(STREAM);
setImmediate(function () {//console.dir(arguments[1]);console.dir(STREAM);
console.error(streaming);
if (streaming !== false && !done) {
onaborted();
Expand Down
11 changes: 7 additions & 4 deletions send_index.js
Expand Up @@ -537,9 +537,6 @@ SendStream.prototype.send = function(path, stat){
if (-2 != ranges && ranges.length === 1) {
debug('range %j', ranges);

options.start = offset + ranges[0].start;
options.end = offset + ranges[0].end;

// Content-Range
res.statusCode = 206;
res.setHeader('Content-Range', 'bytes '
Expand All @@ -548,10 +545,16 @@ SendStream.prototype.send = function(path, stat){
+ ranges[0].end
+ '/'
+ len);
len = options.end - options.start + 1;

offset += ranges[0].start;
len = ranges[0].end - ranges[0].start + 1;
}
}

// read options
options.start = offset;
options.end = offset + len - 1;

// content-length
res.setHeader('Content-Length', len);

Expand Down

0 comments on commit 0e35ab9

Please sign in to comment.