Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.17 #3778

Merged
merged 51 commits into from
May 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
d0421ac
tests: use supertest to perform assertions
dougwilson Oct 27, 2018
a6b119d
build: coveralls@2.12.0
dougwilson Oct 27, 2018
6295b45
build: test against Node.js 11.x nightly
dougwilson Oct 27, 2018
003459b
build: support Node.js 9.x
Apr 10, 2018
44e539e
build: support Node.js 10.x
felixbuenemann May 16, 2018
6bcdfef
Improve error message for non-strings to res.sendFile
thevoidf Mar 4, 2018
8da5110
Improve error message for null/undefined to res.status
joshuacaron Nov 12, 2015
b93ffd4
Support multiple hosts in X-Forwarded-Host
iconoeugen Dec 3, 2017
95c31f7
docs: fix typo in contributing
HubCodes Dec 13, 2018
0ae10bb
docs: fix typos in history
AScriver Nov 27, 2018
02f3933
examples: minor fixes to some examples
Nov 29, 2018
186a206
docs: add listening address to example
cirosantilli Feb 5, 2019
6f12eee
docs: fix typo in jsdoc comment
Jan 17, 2019
b9b1b19
tests: fix typos in descriptions
jhkimwoowa Feb 1, 2019
6eda52a
docs: use const in readme example
mwanago Jan 30, 2019
8a97346
tests: assert calls order in middleware basic tests
Feb 1, 2019
9e5d1a3
build: test against Node.js 12.x nightly
dougwilson Apr 17, 2019
cf5c813
build: hbs@4.0.4
dougwilson Apr 17, 2019
4218d04
build: marked@0.6.2
dougwilson Apr 17, 2019
952484f
deps: content-disposition@0.5.3
dougwilson Apr 17, 2019
50eb5e4
deps: proxy-addr@~2.0.5
dougwilson Apr 17, 2019
0334120
deps: parseurl@~1.3.3
dougwilson Apr 17, 2019
b02d3a1
docs: add link to contributing guide
jamesgeorge007 Dec 27, 2018
7eacdce
deps: setprototypeof@1.1.1
dougwilson Apr 22, 2019
9afa1cf
deps: statuses@~1.5.0
dougwilson May 1, 2019
40dbfa2
deps: accepts@~1.3.7
dougwilson May 1, 2019
6d9dd2d
deps: type-is@~1.6.18
dougwilson May 1, 2019
32f5293
deps: qs@6.7.0
dougwilson May 1, 2019
2f782d8
deps: body-parser@1.19.0
dougwilson May 1, 2019
955f2a5
tests: add express.json test suite
dougwilson May 2, 2019
8b71f39
tests: add express.urlencoded test suite
dougwilson May 2, 2019
6f7a830
tests: add express.static test suite
dougwilson May 2, 2019
70a1947
deps: send@0.17.0
dougwilson May 8, 2019
60aacac
deps: serve-static@1.14.0
dougwilson May 8, 2019
0bcdd88
Add express.raw to parse bodies into Buffer
amitzur Aug 8, 2018
11192bd
tests: add express.raw test suite
dougwilson May 8, 2019
7f4e37f
Add express.text to parse bodies into string
amfern Oct 23, 2017
bb5211f
tests: add express.text test suite
dougwilson May 9, 2019
7b076bd
build: Node.js@6.17
dougwilson May 9, 2019
e917028
build: Node.js@8.16
dougwilson May 9, 2019
c754c8a
build: support Node.js 11.x
dougwilson May 9, 2019
bc07a41
deps: finalhandler@~1.1.2
dougwilson May 10, 2019
8267c4b
deps: send@0.17.1
dougwilson May 11, 2019
88f9733
deps: serve-static@1.14.1
dougwilson May 11, 2019
da6f701
deps: range-parser@~1.2.1
dougwilson May 13, 2019
e502dde
build: Node.js@10.15
dougwilson May 13, 2019
5266f3a
build: test against Node.js 13.x nightly
dougwilson May 13, 2019
b9ecb9a
build: support Node.js 12.x
zuohuadong Apr 24, 2019
efcb17d
deps: cookie@0.4.0
dougwilson May 16, 2019
94e48a1
build: update example dependencies
dougwilson May 16, 2019
b8e5056
tests: ignore unreachable line
dougwilson May 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ node_js:
- "3.3"
- "4.9"
- "5.12"
- "6.14"
- "6.17"
- "7.10"
- "8.12"
- "8.16"
- "9.11"
- "10.15"
- "11.15"
- "12.2"
matrix:
include:
- node_js: "9"
env: "NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly"
- node_js: "10"
- node_js: "13"
env: "NVM_NODEJS_ORG_MIRROR=https://nodejs.org/download/nightly"
allow_failures:
# Allow the nightly installs to fail
Expand Down Expand Up @@ -60,5 +62,5 @@ script:
after_script:
- |
# Upload coverage to coveralls
npm install --save-dev coveralls@2.10.0
npm install --save-dev coveralls@2.12.0
coveralls < ./coverage/lcov.info
2 changes: 1 addition & 1 deletion Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ expertise to resolve rare disputes.

