Compare commits

...

55 Commits

Author SHA1 Message Date
Tj Holowaychuk
cb1f536eb5 Release 1.0.3 2011-01-13 14:09:00 -08:00
Ryan Grove
7791169810 Remove unsafe characters from JSONP callback names.
This prevents JSONP callbacks from being used as an XSS vector. The set
of acceptable characters is intentionally more limited than the full
set of valid characters in JS identifiers in order to avoid complexity,
but this could be expanded in the future if necessary.
2011-01-13 14:06:57 -08:00
Tj Holowaychuk
1b854f4297 Added .gitignore 2011-01-10 18:11:23 -08:00
Tj Holowaychuk
52353da08b Release 1.0.2 2011-01-10 18:09:16 -08:00
Tj Holowaychuk
dc56b9b603 Removed nested require, using connect.router 2011-01-10 18:08:33 -08:00
Tj Holowaychuk
1446135545 docs 2011-01-03 13:33:51 -08:00
Tj Holowaychuk
cdc46307d7 Release 1.0.1 2010-12-29 11:38:02 -08:00
Tj Holowaychuk
dbf02c231a Fixed for middleware stacked via createServer() 2010-12-29 11:34:27 -08:00
Tj Holowaychuk
4732185e6f Fixed express(1) generated tests for express 0.7.0. Closes #484 2010-12-14 08:22:38 -08:00
Tj Holowaychuk
84a95b3101 Updated connect submodule 2010-12-06 14:54:50 -08:00
Tj Holowaychuk
09e8fe280b older expresso 2010-11-24 08:16:59 -08:00
Tj Holowaychuk
0e4ea9c16b Updated jade submodule 2010-11-24 08:14:44 -08:00
Tj Holowaychuk
c7542aef95 Merge branch 'master' into 1.x 2010-11-17 11:26:55 -08:00
Tj Holowaychuk
6873bce6c6 Merge branch 'master' into 1.x 2010-11-16 18:04:57 -08:00
Tj Holowaychuk
6ddacb6302 Merge branch 'master' into 1.x 2010-11-16 17:58:33 -08:00
Tj Holowaychuk
e1d33992a7 Merge branch 'master' into 1.x 2010-11-13 10:55:19 -08:00
Tj Holowaychuk
569c5139a6 Merge branch 'master' into 1.x 2010-11-12 08:46:07 -08:00
Tj Holowaychuk
6f5f5787e2 Merge branch 'master' into 1.x 2010-11-08 07:18:52 -08:00
Tj Holowaychuk
94cf769dd7 Merge branch 'master' into 1.x 2010-10-26 12:09:17 -07:00
Tj Holowaychuk
6d00b45eed Merge branch 'master' into 1.x 2010-10-26 01:18:24 -07:00
Tj Holowaychuk
6a4c6933aa Merge branch 'master' into 1.x 2010-10-22 16:20:47 -07:00
Tj Holowaychuk
c35ee2427e Merge branch 'master' into 1.x 2010-10-21 19:53:39 -07:00
Tj Holowaychuk
3d7216935a Merge branch 'master' into 1.x 2010-10-20 10:07:54 -07:00
Tj Holowaychuk
fc15c3d02b Merge branch 'master' into 1.x 2010-10-19 17:19:39 -07:00
Tj Holowaychuk
9eaec5b34e Merge branch 'master' into 1.x 2010-10-19 17:03:18 -07:00
Tj Holowaychuk
30712fa9d9 Merge branch 'master' into 1.x 2010-10-19 15:03:02 -07:00
Tj Holowaychuk
b817579d8a Merge branch 'master' into 1.x 2010-10-19 09:20:23 -07:00
Tj Holowaychuk
cbcaba3cec Merge branch 'master' into 1.x 2010-10-15 10:02:29 -07:00
Tj Holowaychuk
4e11fef43b Merge branch 'master' into 1.x 2010-10-15 08:26:04 -07:00
Tj Holowaychuk
067fdd5c4c Merge branch 'master' into 1.x 2010-10-14 09:08:19 -07:00
Tj Holowaychuk
fff815f666 Merge branch 'master' into 1.x 2010-10-14 04:17:19 -07:00
Tj Holowaychuk
609c18aa5b Merge branch 'master' into 1.x 2010-10-14 03:50:56 -07:00
Tj Holowaychuk
73c108ce90 Merge branch 'master' into 1.x 2010-10-14 03:03:24 -07:00
Tj Holowaychuk
1e9da205a7 Merge branch 'master' into 1.x 2010-10-12 12:59:14 -07:00
Tj Holowaychuk
d5539c7beb Merge branch 'master' into 1.x 2010-10-12 08:46:48 -07:00
Tj Holowaychuk
f87bd8c38f Merge branch 'master' into 1.x 2010-10-11 08:37:49 -07:00
Tj Holowaychuk
05515fa09e Merge branch 'master' into 1.x 2010-10-11 08:18:01 -07:00
Tj Holowaychuk
35c91ed6f5 Merge branch 'master' into 1.x 2010-10-08 11:39:14 -07:00
Tj Holowaychuk
26238c429d Merge branch 'master' into 1.x 2010-10-07 06:35:27 -07:00
Tj Holowaychuk
1b28ad16d4 Merge branch 'master' into 1.x 2010-10-07 05:46:45 -07:00
Tj Holowaychuk
e29f3aa5dd Merge branch 'master' into 1.x 2010-10-07 03:50:02 -07:00
Tj Holowaychuk
5c94603787 Merge branch 'master' into 1.x 2010-10-07 02:36:41 -07:00
Tj Holowaychuk
9409107f77 Merge branch 'master' into 1.x 2010-10-06 08:26:29 -07:00
Tj Holowaychuk
7f11aa25ea Merge branch 'master' into 1.x 2010-10-05 06:32:50 -07:00
Tj Holowaychuk
1994f24d82 Merge branch 'master' into 1.x 2010-10-04 11:16:56 -07:00
Tj Holowaychuk
b5b30a3f20 Merge branch 'master' into 1.x 2010-10-04 11:06:33 -07:00
Tj Holowaychuk
4fcbb961eb Merge branch 'master' into 1.x 2010-10-04 08:04:12 -07:00
Tj Holowaychuk
11cfad755a Merge branch 'master' into 1.x 2010-10-04 08:01:30 -07:00
Tj Holowaychuk
0b24bd08c9 Merge branch 'master' into 1.x 2010-10-01 16:33:34 -07:00
Tj Holowaychuk
b377839538 Merge branch 'master' into 1.x 2010-10-01 16:31:40 -07:00
Tj Holowaychuk
698d82f799 Merge branch 'master' into 1.x 2010-10-01 07:34:14 -07:00
Tj Holowaychuk
462a291eb8 Merge branch 'master' into 1.x 2010-09-23 09:37:05 -07:00
Tj Holowaychuk
79dc2467f7 Merge branch 'master' into 1.x 2010-09-22 16:09:15 -07:00
Tj Holowaychuk
0a0c86813d Merge branch 'master' into 1.x 2010-09-22 12:03:42 -07:00
Tj Holowaychuk
dfdc939816 Multipart typo 2010-09-21 12:39:14 -07:00
13 changed files with 61 additions and 25 deletions

