Comparar commits

..

30 Commits

Autor SHA1 Mensagem Data
TJ Holowaychuk 0ac1ba527e Release 2.5.11 2012-06-29 14:27:34 -07:00
TJ Holowaychuk 2968bb00b5 Fixed backport of req.protocol 2012-06-29 14:26:58 -07:00
TJ Holowaychuk ee0917fe4a Release 2.5.10 2012-06-15 15:51:11 -07:00
TJ Holowaychuk d536345c08 Remove annoying engines field from package.json 2012-06-15 15:36:47 -07:00
TJ Holowaychuk 5e3bb4d380 Merge pull request #1137 from cluesque/2.x.protocol
Backport support for X-Forwarded-Proto
2012-05-14 13:55:17 -07:00
Bill Kirtley 319f5c6787 Backport support for trusting X-Forwarded-Proto
ref [4d87efc771]
2012-05-14 16:24:16 -04:00
TJ Holowaychuk 411b59f7fb Merge pull request #1104 from nulltask/2.x
old version number for generated package.json
2012-04-25 10:19:05 -07:00
nulltask f61df956b1 use version of package.json for express command 2012-04-24 12:57:40 +09:00
TJ Holowaychuk e3e7d0def6 Release 2.5.9 2012-04-02 19:21:18 -07:00
TJ Holowaychuk 585039f487 Merge pull request #1037 from pbuyle/2.x
Support PURGE request method.
2012-03-05 13:48:21 -08:00
Pierre Buyle de4bc808a4 Support PURGE request method. 2012-03-05 16:35:14 -05:00
TJ Holowaychuk 1515d53f55 Merge pull request #1020 from papandreou/2.x
req.accepts: */* wildcard fix
2012-02-22 08:57:49 -08:00
Andreas Lind Petersen c92c10d8ff req.accepts: */* wildcard fix.
Look for '*/*' anywhere in the Accept header instead of only supporting it when it's the exact value of the header.

IE8 sends:

    Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*