Log an issue for any question or problem you might have. When in doubt, log an issue, and
any additional policies about what to include will be provided in the responses. The only
exception is security dislosures which should be sent privately.
exception is security disclosures which should be sent privately.

Committers may direct you to another repository, ask for additional clarifications, and
add appropriate metadata before the issue is addressed.
Expand Down
69 changes: 60 additions & 9 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
unreleased
==========

* Add `express.raw` to parse bodies into `Buffer`
* Add `express.text` to parse bodies into string
* Improve error message for non-strings to `res.sendFile`
* Improve error message for `null`/`undefined` to `res.status`
* Support multiple hosts in `X-Forwarded-Host`
* deps: accepts@~1.3.7
* deps: body-parser@1.19.0
- Add encoding MIK
- Add petabyte (`pb`) support
- Fix parsing array brackets after index
- deps: bytes@3.1.0
- deps: http-errors@1.7.2
- deps: iconv-lite@0.4.24
- deps: qs@6.7.0
- deps: raw-body@2.4.0
- deps: type-is@~1.6.17
* deps: content-disposition@0.5.3
* deps: cookie@0.4.0
- Add `SameSite=None` support
* deps: finalhandler@~1.1.2
- Set stricter `Content-Security-Policy` header
- deps: parseurl@~1.3.3
- deps: statuses@~1.5.0
* deps: parseurl@~1.3.3
* deps: proxy-addr@~2.0.5
- deps: ipaddr.js@1.9.0
* deps: qs@6.7.0
- Fix parsing array brackets after index
* deps: range-parser@~1.2.1
* deps: send@0.17.1
- Set stricter CSP header in redirect & error responses
- deps: http-errors@~1.7.2
- deps: mime@1.6.0
- deps: ms@2.1.1
- deps: range-parser@~1.2.1
- deps: statuses@~1.5.0
- perf: remove redundant `path.normalize` call
* deps: serve-static@1.14.1
- Set stricter CSP header in redirect response
- deps: parseurl@~1.3.3
- deps: send@0.17.1
* deps: setprototypeof@1.1.1
* deps: statuses@~1.5.0
- Add `103 Early Hints`
* deps: type-is@~1.6.18
- deps: mime-types@~2.1.24
- perf: prevent internal `throw` on invalid type

4.16.4 / 2018-10-10
===================