4
.npmignore Normal file
View File

@@ -0,0 +1,4 @@
test
support
examples
docs

View File

@@ -1,4 +1,22 @@
1.0.3 / 2011-01-13
==================
* Remove unsafe characters from JSONP callback names [Ryan Grove]
1.0.2 / 2011-01-10
==================
* Removed nested require, using `connect.router`
1.0.1 / 2010-12-29
==================
* Fixed for middleware stacked via `createServer()`
previously the `foo` middleware passed to `createServer(foo)`
would not have access to Express methods such as `res.send()`
or props like `req.query` etc.
1.0.0 / 2010-11-16
==================

View File

@@ -69,7 +69,7 @@ The following are the major contributors of Express (in no specific order).
The latest release of Express is compatible with node --version:
v0.2.4
v0.2.5
and connect --version:

View File

@@ -12,7 +12,7 @@ var fs = require('fs')
* Framework version.
*/
var version = '1.0.0';
var version = '1.0.3';
/**
* stdin stream.
@@ -145,10 +145,11 @@ var appTest = [
, " * Module dependencies."
, " */"
, ""
, "var app = require('../app');"
, "var app = require('../app')"
, " , assert = require('assert');"
, "",
, "module.exports = {"
, " 'GET /': function(assert){"
, " 'GET /': function(){"
, " assert.response(app,"
, " { url: '/' },"
, " { status: 200, headers: { 'Content-Type': 'text/html; charset=utf-8' }},"

