Skip to content


Subversion checkout URL

You can clone with
Download ZIP


content-length is incorrect when requested range.end is larger than the actual content-length #5

wants to merge 1 commit into from

2 participants


Fixed by taking the minimum of requested range.end and actual content-length (-1)

tj commented

test please :D


Ah, so this problem has been fixed since send was extracted. It's quite non-obvious, though, being done in the range-parser.

@mtsr mtsr closed this
@sebs sebs referenced this pull request from a commit in sebs/send
Sebastian Schürmann Fixing issue #5 35a742b
@getfatday getfatday referenced this pull request in gruntjs/grunt-contrib-livereload

40kb limit on html files #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 8, 2012
  1. @mtsr

    Fixed incorrect content-length when requested range.end is larger tha…

    mtsr authored
    …n the actual content-length
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/send.js
2  lib/send.js
@@ -362,7 +362,7 @@ SendStream.prototype.send = function(path, stat){
// valid (syntactically invalid ranges are treated as a regular response)
if (-2 != ranges) {
options.start = ranges[0].start;
- options.end = ranges[0].end;
+ options.end = Math.min(ranges[0].end, stat.size - 1);
// Content-Range
len = options.end - options.start + 1;
Something went wrong with that request. Please try again.