Socket
Socket
Sign inDemoInstall

connect

Package Overview
Dependencies
Maintainers
0
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

lib/._connect.js

2

._index.js

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR����!�!com.macromates.caret{
Mac OS X  2��ATTR�����!�!com.macromates.caret{
column = 0;
line = 1;
}

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR����#�#com.macromates.caret{
column = 14;
line = 11;
Mac OS X  2��ATTR�����"�"com.macromates.caret{
column = 19;
line = 2;
}

@@ -1,1 +0,1 @@

Mac OS X  2��ATTR���� � com.macromates.caretx���R������<[k0?'3/«��
Mac OS X  2��ATTR���� � com.macromates.caretx���R������<[k0?'3/«��

@@ -29,3 +29,3 @@

exports.version = '1.0.0';
exports.version = '1.0.1';

@@ -32,0 +32,0 @@ /**

@@ -1,4 +0,4 @@

Mac OS X  2��ATTR����#�#com.macromates.caret{
Mac OS X  2��ATTR����#�#com.macromates.caret{
column = 47;
line = 23;
}

@@ -74,2 +74,15 @@

/**
* Save the session data with optional callback `fn(err)`.
*
* @param {Function} fn
* @return {Session} for chaining
* @api public
*/
Session.prototype.save = function(fn){
this.req.sessionStore.set(this.id, this, fn || function(){});
return this;
};
/**
* Destroy `this` session.

@@ -84,3 +97,3 @@ *

delete this.req.session;
this.req.sessionStore.destroy(this.req.sessionID, fn);
this.req.sessionStore.destroy(this.id, fn);
return this;

@@ -87,0 +100,0 @@ };

@@ -53,2 +53,3 @@

return function static(req, res, next) {
options.path = req.url;
send(req, res, next, options);

@@ -95,3 +96,2 @@ };

* @param {Object} options
* @return {Function}
* @api private

@@ -102,2 +102,3 @@ */

options = options || {};
if (!options.path) throw new Error('path required');

@@ -108,4 +109,8 @@ // setup

, head = 'HEAD' == req.method
, root = options.root;
, root = options.root
, fn = options.callback;
// replace next() with callback when available
if (fn) next = fn;
// ignore non-GET requests

@@ -115,8 +120,10 @@ if ('GET' != req.method && !head) return next();

// parse url
var url = parse(req.url)
var url = parse(options.path)
, path = decodeURIComponent(url.pathname)
, type = mime.lookup(path);
, type;
// potentially malicious path
if (~path.indexOf('..')) return forbidden(res);
if (~path.indexOf('..')) return fn
? fn(new Error('Forbidden'))
: forbidden(res);

@@ -129,5 +136,9 @@ // join from optional root dir

fs.lstat(path, function(err, stat){
// mime type
type = mime.lookup(path);
fs.stat(path, function(err, stat){
// ignore ENOENT
if (err) {
if (fn) return fn(err);
return 'ENOENT' == err.code

@@ -138,3 +149,5 @@ ? next()

} else if (stat.isDirectory()) {
return next();
return fn
? fn(new Error('Cannot Transfer Directory'))
: next();
}

@@ -161,3 +174,5 @@

} else {
return invalidRange(res);
return fn
? fn(new Error('Requested Range Not Satisfiable'))
: invalidRange(res);
}

@@ -188,3 +203,4 @@ // stream the entire file

stream.pipe(res);
if (fn) stream.on('end', fn);
});
};
{
"name": "connect",
"version": "1.0.0",
"version": "1.0.1",
"description": "High performance middleware framework",

@@ -5,0 +5,0 @@ "keywords": ["framework", "web", "middleware", "connect", "rack"],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc