Skip to content
Myr

Merge tag '4.13.4'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parents 2c668f8, 193bed2 · Browse files · 15 files+261 added−79 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

15 files+261 added−79 removed

  • tests:+94 added−22 removed
  • other:+167 added−57 removed

15 files+261 added−79 removed

modified:examples/view-constructor/index.js+2 added-2 removed
modified:examples/web-service/index.js+1 added-1 removed
modified:lib/application.js+1 added-1 removed
506 unmodified lines
507 * // ...508 * })509 *510 * @param {String} name511 * @param {String|Function} options or fn511 * @param {Object|Function} options or fn512 * @param {Function} callback513 * @public514 */515
114 unmodified lines
modified:test/acceptance/web-service.js+1 added-1 removed
51 unmodified lines
52 request(app)53 .get('/api/repos?api-key=foo')54 .expect('Content-Type', 'application/json; charset=utf-8')55 .expect(/"name":"express"/)56 .expect(/"url":"http:\/\/github.com\/strongloop\/express"/)56 .expect(/"url":"http:\/\/github.com\/expressjs\/express"/)57 .expect(200, done)58 })59 })60 })
45 unmodified lines
modified:test/app.router.js+48 added
318 unmodified lines
319 .get('/user/id:10/name:tj/profile')320 .expect(200, '[["0","10"],["1","tj"],["2","profile"]]', done);321 })322323 it('should merge numeric indices req.params when parent has same number', function(done){324 var app = express();325 var router = new express.Router({ mergeParams: true });326327 router.get('/name:(\\w+)', function(req, res){328 var keys = Object.keys(req.params).sort();329 res.send(keys.map(function(k){ return [k, req.params[k]] }));330 });331332 app.use('/user/id:(\\d+)', router);333334 request(app)335 .get('/user/id:10/name:tj')336 .expect(200, '[["0","10"],["1","tj"]]', done);337 })338339 it('should ignore invalid incoming req.params', function(done){340 var app = express();341 var router = new express.Router({ mergeParams: true });342
10 unmodified lines
353 request(app)354 .get('/user/tj')355 .expect(200, '[["name","tj"]]', done);356 })357358 it('should restore req.params', function(done){359 var app = express();360 var router = new express.Router({ mergeParams: true });361362 router.get('/user:(\\w+)/*', function (req, res, next) {363 next();364 });365366 app.use('/user/id:(\\d+)', function (req, res, next) {367 router(req, res, function (err) {368 var keys = Object.keys(req.params).sort();369 res.send(keys.map(function(k){ return [k, req.params[k]] }));370 });371 });372373 request(app)374 .get('/user/id:42/user:tj/profile')375 .expect(200, '[["0","42"]]', done);376 })377 })378379 describe('trailing slashes', function(){380 it('should be optional by default', function(done){
375 unmodified lines
756 .get('/users/tj/edit')757 .expect('editing tj (old)', cb);758 })759760 it('should work inside literal paranthesis', function(done){761 var app = express();762763 app.get('/:user\\(:op\\)', function(req, res){764 res.end(req.params.op + 'ing ' + req.params.user);765 });766767 request(app)768 .get('/tj(edit)')769 .expect('editing tj', done);770 })771772 it('should work in array of paths', function(done){773 var app = express();774 var cb = after(2, done);775
259 unmodified lines
modified:test/app.routes.error.js+16 added
1 unmodified line
2 , request = require('supertest');34describe('app', function(){5 describe('.VERB()', function(){6 it('should not get invoked without error handler on error', function(done) {7 var app = express();89 app.use(function(req, res, next){10 next(new Error('boom!'))11 });1213 app.get('/bar', function(req, res){14 res.send('hello, world!');15 });1617 request(app)18 .post('/bar')19 .expect(500, /Error: boom!/, done);20 });2122 it('should only call an error handling routing callback when an error is propagated', function(done){23 var app = express();2425 var a = false;
34 unmodified lines
modified:test/res.redirect.js+15 added-21 removed
12var http = require('http');2var express = require('../')3 , request = require('supertest');3var express = require('..');4var request = require('supertest');56describe('res', function(){7 describe('.redirect(url)', function(){8 it('should default to a 302 redirect', function(done){
74 unmodified lines
8384 request(app)85 .get('/')86 .set('Accept', 'text/html')86 .end(function(err, res){87 res.headers.should.have.property('location', 'http://google.com');88 res.text.should.equal('<p>Moved Temporarily. Redirecting to <a href="http://google.com">http://google.com</a></p>');89 done();90 })87 .expect('Content-Type', /html/)88 .expect('Location', 'http://google.com')89 .expect(302, '<p>' + http.STATUS_CODES[302] + '. Redirecting to <a href="http://google.com">http://google.com</a></p>', done);90 })9192 it('should escape the url', function(done){93 var app = express();
5 unmodified lines
99 request(app)100 .get('/')101 .set('Host', 'http://example.com')102 .set('Accept', 'text/html')104 .end(function(err, res){105 res.text.should.equal('<p>Moved Temporarily. Redirecting to <a href="&lt;lame&gt;">&lt;lame&gt;</a></p>');106 done();107 })103 .expect('Content-Type', /html/)104 .expect('Location', '<lame>')105 .expect(302, '<p>' + http.STATUS_CODES[302] + '. Redirecting to <a href="&lt;lame&gt;">&lt;lame&gt;</a></p>', done);106 })107108 it('should include the redirect type', function(done){109 var app = express();
21 unmodified lines
131132 request(app)133 .get('/')134 .set('Accept', 'text/plain, */*')137 .end(function(err, res){138 res.headers.should.have.property('location', 'http://google.com');139 res.headers.should.have.property('content-length', '51');140 res.text.should.equal('Moved Temporarily. Redirecting to http://google.com');141 done();142 })135 .expect('Content-Type', /plain/)136 .expect('Location', 'http://google.com')137 .expect(302, http.STATUS_CODES[302] + '. Redirecting to http://google.com', done);138 })139140 it('should encode the url', function(done){141 var app = express();
5 unmodified lines
147 request(app)148 .get('/')149 .set('Host', 'http://example.com')150 .set('Accept', 'text/plain, */*')156 .end(function(err, res){157 res.text.should.equal('Moved Temporarily. Redirecting to http://example.com/?param=%3Cscript%3Ealert(%22hax%22);%3C/script%3E');158 done();159 })151 .expect('Content-Type', /plain/)152 .expect('Location', 'http://example.com/?param=<script>alert("hax");</script>')153 .expect(302, http.STATUS_CODES[302] + '. Redirecting to http://example.com/?param=%3Cscript%3Ealert(%22hax%22);%3C/script%3E', done);154 })155156 it('should include the redirect type', function(done){157 var app = express();
35 unmodified lines
modified:test/res.send.js+14 added
3 unmodified lines
4var methods = require('methods');5var request = require('supertest');67describe('res', function(){8 describe('.send()', function(){9 it('should set body to ""', function(done){10 var app = express();1112 app.use(function(req, res){13 res.send();14 });1516 request(app)17 .get('/')18 .expect(200, '', done);19 })20 })2122 describe('.send(null)', function(){23 it('should set body to ""', function(done){24 var app = express();25
533 unmodified lines
modified:.travis.yml+3 added-3 removed
1language: node_js2node_js:3 - "0.10"4 - "0.12"5 - "1.0"5 - "1.8"7 - "2.0"8 - "2.3"6 - "2.5"7 - "3.3"8 - "4.2"9sudo: false10before_install: "npm rm --save-dev connect-redis"11script: "npm run-script test-ci"12after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls"
modified:appveyor.yml+3 added-3 removed
1environment:2 matrix:3 - nodejs_version: "0.10"4 - nodejs_version: "0.12"5 - nodejs_version: "1.0"5 - nodejs_version: "1.8"7 - nodejs_version: "2.0"8 - nodejs_version: "2.3"6 - nodejs_version: "2.5"7 - nodejs_version: "3.3"8 - nodejs_version: "4.2"9install:10 - ps: Install-Product node $env:nodejs_version11 - npm rm --save-dev connect-redis12 - npm install
6 unmodified lines
modified:Contributing.md+1 added-5 removed
1# Contributing22## Website Issues34Issues for the expressjs.com website go here https://github.com/strongloop/expressjs.com53## PRs and Code contributions45* Tests must pass.6* Follow existing coding style.
11 unmodified lines
18* Clear description of the expected result.19* Steps you have taken to debug it yourself.2021If you post a question and do not outline the above items or make it easy for us to understand and reproduce your issue, it will be closed.25
modified:History.md+71 added
33 unmodified lines
34 - `req.query` is now a getter instead of a plain property35 * add:36 - `app.router` is a reference to the base router37384.13.4 / 2016-01-2139===================4041 * deps: content-disposition@0.5.142 - perf: enable strict mode43 * deps: cookie@0.1.544 - Throw on invalid values provided to `serialize`45 * deps: depd@~1.1.046 - Support web browser loading47 - perf: enable strict mode48 * deps: escape-html@~1.0.349 - perf: enable strict mode50 - perf: optimize string replacement51 - perf: use faster string coercion52 * deps: finalhandler@0.4.153 - deps: escape-html@~1.0.354 * deps: merge-descriptors@1.0.155 - perf: enable strict mode56 * deps: methods@~1.1.257 - perf: enable strict mode58 * deps: parseurl@~1.3.159 - perf: enable strict mode60 * deps: proxy-addr@~1.0.1061 - deps: ipaddr.js@1.0.562 - perf: enable strict mode63 * deps: range-parser@~1.0.364 - perf: enable strict mode65 * deps: send@0.13.166 - deps: depd@~1.1.067 - deps: destroy@~1.0.468 - deps: escape-html@~1.0.369 - deps: range-parser@~1.0.370 * deps: serve-static@~1.10.271 - deps: escape-html@~1.0.372 - deps: parseurl@~1.3.073 - deps: send@0.13.174754.13.3 / 2015-08-0276===================7778 * Fix infinite loop condition using `mergeParams: true`79 * Fix inner numeric indices incorrectly altering parent `req.params`80814.13.2 / 2015-07-3182===================8384 * deps: accepts@~1.2.1285 - deps: mime-types@~2.1.486 * deps: array-flatten@1.1.187 - perf: enable strict mode88 * deps: path-to-regexp@0.1.789 - Fix regression with escaped round brackets and matching groups90 * deps: type-is@~1.6.691 - deps: mime-types@~2.1.492934.13.1 / 2015-07-0594===================9596 * deps: accepts@~1.2.10
859 unmodified lines
956 - `app.router()` - returns the app Router instance957 - `app.route()` - Proxy to the app's `Router#route()` method to create a new route958 - Router & Route - public API9599603.21.2 / 2015-07-31961===================962963 * deps: connect@2.30.2964 - deps: body-parser@~1.13.3965 - deps: compression@~1.5.2966 - deps: errorhandler@~1.4.2967 - deps: method-override@~2.3.5968 - deps: serve-index@~1.7.2969 - deps: type-is@~1.6.6970 - deps: vhost@~3.0.1971 * deps: vary@~1.0.1972 - Fix setting empty header from empty `field`973 - perf: enable strict mode974 - perf: remove argument reassignments9759763.21.1 / 2015-07-05977===================978979 * deps: basic-auth@~1.0.3
2120 unmodified lines
modified:package.json+31 added-32 removed
11 unmodified lines
12 "Roman Shtylman <shtylman+expressjs@gmail.com>",13 "Young Jae Sim <hanul@hanul.me>"14 ],15 "license": "MIT",16 "repository": "strongloop/express",17 "homepage": "http://expressjs.com/",16 "repository": "expressjs/express",17 "keywords": [18 "express",19 "framework",20 "sinatra",
4 unmodified lines
25 "app",26 "api"27 ],28 "dependencies": {30 "accepts": "~1.2.10",31 "array-flatten": "1.1.0",32 "content-disposition": "0.5.0",29 "accepts": "~1.2.12",30 "array-flatten": "1.1.1",31 "content-disposition": "0.5.1",32 "content-type": "~1.0.1",34 "cookie": "0.1.3",33 "cookie": "0.1.5",34 "cookie-signature": "1.0.6",35 "debug": "~2.2.0",37 "depd": "~1.0.1",38 "escape-html": "1.0.2",36 "depd": "~1.1.0",37 "escape-html": "~1.0.3",38 "etag": "~1.7.0",40 "finalhandler": "0.4.0",39 "finalhandler": "0.4.1",40 "fresh": "0.3.0",42 "merge-descriptors": "1.0.0",43 "methods": "~1.1.1",41 "merge-descriptors": "1.0.1",42 "methods": "~1.1.2",43 "on-finished": "~2.3.0",45 "parseurl": "~1.3.0",44 "parseurl": "~1.3.1",45 "path-is-absolute": "1.0.0",47 "path-to-regexp": "0.1.6",48 "proxy-addr": "~1.0.8",46 "path-to-regexp": "0.1.7",47 "proxy-addr": "~1.0.10",48 "qs": "4.0.0",50 "range-parser": "~1.0.2",49 "range-parser": "~1.0.3",50 "router": "~1.1.2",52 "send": "0.13.0",53 "serve-static": "~1.10.0",54 "type-is": "~1.6.4",55 "vary": "~1.0.0",56 "utils-merge": "1.0.0"51 "send": "0.13.1",52 "serve-static": "~1.10.2",53 "type-is": "~1.6.6",54 "utils-merge": "1.0.0",55 "vary": "~1.0.1"56 },57 "devDependencies": {58 "after": "0.8.1",60 "ejs": "2.3.2",61 "istanbul": "0.3.9",62 "marked": "0.3.3",63 "mocha": "2.2.5",64 "should": "7.0.1",65 "supertest": "1.0.1",66 "body-parser": "~1.13.2",67 "connect-redis": "~2.3.0",68 "cookie-parser": "~1.3.5",59 "ejs": "2.3.4",60 "istanbul": "0.4.2",61 "marked": "0.3.5",62 "mocha": "2.3.4",63 "should": "7.1.1",64 "supertest": "1.1.0",65 "body-parser": "~1.14.2",66 "connect-redis": "~2.4.1",67 "cookie-parser": "~1.4.1",68 "cookie-session": "~1.2.0",70 "express-session": "~1.11.3",69 "express-session": "~1.13.0",70 "jade": "~1.11.0",72 "method-override": "~2.3.3",71 "method-override": "~2.3.5",72 "morgan": "~1.6.1",73 "multiparty": "~4.1.2",75 "vhost": "~3.0.0"74 "vhost": "~3.0.1"75 },76 "engines": {77 "node": ">= 0.10.0"78 },
14 unmodified lines
modified:Readme.md+10 added-10 removed
35 unmodified lines
36 * Executable for generating applications quickly3738## Docs & Community3940 * [Website and Documentation](http://expressjs.com/) - [[website repo](https://github.com/strongloop/expressjs.com)]40 * [#express](https://webchat.freenode.net/?channels=express) on freenode IRC41 * [Github Organization](https://github.com/expressjs) for Official Middleware & Modules43 * Visit the [Wiki](https://github.com/strongloop/express/wiki)42 * [Google Group](https://groups.google.com/group/express-js) for discussion43 * [Gitter](https://gitter.im/expressjs/express) for support and discussion44 * [Русскоязычная документация](http://jsman.ru/express/)46 * [한국어 문서](http://expressjs.kr) - [[website repo](https://github.com/Hanul/expressjs.kr)]4548**PROTIP** Be sure to read [Migrating from 3.x to 4.x](https://github.com/strongloop/express/wiki/Migrating-from-3.x-to-4.x) as well as [New features in 4.x](https://github.com/strongloop/express/wiki/New-features-in-4.x).46###Security Issues4748If you discover a security vulnerability in Express, please see [Security Policies and Procedures](Security.md).4950## Quick Start5152 The quickest way to get started with express is to utilize the executable [`express(1)`](https://github.com/expressjs/generator) to generate an application as shown below:53
35 unmodified lines
8990 To view the examples, clone the Express repo and install the dependencies:9192```bash93$ git clone git://github.com/strongloop/express.git --depth 193$ git clone git://github.com/expressjs/express.git --depth 194$ cd express95$ npm install96```97
17 unmodified lines
115The original author of Express is [TJ Holowaychuk](https://github.com/tj) [![TJ's Gratipay][gratipay-image-visionmedia]][gratipay-url-visionmedia]116117The current lead maintainer is [Douglas Christopher Wilson](https://github.com/dougwilson) [![Doug's Gratipay][gratipay-image-dougwilson]][gratipay-url-dougwilson]118119[List of all contributors](https://github.com/strongloop/express/graphs/contributors)119[List of all contributors](https://github.com/expressjs/express/graphs/contributors)120121## License122123 [MIT](LICENSE)
1 unmodified line
125[npm-image]: https://img.shields.io/npm/v/express.svg126[npm-url]: https://npmjs.org/package/express127[downloads-image]: https://img.shields.io/npm/dm/express.svg128[downloads-url]: https://npmjs.org/package/express129[travis-image]: https://img.shields.io/travis/strongloop/express/master.svg?label=linux130[travis-url]: https://travis-ci.org/strongloop/express129[travis-image]: https://img.shields.io/travis/expressjs/express/master.svg?label=linux130[travis-url]: https://travis-ci.org/expressjs/express131[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/express/master.svg?label=windows132[appveyor-url]: https://ci.appveyor.com/project/dougwilson/express133[coveralls-image]: https://img.shields.io/coveralls/strongloop/express/master.svg134[coveralls-url]: https://coveralls.io/r/strongloop/express?branch=master133[coveralls-image]: https://img.shields.io/coveralls/expressjs/express/master.svg134[coveralls-url]: https://coveralls.io/r/expressjs/express?branch=master135[gratipay-image-visionmedia]: https://img.shields.io/gratipay/visionmedia.svg136[gratipay-url-visionmedia]: https://gratipay.com/visionmedia/137[gratipay-image-dougwilson]: https://img.shields.io/gratipay/dougwilson.svg138[gratipay-url-dougwilson]: https://gratipay.com/dougwilson/
added:Security.md+44 added
1# Security Policies and Procedures23This document outlines security procedures and general policies for the Express4project.56 * [Reporting a Bug](#reporting-a-bug)7 * [Disclosure Policy](#disclosure-policy)8 * [Receiving Security Updates](#receiving-security-updates)9 * [Comments on this Policy](#comments-on-this-policy)1011## Reporting a Bug1213The Express team and community take all security bugs in Express seriously.14Thank you for improving the security of Express. We appreciate your efforts and15responsible disclosure and will make every effort to acknowledge your16contributions.1718Report security bugs by emailing the lead maintainer in the Readme.md file.1920The lead maintainer will acknowledge your email within 48 hours, and will send a21more detailed response within 48 hours indicating the next steps in handling22your report. After the initial reply to your report, the security team will23endeavor to keep you informed of the progress towards a fix and full24announcement, and may ask for additional information or guidance.2526Report security bugs in third-party modules to the person or team maintaining27the module. You can also report a vulnerability through the28[Node Security Project](https://nodesecurity.io/report).2930## Disclosure Policy3132When the security team receives a security bug report, they will assign it to a33primary handler. This person will coordinate the fix and release process,34involving the following steps:3536 * Confirm the problem and determine the affected versions.37 * Audit code to find any potential similar problems.38 * Prepare fixes for all releases still under maintenance. These fixes will be39 released as fast as possible to npm.4041## Comments on this Policy4243If you have suggestions on how this process could be improved please submit a44pull request.