Expand Down Expand Up @@ -294,7 +345,7 @@
- Fix including type extensions in parameters in `Accept` parsing
- Fix parsing `Accept` parameters with quoted equals
- Fix parsing `Accept` parameters with quoted semicolons
- Many performance improvments
- Many performance improvements
- deps: mime-types@~2.1.11
- deps: negotiator@0.6.1
* deps: content-type@~1.0.2
Expand All @@ -309,7 +360,7 @@
- perf: enable strict mode
- perf: hoist regular expression
- perf: use for loop in parse
- perf: use string concatination for serialization
- perf: use string concatenation for serialization
* deps: finalhandler@0.5.0
- Change invalid or non-numeric status code to 500
- Overwrite status message to match set status code
Expand All @@ -319,7 +370,7 @@
* deps: proxy-addr@~1.1.2
- Fix accepting various invalid netmasks
- Fix IPv6-mapped IPv4 validation edge cases
- IPv4 netmasks must be contingous
- IPv4 netmasks must be contiguous
- IPv6 addresses cannot be used as a netmask
- deps: ipaddr.js@1.1.1
* deps: qs@6.2.0
Expand Down Expand Up @@ -1097,13 +1148,13 @@
- deps: negotiator@0.4.6
* deps: debug@1.0.2
* deps: send@0.4.3
- Do not throw un-catchable error on file open race condition
- Do not throw uncatchable error on file open race condition
- Use `escape-html` for HTML escaping
- deps: debug@1.0.2
- deps: finished@1.2.2
- deps: fresh@0.2.2
* deps: serve-static@1.2.3
- Do not throw un-catchable error on file open race condition
- Do not throw uncatchable error on file open race condition
- deps: send@0.4.3

4.4.2 / 2014-06-09
Expand Down Expand Up @@ -1983,7 +2034,7 @@
- deps: serve-static@1.2.3
* deps: debug@1.0.2
* deps: send@0.4.3
- Do not throw un-catchable error on file open race condition
- Do not throw uncatchable error on file open race condition
- Use `escape-html` for HTML escaping
- deps: debug@1.0.2
- deps: finished@1.2.2
Expand Down Expand Up @@ -3168,7 +3219,7 @@ Shaw]
* Updated haml submodule
* Changed ETag; removed inode, modified time only
* Fixed LF to CRLF for setting multiple cookies
* Fixed cookie complation; values are now urlencoded
* Fixed cookie compilation; values are now urlencoded
* Fixed cookies parsing; accepts quoted values and url escaped cookies

0.11.0 / 2010-05-06
Expand Down Expand Up @@ -3363,7 +3414,7 @@ Shaw]

* Added "plot" format option for Profiler (for gnuplot processing)
* Added request number to Profiler plugin
* Fixed binary encoding for multi-part file uploads, was previously defaulting to UTF8
* Fixed binary encoding for multipart file uploads, was previously defaulting to UTF8
* Fixed issue with routes not firing when not files are present. Closes #184
* Fixed process.Promise -> events.Promise

Expand Down Expand Up @@ -3409,7 +3460,7 @@ Shaw]
* Updated sample chat app to show messages on load
* Updated libxmljs parseString -> parseHtmlString
* Fixed `make init` to work with older versions of git
* Fixed specs can now run independent specs for those who cant build deps. Closes #127
* Fixed specs can now run independent specs for those who can't build deps. Closes #127
* Fixed issues introduced by the node url module changes. Closes 126.
* Fixed two assertions failing due to Collection#keys() returning strings
* Fixed faulty Collection#toArray() spec due to keys() returning strings
Expand Down
10 changes: 8 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[![Test Coverage][coveralls-image]][coveralls-url]

```js
var express = require('express')
var app = express()
const express = require('express')
const app = express()

app.get('/', function (req, res) {
res.send('Hello World')
Expand Down Expand Up @@ -90,6 +90,8 @@ $ npm install
$ npm start
```

View the website at: http://localhost:3000

## Philosophy

