Skip to content
Myr

Started utils.parseRange()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 9a89dab · Browse files · 3 files+26 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+26 added−4 removed

  • other:+26 added−4 removed

3 files+26 added−4 removed

modified:lib/express/response.js+5 added-1 removed
13 unmodified lines
14 path = require('path'),15 pump = require('sys').pump,16 utils = require('connect/utils'),17 mime = require('connect/utils').mime,18 parseRange = require('./utils').parseRange,19 Buffer = require('buffer').Buffer;2021/**22 * Header fields supporting multiple values.
109 unmodified lines
132 */133134http.ServerResponse.prototype.sendfile = function(path, fn){135 var self = this,135 streamThreshold = this.app.set('stream threshold') || 32 * 1024;136 streamThreshold = this.app.set('stream threshold') || 32 * 1024,137 ranges = self.req.headers.range;138139 if (~path.indexOf('..')) this.send(403);140141 function error(err) {
4 unmodified lines
146 self.req.next(err);147 }148 }149150 if (ranges) ranges = parseRange(ranges);151152 fs.stat(path, function(err, stat){153 if (err) return error(err);154 if (stat.size >= streamThreshold) {155 var stream = fs.createReadStream(path);
191 unmodified lines
modified:lib/express/utils.js+17 added-2 removed
modified:Makefile+4 added-1 removed
43 unmodified lines
44 -I support/jade/lib \45 -I support/ejs/lib \46 $(TESTFLAGS) \47 test/*.test.js4849test-cov:50 @TESTFLAGS=--cov $(MAKE) test5152docs: docs/api.html $(MANPAGES) $(HTMLDOCS)53 @ echo "... generating TOC"54 @./support/toc.js docs/guide.html5556docs/api.html: lib/express/*.js57 dox \58 --private \56 dox --title Express \59 --title Express \60 --desc "High performance web framework for [node](http://nodejs.org)." \61 $(shell find lib/express/* -type f) > $@6263%.1: %.md
14 unmodified lines