Socket
Socket
Sign inDemoInstall

express

Package Overview
Dependencies
Maintainers
0
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express - npm Package Compare versions

Comparing version 2.3.2 to 2.3.3

7

History.md
2.3.3 / 2011-05-03
==================
* Added "case sensitive routes" option.
* Changed; split methods supported per rfc [slaskis]
* Fixed route-specific middleware when using the same callback function several times
2.3.2 / 2011-04-27

@@ -3,0 +10,0 @@ ==================

2

lib/express.js

@@ -31,3 +31,3 @@

exports.version = '2.3.2';
exports.version = '2.3.3';

@@ -34,0 +34,0 @@ /**

@@ -90,3 +90,3 @@

// use router, expose as app.get(), etc
var fn = router(function(app){ self.routes = app; });
var fn = router(function(app){ self.routes = app; }, this);
this.__defineGetter__('router', function(){

@@ -93,0 +93,0 @@ this.__usedRouter = true;

@@ -37,3 +37,3 @@

function router(fn){
function router(fn, app){
var self = this

@@ -83,8 +83,8 @@ , methods = {}

fn.middleware = middleware;
if (!path) throw new Error(name + ' route requires a path');
if (!fn) throw new Error(name + ' route ' + path + ' requires a callback');
var route = new Route(name, path, fn);
var options = { sensitive: app.enabled('case sensitive routes') };
var route = new Route(name, path, fn, options);
route.middleware = middleware;
localRoutes.push(route);

@@ -133,3 +133,3 @@ return self;

(function nextMiddleware(err){
var fn = route.callback.middleware[i++];
var fn = route.middleware[i++];
if ('route' == err) {

@@ -136,0 +136,0 @@ pass(req._route_index + 1);

@@ -9,24 +9,63 @@

/**
* Supported HTTP / WebDAV methods.
* Hypertext Transfer Protocol -- HTTP/1.1
* http://www.ietf.org/rfc/rfc2616.txt
*/
module.exports = [
'get'
, 'post'
, 'put'
, 'delete'
, 'connect'
, 'options'
, 'trace'
, 'copy'
, 'lock'
, 'mkcol'
, 'move'
, 'propfind'
, 'proppatch'
, 'unlock'
, 'report'
, 'mkactivity'
, 'checkout'
, 'merge'
];
var RFC2616 = ['OPTIONS', 'GET', 'POST', 'PUT', 'DELETE', 'TRACE', 'CONNECT'];
/**
* HTTP Extensions for Distributed Authoring -- WEBDAV
* http://www.ietf.org/rfc/rfc2518.txt
*/
var RFC2518 = ['PROPFIND', 'PROPPATCH', 'MKCOL', 'COPY', 'MOVE', 'LOCK', 'UNLOCK'];
/**
* Versioning Extensions to WebDAV
* http://www.ietf.org/rfc/rfc3253.txt
*/
var RFC3253 = ['VERSION-CONTROL', 'REPORT', 'CHECKOUT', 'CHECKIN', 'UNCHECKOUT', 'MKWORKSPACE', 'UPDATE', 'LABEL', 'MERGE', 'BASELINE-CONTROL', 'MKACTIVITY'];
/**
* Ordered Collections Protocol (WebDAV)
* http://www.ietf.org/rfc/rfc3648.txt
*/
var RFC3648 = ['ORDERPATCH'];
/**
* Web Distributed Authoring and Versioning (WebDAV) Access Control Protocol
* http://www.ietf.org/rfc/rfc3744.txt
*/
var RFC3744 = ['ACL'];
/**
* Web Distributed Authoring and Versioning (WebDAV) SEARCH
* http://www.ietf.org/rfc/rfc5323.txt
*/
var RFC5323 = ['SEARCH'];
/**
* PATCH Method for HTTP
* http://www.ietf.org/rfc/rfc5789.txt
*/
var RFC5789 = ['PATCH'];
/**
* Expose the methods.
*/
module.exports = [].concat(
RFC2616
, RFC2518
, RFC3253
, RFC3648
, RFC3744
, RFC5323
, RFC5789).map(function(method){
return method.toLowerCase();
});

@@ -16,14 +16,20 @@

* Initialize `Route` with the given HTTP `method`, `path`,
* and callback `fn`.
* and callback `fn` and `options`.
*
* Options:
*
* - `sensitive` enable case-sensitive routes
*
* @param {String} method
* @param {String} path
* @param {Function} fn
* @param {Object} options.
* @api private
*/
function Route(method, path, fn) {
function Route(method, path, fn, options) {
options = options || {};
this.callback = fn;
this.path = path;
this.regexp = normalize(path, this.keys = []);
this.regexp = normalize(path, this.keys = [], options.sensitive);
this.method = method;

@@ -43,2 +49,3 @@ }

* @param {Array} keys
* @param {Boolean} sensitive
* @return {RegExp}

@@ -48,3 +55,3 @@ * @api private

function normalize(path, keys) {
function normalize(path, keys, sensitive) {
if (path instanceof RegExp) return path;

@@ -66,3 +73,3 @@ path = path

.replace(/\*/g, '(.+)');
return new RegExp('^' + path + '$', 'i');
return new RegExp('^' + path + '$', sensitive ? '' : 'i');
}

@@ -52,3 +52,3 @@

this.dirname = dirname(this.path);
options.attempts.push(this.path);
if (options.attempts) options.attempts.push(this.path);
};

@@ -55,0 +55,0 @@

{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "2.3.2",
"version": "2.3.3",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -6,0 +6,0 @@ "contributors": [

@@ -19,2 +19,6 @@

or to access the `express(1)` executable install globally:
$ npm install -g express
## Features

@@ -21,0 +25,0 @@

Sorry, the diff of this file is not supported yet

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