Comparing version 3.0.2 to 3.1.0
@@ -0,1 +1,15 @@ | ||
3.1.0 / 2014-07-22 | ||
================== | ||
* deps: debug@1.0.4 | ||
* deps: finalhandler@0.1.0 | ||
- Respond after request fully read | ||
- deps: debug@1.0.4 | ||
* deps: parseurl@~1.2.0 | ||
- Cache URLs based on original value | ||
- Remove no-longer-needed URL mis-parse work-around | ||
- Simplify the "fast-path" `RegExp` | ||
* perf: reduce executed logic in routing | ||
* perf: refactor location of `try` block | ||
3.0.2 / 2014-07-10 | ||
@@ -40,2 +54,47 @@ ================== | ||
2.24.0 / 2014-07-22 | ||
=================== | ||
* deps: body-parser@~1.5.0 | ||
- deps: depd@0.4.2 | ||
- deps: iconv-lite@0.4.4 | ||
- deps: raw-body@1.3.0 | ||
- deps: type-is@~1.3.2 | ||
* deps: compression@~1.0.9 | ||
- Add `debug` messages | ||
- deps: accepts@~1.0.7 | ||
* deps: connect-timeout@~1.2.1 | ||
- Accept string for `time` (converted by `ms`) | ||
- deps: debug@1.0.4 | ||
* deps: debug@1.0.4 | ||
* deps: depd@0.4.2 | ||
- Add `TRACE_DEPRECATION` environment variable | ||
- Remove non-standard grey color from color output | ||
- Support `--no-deprecation` argument | ||
- Support `--trace-deprecation` argument | ||
* deps: express-session@~1.7.0 | ||
- Improve session-ending error handling | ||
- deps: debug@1.0.4 | ||
- deps: depd@0.4.2 | ||
* deps: finalhandler@0.1.0 | ||
- Respond after request fully read | ||
- deps: debug@1.0.4 | ||
* deps: method-override@~2.1.2 | ||
- deps: debug@1.0.4 | ||
- deps: parseurl@~1.2.0 | ||
* deps: morgan@~1.2.0 | ||
- Add `:remote-user` token | ||
- Add `combined` log format | ||
- Add `common` log format | ||
- Remove non-standard grey color from `dev` format | ||
* deps: multiparty@3.3.1 | ||
* deps: parseurl@~1.2.0 | ||
- Cache URLs based on original value | ||
- Remove no-longer-needed URL mis-parse work-around | ||
- Simplify the "fast-path" `RegExp` | ||
* deps: serve-static@~1.4.0 | ||
- Add `dotfiles` option | ||
- deps: parseurl@~1.2.0 | ||
- deps: send@0.7.0 | ||
2.23.0 / 2014-07-10 | ||
@@ -42,0 +101,0 @@ =================== |
@@ -98,5 +98,6 @@ /*! | ||
// store the original URL | ||
req.originalUrl = req.originalUrl || req.url; | ||
function next(err) { | ||
var layer, path, c; | ||
if (slashAdded) { | ||
@@ -107,8 +108,9 @@ req.url = req.url.substr(1); | ||
req.url = protohost + removed + req.url.substr(protohost.length); | ||
req.originalUrl = req.originalUrl || req.url; | ||
removed = ''; | ||
if (removed.length !== 0) { | ||
req.url = protohost + removed + req.url.substr(protohost.length); | ||
removed = ''; | ||
} | ||
// next callback | ||
layer = stack[index++]; | ||
var layer = stack[index++]; | ||
@@ -121,40 +123,33 @@ // all done | ||
try { | ||
path = parseUrl(req).pathname; | ||
if (undefined == path) path = '/'; | ||
// route data | ||
var path = parseUrl(req).pathname || '/'; | ||
var route = layer.route; | ||
// skip this layer if the route doesn't match. | ||
if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err); | ||
// skip this layer if the route doesn't match | ||
if (path.toLowerCase().substr(0, route.length) !== route.toLowerCase()) { | ||
return next(err); | ||
} | ||
c = path[layer.route.length]; | ||
if (c && '/' != c && '.' != c) return next(err); | ||
// skip if route match does not border "/", ".", or end | ||
var c = path[route.length]; | ||
if (c !== undefined && '/' !== c && '.' !== c) { | ||
return next(err); | ||
} | ||
// Call the layer handler | ||
// Trim off the part of the url that matches the route | ||
removed = layer.route; | ||
// trim off the part of the url that matches the route | ||
if (route.length !== 0 && route !== '/') { | ||
removed = route; | ||
req.url = protohost + req.url.substr(protohost.length + removed.length); | ||
// Ensure leading slash | ||
if (!fqdn && '/' != req.url[0]) { | ||
// ensure leading slash | ||
if (!fqdn && req.url[0] !== '/') { | ||
req.url = '/' + req.url; | ||
slashAdded = true; | ||
} | ||
} | ||
debug('%s %s : %s', layer.handle.name || 'anonymous', layer.route, req.originalUrl); | ||
var arity = layer.handle.length; | ||
if (err) { | ||
if (arity === 4) { | ||
layer.handle(err, req, res, next); | ||
} else { | ||
next(err); | ||
} | ||
} else if (arity < 4) { | ||
layer.handle(req, res, next); | ||
} else { | ||
next(); | ||
} | ||
} catch (e) { | ||
next(e); | ||
} | ||
// call the layer handle | ||
call(layer.handle, route, err, req, res, next); | ||
} | ||
next(); | ||
@@ -195,2 +190,33 @@ }; | ||
/** | ||
* Invoke a route handle. | ||
* | ||
* @api private | ||
*/ | ||
function call(handle, route, err, req, res, next) { | ||
var arity = handle.length; | ||
var hasError = Boolean(err); | ||
debug('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl); | ||
try { | ||
if (hasError && arity === 4) { | ||
// error-handling middleware | ||
handle(err, req, res, next); | ||
return; | ||
} else if (!hasError && arity < 4) { | ||
// request-handling middleware | ||
handle(req, res, next); | ||
return; | ||
} | ||
} catch (e) { | ||
// reset the error | ||
err = e; | ||
} | ||
// continue | ||
next(err); | ||
} | ||
/** | ||
* Log error using console.error. | ||
@@ -197,0 +223,0 @@ * |
{ | ||
"name": "connect", | ||
"description": "High performance middleware framework", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)", | ||
@@ -20,5 +20,5 @@ "contributors": [ | ||
"dependencies": { | ||
"debug": "1.0.3", | ||
"finalhandler": "0.0.2", | ||
"parseurl": "~1.1.3", | ||
"debug": "1.0.4", | ||
"finalhandler": "0.1.0", | ||
"parseurl": "~1.2.0", | ||
"utils-merge": "1.0.0" | ||
@@ -37,3 +37,3 @@ }, | ||
"scripts": { | ||
"test": "mocha --require test/support/env --reporter dot --check-leaks test/", | ||
"test": "mocha --require test/support/env --reporter spec --bail --check-leaks test/", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --require test/support/env --reporter dot --check-leaks test/", | ||
@@ -40,0 +40,0 @@ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --require test/support/env --reporter spec --check-leaks test/" |
@@ -6,2 +6,3 @@ # Connect | ||
[![Coverage Status](https://img.shields.io/coveralls/senchalabs/connect.svg?branch=master)](https://coveralls.io/r/senchalabs/connect) | ||
[![Gittip](https://img.shields.io/gittip/dougwilson.svg)](https://www.gittip.com/dougwilson/) | ||
@@ -8,0 +9,0 @@ Connect is an extensible HTTP server framework for [node](http://nodejs.org) using "plugins" known as _middleware_. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60608
218
114
+ Addeddebug@1.0.4(transitive)
+ Addedfinalhandler@0.1.0(transitive)
+ Addedparseurl@1.2.0(transitive)
- Removeddebug@1.0.21.0.3(transitive)
- Removedfinalhandler@0.0.2(transitive)
- Removedparseurl@1.1.3(transitive)
Updateddebug@1.0.4
Updatedfinalhandler@0.1.0
Updatedparseurl@~1.2.0