router
Advanced tools
Comparing version 1.3.6 to 1.3.7
@@ -0,1 +1,6 @@ | ||
1.3.7 / 2022-04-28 | ||
================== | ||
* Fix hanging on large stack of sync routes | ||
1.3.6 / 2021-11-15 | ||
@@ -2,0 +7,0 @@ ================== |
28
index.js
/*! | ||
* router | ||
* Copyright(c) 2013 Roman Shtylman | ||
* Copyright(c) 2014 Douglas Christopher Wilson | ||
* Copyright(c) 2014-2022 Douglas Christopher Wilson | ||
* MIT Licensed | ||
@@ -199,3 +199,3 @@ */ | ||
if (slashAdded) { | ||
req.url = req.url.substr(1) | ||
req.url = req.url.slice(1) | ||
slashAdded = false | ||
@@ -207,3 +207,3 @@ } | ||
req.baseUrl = parentUrl | ||
req.url = protohost + removed + req.url.substr(protohost.length) | ||
req.url = protohost + removed + req.url.slice(protohost.length) | ||
removed = '' | ||
@@ -300,10 +300,10 @@ } | ||
if (err) { | ||
return next(layerError || err) | ||
next(layerError || err) | ||
} else if (route) { | ||
layer.handle_request(req, res, next) | ||
} else { | ||
trim_prefix(layer, layerError, layerPath, path) | ||
} | ||
if (route) { | ||
return layer.handle_request(req, res, next) | ||
} | ||
trim_prefix(layer, layerError, layerPath, path) | ||
sync = 0 | ||
}) | ||
@@ -315,3 +315,3 @@ } | ||
// Validate path is a prefix match | ||
if (layerPath !== path.substr(0, layerPath.length)) { | ||
if (layerPath !== path.substring(0, layerPath.length)) { | ||
next(layerError) | ||
@@ -332,3 +332,3 @@ return | ||
removed = layerPath | ||
req.url = protohost + req.url.substr(protohost.length + removed.length) | ||
req.url = protohost + req.url.slice(protohost.length + removed.length) | ||
@@ -354,4 +354,2 @@ // Ensure leading slash | ||
} | ||
sync = 0 | ||
} | ||
@@ -607,6 +605,6 @@ } | ||
: url.length | ||
var fqdnIndex = url.substr(0, pathLength).indexOf('://') | ||
var fqdnIndex = url.substring(0, pathLength).indexOf('://') | ||
return fqdnIndex !== -1 | ||
? url.substr(0, url.indexOf('/', 3 + fqdnIndex)) | ||
? url.substring(0, url.indexOf('/', 3 + fqdnIndex)) | ||
: undefined | ||
@@ -613,0 +611,0 @@ } |
/*! | ||
* router | ||
* Copyright(c) 2013 Roman Shtylman | ||
* Copyright(c) 2014 Douglas Christopher Wilson | ||
* Copyright(c) 2014-2022 Douglas Christopher Wilson | ||
* MIT Licensed | ||
@@ -6,0 +6,0 @@ */ |
/*! | ||
* router | ||
* Copyright(c) 2013 Roman Shtylman | ||
* Copyright(c) 2014 Douglas Christopher Wilson | ||
* Copyright(c) 2014-2022 Douglas Christopher Wilson | ||
* MIT Licensed | ||
@@ -6,0 +6,0 @@ */ |
{ | ||
"name": "router", | ||
"description": "Simple middleware-style router", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>", | ||
@@ -24,7 +24,7 @@ "contributors": [ | ||
"eslint-plugin-markdown": "2.2.1", | ||
"finalhandler": "1.1.2", | ||
"mocha": "9.1.3", | ||
"finalhandler": "1.2.0", | ||
"mocha": "9.2.2", | ||
"nyc": "15.1.0", | ||
"safe-buffer": "5.2.1", | ||
"supertest": "6.1.6" | ||
"supertest": "6.2.3" | ||
}, | ||
@@ -36,2 +36,3 @@ "files": [ | ||
"README.md", | ||
"SECURITY.md", | ||
"index.js" | ||
@@ -38,0 +39,0 @@ ], |
@@ -385,3 +385,3 @@ # router | ||
[ci-image]: https://badgen.net/github/checks/pillarjs/router/master?label=ci | ||
[ci-url]: https://github.com/pillarjs/router/actions?query=workflow%3Aci | ||
[ci-url]: https://github.com/pillarjs/router/actions/workflows/ci.yml | ||
[npm-image]: https://img.shields.io/npm/v/router.svg | ||
@@ -388,0 +388,0 @@ [npm-url]: https://npmjs.org/package/router |
Sorry, the diff of this file is not supported yet
42394
8