Comparing version 0.1.3 to 1.0.0
@@ -17,3 +17,3 @@ /** | ||
var extname = path.extname; | ||
var mime = require('mime'); // MIME | ||
var mime = require('mime-types'); // MIME | ||
var etag = require('etag'); // ETag | ||
@@ -563,3 +563,3 @@ var fresh = require('fresh'); // Fresh | ||
*/ | ||
SendStream.prototype.sendFile = function sendFile(path){ | ||
SendStream.prototype.sendFile = function (path){ | ||
var i = 0; | ||
@@ -848,15 +848,19 @@ var pathStat; | ||
// Get MIME | ||
// Get type | ||
type = mime.lookup(path); | ||
charset = mime.charsets.lookup(type); | ||
// Debug infomation | ||
if (charset) { | ||
debugResponse('Content-Type %s; charset=%s', type, charset); | ||
} else { | ||
debugResponse('Content-Type %s', type); | ||
if (type) { | ||
// Get charset | ||
charset = mime.charset(type); | ||
// Debug infomation | ||
if (charset) { | ||
debugResponse('Content-Type: %s; charset=%s', type, charset); | ||
} else { | ||
debugResponse('Content-Type: %s', type); | ||
} | ||
// Set Content-Type | ||
response.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')); | ||
} | ||
// Set Content-Type | ||
response.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')); | ||
}; | ||
@@ -863,0 +867,0 @@ |
@@ -13,3 +13,2 @@ /** | ||
var path = require('path'); | ||
var relative = path.relative; | ||
@@ -43,3 +42,10 @@ // Variable declaration | ||
util.isOutBound = function (path, base){ | ||
return /(?:^[\\\/]?)\.\.(?:[\\\/]|$)/.test(relative(base, path)); | ||
if (process.platform === 'win32') { | ||
path = path.toLowerCase(); | ||
base = base.toLowerCase(); | ||
} | ||
if (path.length < base.length) return true; | ||
return path.indexOf(base) !== 0; | ||
}; | ||
@@ -46,0 +52,0 @@ |
{ | ||
"name": "file-send", | ||
"version": "0.1.3", | ||
"version": "1.0.0", | ||
"description": "A http file send", | ||
@@ -39,3 +39,3 @@ "author": { | ||
"fresh": "^0.3.0", | ||
"mime": "^1.3.4", | ||
"mime-types": "^2.1.10", | ||
"destroy": "^1.0.4", | ||
@@ -42,0 +42,0 @@ "colors": "^1.1.2", |
@@ -34,3 +34,3 @@ file-send | ||
http.createServer(function (request, response){ | ||
Send.use(request) // Create a new send stream | ||
Send.parse(request) // Create a new send stream | ||
.pipe(response); // Send stream to client | ||
@@ -78,6 +78,6 @@ }); | ||
### Send.use(request) | ||
### Send.parse(request) | ||
```js | ||
var stream = Send.use(request); // The Send.use return a new send stream | ||
var stream = Send.parse(request); // The Send.parse return a new send stream | ||
``` | ||
@@ -99,3 +99,3 @@ | ||
The `pipe` method is used to pipe the response into the Node.js HTTP response object, typically `Send.use(req).pipe(res)`. | ||
The `pipe` method is used to pipe the response into the Node.js HTTP response object, typically `Send.parse(req).pipe(res)`. | ||
@@ -160,3 +160,3 @@ ## Error-handling | ||
// Transfer arbitrary files from within /www/example.com/public/* | ||
Send.use(request) | ||
Send.parse(request) | ||
.on('error', error) | ||
@@ -163,0 +163,0 @@ .on('directory', directory) |
@@ -149,3 +149,3 @@ /** | ||
*/ | ||
Send.prototype.use = function (requset){ | ||
Send.prototype.parse = function (requset){ | ||
return new SendStream(requset, this.options); | ||
@@ -152,0 +152,0 @@ }; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
38454
1162
0
+ Addedmime-types@^2.1.10
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
- Removedmime@^1.3.4
- Removedmime@1.6.0(transitive)