View File

@@ -36,19 +36,21 @@ Note the use of _app.router_, which can (optionally) be used to mount the applic
otherwise the first call to _app.{get,put,del,post}()_ will mount the routes.
app.configure(function(){
app.use(express.methodOverride());
app.use(express.bodyDecoder());
app.use(app.router);
app.use(express.staticProvider(__dirname + '/public'));
});
app.configure('development', function(){
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
app.use(express.errorHandler());
});
app.use(express.methodOverride());
app.use(express.bodyDecoder());
app.use(app.router);
});
app.configure('development', function(){
app.use(express.staticProvider(__dirname + '/public'));
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.configure('production', function(){
var oneYear = 31557600000;
app.use(express.staticProvider({ root: __dirname + '/public', maxAge: oneYear }));
app.use(express.errorHandler());
});
For internal and arbitrary settings Express provides the _set(key[, val])_, _enable(key)_, _disable(key)_ methods:

View File

@@ -19,7 +19,7 @@ var exports = module.exports = require('connect').middleware;
* Framework version.
*/
exports.version = '1.0.0';
exports.version = '1.0.3';
/**
* Module dependencies.

View File

@@ -85,7 +85,7 @@ http.ServerResponse.prototype.send = function(body, headers, status){
body = JSON.stringify(body);
if (this.req.query.callback && this.app.settings['jsonp callback']) {
this.header('Content-Type', 'text/javascript');
body = this.req.query.callback + '(' + body + ');';
body = this.req.query.callback.replace(/[^\w$.]/g, '') + '(' + body + ');';
}
}
break;

View File

@@ -14,7 +14,7 @@ var url = require('url')
, connect = require('connect')
, utils = connect.utils
, queryString = require('querystring')
, router = require('connect/middleware/router');
, router = require('connect').router;
/**
* Initialize a new `Server` with optional `middleware`.
@@ -32,7 +32,7 @@ var Server = exports = module.exports = function Server(middleware){
this.viewHelpers = {};
this.dynamicViewHelpers = {};
this.errorHandlers = [];
connect.Server.call(this, middleware || []);
connect.Server.call(this, []);
// Default "home" to /
this.set('home', '/');
@@ -65,6 +65,13 @@ var Server = exports = module.exports = function Server(middleware){
next();
});
// Apply middleware
if (middleware) {
middleware.forEach(function(fn){
self.use(fn);
});
}
// Use router, expose as app.get(), etc
var fn = router(function(app){ self.routes = app; });
this.__defineGetter__('router', function(){

View File

@@ -1,7 +1,7 @@
{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "1.0.0",
"version": "1.0.3",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },

View File

@@ -63,6 +63,10 @@ module.exports = {
{ url: '/jsonp?callback=baz' },
{ body: 'baz({"foo":"bar"});', status: 201, headers: { 'Content-Type': 'text/javascript', 'X-Foo': 'baz' }});
assert.response(app,
{ url: '/jsonp?callback=illegal()[]=;' },
{ body: 'illegal({"foo":"bar"});', status: 201, headers: { 'Content-Type': 'text/javascript', 'X-Foo': 'baz' }});
assert.response(app,
{ url: '/json?callback=test' },
{ body: '{"foo":"bar"}', status: 201, headers: { 'Content-Type': 'application/json', 'X-Foo': 'baz' }});