The Express philosophy is to provide small, robust tooling for HTTP servers, making
Expand Down Expand Up @@ -125,6 +127,10 @@ $ npm install
$ npm test
```

## Contributing

[Contributing Guide](Contributing.md)

## People

The original author of Express is [TJ Holowaychuk](https://github.com/tj)
Expand Down
8 changes: 6 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ environment:
- nodejs_version: "3.3"
- nodejs_version: "4.9"
- nodejs_version: "5.12"
- nodejs_version: "6.14"
- nodejs_version: "6.17"
- nodejs_version: "7.10"
- nodejs_version: "8.12"
- nodejs_version: "8.16"
- nodejs_version: "9.11"
- nodejs_version: "10.15"
- nodejs_version: "11.15"
- nodejs_version: "12.2"
cache:
- node_modules
install:
Expand Down
2 changes: 1 addition & 1 deletion examples/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ app.get('/files/:file(*)', function(req, res, next){

res.download(filePath, function (err) {
if (!err) return; // file sent
if (err && err.status !== 404) return next(err); // non-404 error
if (err.status !== 404) return next(err); // non-404 error
// file for download not found
res.statusCode = 404;
res.send('Cant find that file, sorry!');
Expand Down
2 changes: 1 addition & 1 deletion examples/mvc/public/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
body {
padding: 50px;
font: 16px "Helvetica Neue", Helvetica, Arial;
font: 16px "Helvetica Neue", Helvetica, Arial, sans-serif;
}
a {
color: #107aff;
Expand Down
2 changes: 1 addition & 1 deletion examples/static-files/public/js/app.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
foo
// foo
2 changes: 2 additions & 0 deletions lib/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ exports.Router = Router;

exports.json = bodyParser.json
exports.query = require('./middleware/query');
exports.raw = bodyParser.raw
exports.static = require('serve-static');
exports.text = bodyParser.text
exports.urlencoded = bodyParser.urlencoded

/**
Expand Down
4 changes: 4 additions & 0 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ defineGetter(req, 'hostname', function hostname(){

if (!host || !trust(this.connection.remoteAddress, 0)) {
host = this.get('Host');
} else if (host.indexOf(',') !== -1) {
// Note: X-Forwarded-Host is normally only ever a
// single value, but this is to be safe.
host = host.substring(0, host.indexOf(',')).trimRight()
}

if (!host) return;
Expand Down
11 changes: 10 additions & 1 deletion lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ var charsetRegExp = /;\s*charset\s*=/;
*/

res.status = function status(code) {
if (code === undefined || code === null) {
throw new TypeError('code argument is required to res.status')
}

this.statusCode = code;
return this;
};
Expand Down Expand Up @@ -411,6 +415,10 @@ res.sendFile = function sendFile(path, options, callback) {
throw new TypeError('path argument is required to res.sendFile');
}

if (typeof path !== 'string') {
throw new TypeError('path must be a string to res.sendFile')
}

// support function as second arg
if (typeof options === 'function') {
done = options;
Expand Down Expand Up @@ -814,7 +822,7 @@ res.clearCookie = function clearCookie(name, options) {
* // "Remember Me" for 15 minutes
* res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true });
*
* // save as above
* // same as above
* res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true })
*
* @param {String} name
Expand Down Expand Up @@ -1127,6 +1135,7 @@ function stringify (value, replacer, spaces, escape) {
return '\\u003e'
case 0x26:
return '\\u0026'
/* istanbul ignore next: unreachable default */
default:
return c
}
Expand Down
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,48 @@
"api"
],
"dependencies": {
"accepts": "~1.3.5",
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.18.3",
"content-disposition": "0.5.2",
"body-parser": "1.19.0",
"content-disposition": "0.5.3",
"content-type": "~1.0.4",
"cookie": "0.3.1",
"cookie": "0.4.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "1.1.1",
"finalhandler": "~1.1.2",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.2",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.4",
"qs": "6.5.2",
"range-parser": "~1.2.0",
"proxy-addr": "~2.0.5",
"qs": "6.7.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.1.2",
"send": "0.16.2",
"serve-static": "1.13.2",
"setprototypeof": "1.1.0",
"statuses": "~1.4.0",
"type-is": "~1.6.16",
"send": "0.17.1",
"serve-static": "1.14.1",
"setprototypeof": "1.1.1",
"statuses": "~1.5.0",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"devDependencies": {
"after": "0.8.2",
"connect-redis": "3.4.0",
"cookie-parser": "~1.4.3",
"cookie-session": "1.3.2",
"connect-redis": "3.4.1",
"cookie-parser": "~1.4.4",
"cookie-session": "1.3.3",
"ejs": "2.6.1",
"eslint": "2.13.1",
"express-session": "1.15.6",
"hbs": "4.0.1",
"express-session": "1.16.1",
"hbs": "4.0.4",
"istanbul": "0.4.5",
"marked": "0.5.1",
"marked": "0.6.2",
"method-override": "3.0.0",
"mocha": "5.2.0",
"morgan": "1.9.1",
Expand Down
Loading