for which req.accepts('html') returned false.
2012-02-22 11:04:12 +01:00
TJ Holowaychuk bc81e7441c Merge pull request #1007 from mmalecki/fix-boilerplate
[2.x] Do not to call `app.address()` before `listening` event
2012-02-13 10:29:14 -08:00
Maciej Małecki 78b874e881 Do not to call app.address() before listening event
According to joyent/node@d3f6b094c7,
call to `net.Server.address()` should happen only after `net.Server`
emits `listening` event.
2012-02-12 16:53:17 +01:00
Tj Holowaychuk 5c50e3a58c Release 2.5.8 2012-02-08 12:05:54 -08:00
Tj Holowaychuk 508e8cc64e upgrade deps. Closes #991 2012-02-08 12:04:51 -08:00
Tj Holowaychuk 5c962ba27b Release 2.5.7 2012-02-06 10:04:33 -08:00
TJ Holowaychuk 9bcb46848b Merge pull request #992 from mscdex/patch-1
Fixed app.all to not execute twice for the same incoming DELETE request
2012-02-06 10:05:07 -08:00
Brian White 4363b20186 Add test to check for multiple DELETEs in app.all 2012-02-04 23:13:36 -05:00
Brian White 77645bcc93 Fix app.all to not execute twice for the same incoming DELETE method request 2012-02-04 02:08:41 -05:00
TJ Holowaychuk b0a66fe6c9 Merge pull request #985 from Turbo87/patch-2
bin/express: Removed whitespace / Added missing semicolon
2012-01-30 15:09:56 -08:00
Tobias Bieniek e8dd0a1267 bin/express: Removed whitespace / Added missing semicolon 2012-01-30 23:29:57 +01:00
Tj Holowaychuk 9dd7b7b63a Release 2.5.6 2012-01-13 15:37:56 -08:00
Tj Holowaychuk ba80b7ba97 updated hamljs dev dep. Closes #953 2012-01-13 14:06:30 -08:00
TJ Holowaychuk 45bb4aff09 Release 2.5.5 2012-01-08 12:31:48 -08:00
TJ Holowaychuk bb14a86e17 Merge pull request #954 from matthewleon/filename_bug
In express 2.x, filename should be set on cached templates
2012-01-08 12:30:35 -08:00
Matthew Leon Grinshpun 1773681ef8 set filename on cached templates 2012-01-08 12:44:27 +01:00
Tj Holowaychuk 2ac612f14d Release 2.5.4 2012-01-02 08:33:41 -08:00
Tj Holowaychuk 20570fc80d Fixed express(1) eol on 0.4.x. Closes #947 2012-01-02 08:33:05 -08:00
10 arquivos alterados com 154 adições e 39 exclusões
+43
Ver Arquivo
@@ -1,4 +1,47 @@
2.5.11 / 2012-06-29
==================
* Fixed backport of req.protocol
2.5.10 / 2012-06-15
==================
* Remove annoying engines field from package.json
* Backport support for trusting X-Forwarded-Proto
* use version of `package.json` for `express` command
2.5.9/ 2012-04-02
==================
* Added support for PURGE request method [pbuyle]
* Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki]
2.5.8 / 2012-02-08
==================
* Update mkdirp dep. Closes #991
2.5.7 / 2012-02-06
==================
* Fixed `app.all` duplicate DELETE requests [mscdex]
2.5.6 / 2012-01-13
==================
* Updated hamljs dev dep. Closes #953
2.5.5 / 2012-01-08
==================
* Fixed: set `filename` on cached templates [matthewleon]
2.5.4 / 2012-01-02
==================
* Fixed `express(1)` eol on 0.4.x. Closes #947
2.5.3 / 2011-12-30
==================
+16 -7
Ver Arquivo
@@ -9,11 +9,17 @@ var fs = require('fs')
, exec = require('child_process').exec
, mkdirp = require('mkdirp');
/**
* Package information.
*/
var pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json'));
/**
* Framework version.
*/
var version = '2.5.2';
var version = pkg.version;
/**
* Add session support.
@@ -31,7 +37,9 @@ var cssEngine;
* End-of-line code.
*/
var eol = 'win32' == os.platform() ? '\r\n' : '\n';
var eol = os.platform
? ('win32' == os.platform() ? '\r\n' : '\n')
: '\n';
/**
* Template engine to utilize.
@@ -156,7 +164,7 @@ var app = [
, ' */'
, ''
, 'var express = require(\'express\')'
, ' , routes = require(\'./routes\')'
, ' , routes = require(\'./routes\');'
, ''
, 'var app = module.exports = express.createServer();'
, ''
@@ -172,19 +180,20 @@ var app = [
, '});'
, ''
, 'app.configure(\'development\', function(){'
, ' app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); '
, ' app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));'
, '});'
, ''
, 'app.configure(\'production\', function(){'
, ' app.use(express.errorHandler()); '
, ' app.use(express.errorHandler());'
, '});'
, ''
, '// Routes'
, ''
, 'app.get(\'/\', routes.index);'
, ''
, 'app.listen(3000);'
, 'console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);'
, 'app.listen(3000, function(){'
, ' console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);'
, '});'
, ''
].join(eol);
+1 -1
Ver Arquivo
@@ -28,7 +28,7 @@ var exports = module.exports = connect.middleware;
* Framework version.
*/
exports.version = '2.5.3';
exports.version = '2.5.11';
/**
* Shortcut for `new Server(...)`.
+1 -2
Ver Arquivo
@@ -1,4 +1,3 @@
/*!
* Express - HTTPServer
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
@@ -571,7 +570,7 @@ app.all = function(path){
var args = arguments;
if (1 == args.length) return this.routes.lookup('all', path);
methods.forEach(function(method){
if ('all' == method) return;
if ('all' == method || 'del' == method) return;
app[method].apply(this, args);
}, this);
return this;
+36 -2
Ver Arquivo
@@ -135,8 +135,8 @@ req.accepts = function(type){
// normalize extensions ".json" -> "json"
if (type && '.' == type[0]) type = type.substr(1);
// when Accept does not exist, or is '*/*' return true
if (!accept || '*/*' == accept) {
// when Accept does not exist, or contains '*/*' return true
if (!accept || ~accept.indexOf('*/*')) {
return true;
} else if (type) {
// allow "html" vs "text/html" etc
@@ -321,3 +321,37 @@ function isxhr() {
req.__defineGetter__('isXMLHttpRequest', isxhr);
req.__defineGetter__('xhr', isxhr);
/**
* Return the protocol string "http" or "https"
* when requested with TLS. When the "trust proxy"
* setting is enabled the "X-Forwarded-Proto" header
* field will be trusted. If you're running behind
* a reverse proxy that supplies https for you this
* may be enabled.
*
* @return {String}
* @api public
*/
req.__defineGetter__('protocol', function(){
var trustProxy = this.app.get('trust proxy');
return this.connection.encrypted
? 'https'
: trustProxy
? (this.get('X-Forwarded-Proto') || 'http')
: 'http';
});
/**
* Short-hand for:
*
* req.protocol == 'https'
*
* @return {Boolean}
* @api public
*/
req.__defineGetter__('secure', function(){
return 'https' == this.protocol;
});
+2 -3
Ver Arquivo
@@ -402,9 +402,8 @@ res.redirect = function(url, status){
if ('/' != base && 0 != url.indexOf(base)) url = base + url;
// Absolute
var host = req.headers.host
, tls = req.connection.encrypted;
url = 'http' + (tls ? 's' : '') + '://' + host + url;
var host = req.headers.host;
url = req.protocol + '://' + host + url;
}
// Support text/{plain,html} by default
+10 -1
Ver Arquivo
@@ -54,6 +54,14 @@ var RFC5323 = ['SEARCH'];
var RFC5789 = ['PATCH'];
/**
* PURGE Method for caching reverse-proxy
* http://wiki.squid-cache.org/SquidFaq/OperatingSquid#How_can_I_purge_an_object_from_my_cache.3F
* https://www.varnish-cache.org/docs/trunk/tutorial/purging.html
*/
var CACHE_PURGE = ['PURGE'];
/**
* Expose the methods.
*/
@@ -65,6 +73,7 @@ module.exports = [].concat(
, RFC3648
, RFC3744
, RFC5323
, RFC5789).map(function(method){
, RFC5789
, CACHE_PURGE).map(function(method){
return method.toLowerCase();
});
+19 -16
Ver Arquivo
@@ -47,7 +47,10 @@ exports.register = View.register;
*/
exports.compile = function(view, cache, cid, options){
if (cache && cid && cache[cid]) return cache[cid];
if (cache && cid && cache[cid]){
options.filename = cache[cid].path;
return cache[cid];
}
// lookup
view = exports.lookup(view, options);
@@ -58,13 +61,13 @@ exports.compile = function(view, cache, cid, options){
var err = new Error('failed to locate view "' + view.original.view + '"');
err.view = view.original;
throw err;
}
}
// compile
options.filename = view.path;
view.fn = view.templateEngine.compile(view.contents, options);
cache[cid] = view;
return view;
};
@@ -81,11 +84,11 @@ exports.compile = function(view, cache, cid, options){
*
* Lookup:
*
* - partial `_<name>`
* - any `<name>/index`
* - non-layout `../<name>/index`
* - any `<root>/<name>`
* - partial `<root>/_<name>`
* - partial `_<name>`
* - any `<name>/index`
* - non-layout `../<name>/index`
* - any `<root>/<name>`
* - partial `<root>/_<name>`
*
* @param {String} view
* @param {Object} options
@@ -161,7 +164,7 @@ function renderPartial(res, view, options, parentLocals, parent){
// Inherit locals from parent
union(options, parentLocals);
// Merge locals
if (locals) merge(options, locals);
@@ -202,7 +205,7 @@ function renderPartial(res, view, options, parentLocals, parent){
options.lastInCollection = i == len - 1;
object = val;
buf += render();
}
}
} else {
keys = Object.keys(collection);
len = keys.length;
@@ -227,20 +230,20 @@ function renderPartial(res, view, options, parentLocals, parent){
};
/**
* Render `view` partial with the given `options`. Optionally a
* Render `view` partial with the given `options`. Optionally a
* callback `fn(err, str)` may be passed instead of writing to
* the socket.
*
* Options:
*
* - `object` Single object with name derived from the view (unless `as` is present)
* - `object` Single object with name derived from the view (unless `as` is present)
*
* - `as` Variable name for each `collection` value, defaults to the view name.
* * as: 'something' will add the `something` local variable
* * as: this will use the collection value as the template context
* * as: global will merge the collection value's properties with `locals`
*
* - `collection` Array of objects, the name is derived from the view name itself.
* - `collection` Array of objects, the name is derived from the view name itself.
* For example _video.html_ will have a object _video_ available to it.
*
* @param {String} view
@@ -294,7 +297,7 @@ res.partial = function(view, options, fn){
* automatically, however otherwise a response of _200_ and _text/html_ is given.
*
* Options:
*
*
* - `scope` Template evaluation context (the value of `this`)
* - `debug` Output debugging information
* - `status` Response status code
@@ -430,7 +433,7 @@ res._render = function(view, opts, fn, parent, sub){
// partial return
} else if (partial) {
return str;
// render complete, and
// render complete, and
// callback given
} else if (fn) {
fn(null, str);
@@ -454,4 +457,4 @@ function hintAtViewPaths(view, options) {
console.error(' - %s', path);
});
console.error();
}
}
+6 -7
Ver Arquivo
@@ -1,7 +1,7 @@
{
"name": "express",
"description": "Sinatra inspired web development framework",
"version": "2.5.3",
"version": "2.5.11",
"author": "TJ Holowaychuk <tj@vision-media.ca>",
"contributors": [
{ "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
@@ -11,15 +11,15 @@
],
"dependencies": {
"connect": "1.x",
"mime": ">= 0.0.1",
"qs": ">= 0.3.1",
"mkdirp": "0.0.7"
"mime": "1.2.4",
"qs": "0.4.x",
"mkdirp": "0.3.0"
},
"devDependencies": {
"connect-form": "0.2.1",
"ejs": "0.4.2",
"expresso": "0.9.2",
"hamljs": "0.5.1",
"hamljs": "0.6.x",
"jade": "0.16.2",
"stylus": "0.13.0",
"should": "0.3.2",
@@ -34,6 +34,5 @@
"scripts": {
"test": "make test",
"prepublish" : "npm prune"
},
"engines": { "node": ">= 0.4.1 < 0.7.0" }
}
}
+20
Ver Arquivo
@@ -821,5 +821,25 @@ module.exports = {
assert.response(app,
{ url: '/1/2/3' },
{ body: '["1","2","3"]' });
},
'test app.all for multiple deletes': function(beforeExit){
var app = express.createServer();
var deletes = 0;
app.all('*', function(req, res, next){
if (req.method === 'DELETE')
deletes++;
next();
});
assert.response(app,
{ url: '/', method: 'DELETE' },
{ status: 404 });
beforeExit(function(){
deletes.should.eql(1);
});
}
};