...**/!(*.map|*.min.js)Size
Gzip
Dependencies
Publish
Install
Publish
Install
@@ -597,7 +597,7 @@ | |||
| 597 | 597 | ||
| 598 | app.listen = function listen() { | 598 | app.listen = function listen() { |
| 599 | var server = http.createServer(this) | 599 | var server = http.createServer(this) |
| 600 | var args = Array.prototype.slice.call(arguments) | 600 | var args = slice.call(arguments) |
| 601 | if (typeof args[args.length - 1] === 'function') { | 601 | if (typeof args[args.length - 1] === 'function') { |
| 602 | var done = args[args.length - 1] = once(args[args.length - 1]) | 602 | var done = args[args.length - 1] = once(args[args.length - 1]) |
| 603 | server.once('error', done) | 603 | server.once('error', done) |
@@ -169,9 +169,8 @@ | |||
| 169 | * @public | 169 | * @public |
| 170 | */ | 170 | */ |
| 171 | 171 | ||
| 172 | req.acceptsLanguages = function(){ | ||
| 173 | var accept = accepts(this); | ||
| 174 | return accept.languages.apply(accept, arguments); | 172 | req.acceptsLanguages = function(...languages) { |
| 173 | return accepts(this).languages(...languages); | ||
| 175 | }; | 174 | }; |
| 176 | 175 | ||
| 177 | /** | 176 | /** |
@@ -283,12 +282,12 @@ | |||
| 283 | */ | 282 | */ |
| 284 | 283 | ||
| 285 | defineGetter(req, 'protocol', function protocol(){ | 284 | defineGetter(req, 'protocol', function protocol(){ |
| 286 | var proto = this.connection.encrypted | 285 | var proto = this.socket.encrypted |
| 287 | ? 'https' | 286 | ? 'https' |
| 288 | : 'http'; | 287 | : 'http'; |
| 289 | var trust = this.app.get('trust proxy fn'); | 288 | var trust = this.app.get('trust proxy fn'); |
| 290 | 289 | ||
| 291 | if (!trust(this.connection.remoteAddress, 0)) { | 290 | if (!trust(this.socket.remoteAddress, 0)) { |
| 292 | return proto; | 291 | return proto; |
| 293 | } | 292 | } |
| 294 | 293 | ||
@@ -407,7 +406,7 @@ | |||
| 407 | var trust = this.app.get('trust proxy fn'); | 406 | var trust = this.app.get('trust proxy fn'); |
| 408 | var val = this.get('X-Forwarded-Host'); | 407 | var val = this.get('X-Forwarded-Host'); |
| 409 | 408 | ||
| 410 | if (!val || !trust(this.connection.remoteAddress, 0)) { | 409 | if (!val || !trust(this.socket.remoteAddress, 0)) { |
| 411 | val = this.get('Host'); | 410 | val = this.get('Host'); |
| 412 | } else if (val.indexOf(',') !== -1) { | 411 | } else if (val.indexOf(',') !== -1) { |
| 413 | // Note: X-Forwarded-Host is normally only ever a | 412 | // Note: X-Forwarded-Host is normally only ever a |
@@ -14,6 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | var contentDisposition = require('content-disposition'); | 15 | var contentDisposition = require('content-disposition'); |
| 16 | var createError = require('http-errors') | 16 | var createError = require('http-errors') |
| 17 | var deprecate = require('depd')('express'); | ||
| 17 | var encodeUrl = require('encodeurl'); | 18 | var encodeUrl = require('encodeurl'); |
| 18 | var escapeHtml = require('escape-html'); | 19 | var escapeHtml = require('escape-html'); |
| 19 | var http = require('node:http'); | 20 | var http = require('node:http'); |
@@ -31,6 +32,7 @@ | |||
| 31 | var extname = path.extname; | 32 | var extname = path.extname; |
| 32 | var resolve = path.resolve; | 33 | var resolve = path.resolve; |
| 33 | var vary = require('vary'); | 34 | var vary = require('vary'); |
| 35 | const { Buffer } = require('node:buffer'); | ||
| 34 | 36 | ||
| 35 | /** | 37 | /** |
| 36 | * Response prototype. | 38 | * Response prototype. |
@@ -825,6 +827,18 @@ | |||
| 825 | address = arguments[1] | 827 | address = arguments[1] |
| 826 | } | 828 | } |
| 827 | 829 | ||
| 830 | if (!address) { | ||
| 831 | deprecate('Provide a url argument'); | ||
| 832 | } | ||
| 833 | |||
| 834 | if (typeof address !== 'string') { | ||
| 835 | deprecate('Url must be a string'); | ||
| 836 | } | ||
| 837 | |||
| 838 | if (typeof status !== 'number') { | ||
| 839 | deprecate('Status must be a number'); | ||
| 840 | } | ||
| 841 | |||
| 828 | // Set location header | 842 | // Set location header |
| 829 | address = this.location(address).get('Location'); | 843 | address = this.location(address).get('Location'); |
| 830 | 844 | ||
@@ -18,8 +18,10 @@ | |||
| 18 | var mime = require('mime-types') | 18 | var mime = require('mime-types') |
| 19 | var proxyaddr = require('proxy-addr'); | 19 | var proxyaddr = require('proxy-addr'); |
| 20 | var qs = require('qs'); | 20 | var qs = require('qs'); |
| 21 | var querystring = require('querystring'); | 21 | var querystring = require('node:querystring'); |
| 22 | const { Buffer } = require('node:buffer'); | ||
| 22 | 23 | ||
| 24 | |||
| 23 | /** | 25 | /** |
| 24 | * A list of lowercased HTTP methods that are supported by Node.js. | 26 | * A list of lowercased HTTP methods that are supported by Node.js. |
| 25 | * @api private | 27 | * @api private |
@@ -264,6 +266,6 @@ | |||
| 264 | 266 | ||
| 265 | function parseExtendedQueryString(str) { | 267 | function parseExtendedQueryString(str) { |
| 266 | return qs.parse(str, { | 268 | return qs.parse(str, { |
| 267 | allowPrototypes: true | 269 | plainObjects: true |
| 268 | }); | 270 | }); |
| 269 | } | 271 | } |
@@ -1,7 +1,7 @@ | |||
| 1 | { | 1 | { |
| 2 | "name": "express", | 2 | "name": "express", |
| 3 | "description": "Fast, unopinionated, minimalist web framework", | 3 | "description": "Fast, unopinionated, minimalist web framework", |
| 4 | "version": "5.1.0", | 4 | "version": "5.2.0", |
| 5 | "author": "TJ Holowaychuk <tj@vision-media.ca>", | 5 | "author": "TJ Holowaychuk <tj@vision-media.ca>", |
| 6 | "contributors": [ | 6 | "contributors": [ |
| 7 | "Aaron Heckmann <aaron.heckmann+github@gmail.com>", | 7 | "Aaron Heckmann <aaron.heckmann+github@gmail.com>", |
@@ -33,12 +33,13 @@ | |||
| 33 | ], | 33 | ], |
| 34 | "dependencies": { | 34 | "dependencies": { |
| 35 | "accepts": "^2.0.0", | 35 | "accepts": "^2.0.0", |
| 36 | "body-parser": "^2.2.0", | 36 | "body-parser": "^2.2.1", |
| 37 | "content-disposition": "^1.0.0", | 37 | "content-disposition": "^1.0.0", |
| 38 | "content-type": "^1.0.5", | 38 | "content-type": "^1.0.5", |
| 39 | "cookie": "^0.7.1", | 39 | "cookie": "^0.7.1", |
| 40 | "cookie-signature": "^1.2.1", | 40 | "cookie-signature": "^1.2.1", |
| 41 | "debug": "^4.4.0", | 41 | "debug": "^4.4.0", |
| 42 | "depd": "^2.0.0", | ||
| 42 | "encodeurl": "^2.0.0", | 43 | "encodeurl": "^2.0.0", |
| 43 | "escape-html": "^1.0.3", | 44 | "escape-html": "^1.0.3", |
| 44 | "etag": "^1.8.1", | 45 | "etag": "^1.8.1", |
@@ -64,7 +65,7 @@ | |||
| 64 | "after": "0.8.2", | 65 | "after": "0.8.2", |
| 65 | "connect-redis": "^8.0.1", | 66 | "connect-redis": "^8.0.1", |
| 66 | "cookie-parser": "1.4.7", | 67 | "cookie-parser": "1.4.7", |
| 67 | "cookie-session": "2.1.0", | 68 | "cookie-session": "2.1.1", |
| 68 | "ejs": "^3.1.10", | 69 | "ejs": "^3.1.10", |
| 69 | "eslint": "8.47.0", | 70 | "eslint": "8.47.0", |
| 70 | "express-session": "^1.18.1", | 71 | "express-session": "^1.18.1", |
@@ -72,7 +73,7 @@ | |||
| 72 | "marked": "^15.0.3", | 73 | "marked": "^15.0.3", |
| 73 | "method-override": "3.0.0", | 74 | "method-override": "3.0.0", |
| 74 | "mocha": "^10.7.3", | 75 | "mocha": "^10.7.3", |
| 75 | "morgan": "1.10.0", | 76 | "morgan": "1.10.1", |
| 76 | "nyc": "^17.1.0", | 77 | "nyc": "^17.1.0", |
| 77 | "pbkdf2-password": "1.2.1", | 78 | "pbkdf2-password": "1.2.1", |
| 78 | "supertest": "^6.3.0", | 79 | "supertest": "^6.3.0", |
@@ -83,13 +84,13 @@ | |||
| 83 | }, | 84 | }, |
| 84 | "files": [ | 85 | "files": [ |
| 85 | "LICENSE", | 86 | "LICENSE", |
| 86 | "History.md", | ||
| 87 | "Readme.md", | 87 | "Readme.md", |
| 88 | "index.js", | 88 | "index.js", |
| 89 | "lib/" | 89 | "lib/" |
| 90 | ], | 90 | ], |
| 91 | "scripts": { | 91 | "scripts": { |
| 92 | "lint": "eslint .", | 92 | "lint": "eslint .", |
| 93 | "lint:fix": "eslint . --fix", | ||
| 93 | "test": "mocha --require test/support/env --reporter spec --check-leaks test/ test/acceptance/", | 94 | "test": "mocha --require test/support/env --reporter spec --check-leaks test/ test/acceptance/", |
| 94 | "test-ci": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=lcovonly --reporter=text npm test", | 95 | "test-ci": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=lcovonly --reporter=text npm test", |
| 95 | "test-cov": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=html --reporter=text npm test", | 96 | "test-cov": "nyc --exclude examples --exclude test --exclude benchmarks --reporter=html --reporter=text npm test", |