Comparing version 16.1.1 to 16.2.0
@@ -91,2 +91,3 @@ 'use strict'; | ||
this.listener.on('request', this._dispatch()); | ||
this.listener.on('checkContinue', this._dispatch({ expectContinue: true })); | ||
this._init(); | ||
@@ -93,0 +94,0 @@ |
@@ -280,3 +280,3 @@ 'use strict'; | ||
if (pre.assign) { | ||
request.pre[pre.assign] = response.source; | ||
request.pre[pre.assign] = (response instanceof Error ? response : response.source); | ||
request.preResponses[pre.assign] = response; | ||
@@ -283,0 +283,0 @@ } |
@@ -68,11 +68,3 @@ 'use strict'; | ||
this.cache.provision = (opts, callback) => { | ||
if (!callback) { | ||
return Promises.wrap(null, this.cache.provision, [opts]); | ||
} | ||
return this.root._createCache(opts, callback); | ||
}; | ||
this.cache = internals.cache(this); | ||
this._single(); | ||
@@ -337,16 +329,30 @@ | ||
internals.Plugin.prototype.cache = function (options, _segment) { | ||
internals.cache = (plugin) => { | ||
options = Schema.apply('cachePolicy', options); | ||
const policy = function (options, _segment) { | ||
const segment = options.segment || _segment || (this.realm.plugin ? '!' + this.realm.plugin : ''); | ||
Hoek.assert(segment, 'Missing cache segment name'); | ||
options = Schema.apply('cachePolicy', options); | ||
const cacheName = options.cache || '_default'; | ||
const cache = this.root._caches[cacheName]; | ||
Hoek.assert(cache, 'Unknown cache', cacheName); | ||
Hoek.assert(!cache.segments[segment] || cache.shared || options.shared, 'Cannot provision the same cache segment more than once'); | ||
cache.segments[segment] = true; | ||
const segment = options.segment || _segment || (plugin.realm.plugin ? '!' + plugin.realm.plugin : ''); | ||
Hoek.assert(segment, 'Missing cache segment name'); | ||
return new Catbox.Policy(options, cache.client, segment); | ||
const cacheName = options.cache || '_default'; | ||
const cache = plugin.root._caches[cacheName]; | ||
Hoek.assert(cache, 'Unknown cache', cacheName); | ||
Hoek.assert(!cache.segments[segment] || cache.shared || options.shared, 'Cannot provision the same cache segment more than once'); | ||
cache.segments[segment] = true; | ||
return new Catbox.Policy(options, cache.client, segment); | ||
}; | ||
policy.provision = (opts, callback) => { | ||
if (!callback) { | ||
return Promises.wrap(null, plugin.cache.provision, [opts]); | ||
} | ||
return plugin.root._createCache(opts, callback); | ||
}; | ||
return policy; | ||
}; | ||
@@ -353,0 +359,0 @@ |
@@ -67,3 +67,3 @@ 'use strict'; | ||
const reply = (err, response, data) => { | ||
let reply = (err, response, data) => { | ||
@@ -76,2 +76,20 @@ Hoek.assert(data === undefined || options.data, 'Reply interface does not allow a third argument'); | ||
const domain = request.domain; | ||
if (domain) { | ||
reply = domain.bind(reply); | ||
reply.close = domain.bind(internals.close); | ||
reply.continue = domain.bind(internals.continue); | ||
reply.redirect = domain.bind(internals.redirect); | ||
reply.response = domain.bind(internals.response); | ||
reply.entity = domain.bind(internals.entity); | ||
} | ||
else { | ||
reply.close = internals.close; | ||
reply.continue = internals.continue; | ||
reply.redirect = internals.redirect; | ||
reply.response = internals.response; | ||
reply.entity = internals.entity; | ||
} | ||
reply._settings = options; | ||
@@ -84,9 +102,4 @@ reply._replied = false; | ||
reply.close = internals.close; | ||
reply.continue = internals.continue; | ||
reply.state = internals.state; | ||
reply.unstate = internals.unstate; | ||
reply.redirect = internals.redirect; | ||
reply.response = internals.response; | ||
reply.entity = internals.entity; | ||
@@ -97,3 +110,4 @@ if (this._decorations) { | ||
const method = methods[i]; | ||
reply[method] = this._decorations[method]; | ||
const decoration = this._decorations[method]; | ||
reply[method] = (domain ? domain.bind(decoration) : decoration); | ||
} | ||
@@ -206,3 +220,4 @@ } | ||
if (Response.unmodified(this.request, options)) { | ||
const entity = Response.entity(options.etag, options); | ||
if (Response.unmodified(this.request, entity)) { | ||
return this.response().code(304).takeover(); | ||
@@ -209,0 +224,0 @@ } |
@@ -135,3 +135,4 @@ 'use strict'; | ||
this._allowInternals = !!options.allowInternals; | ||
this._isPayloadPending = true; // false when incoming payload fully processed | ||
this._expectContinue = !!options.expectContinue; | ||
this._isPayloadPending = !!(req.headers['content-length'] || req.headers['transfer-encoding']); // false when incoming payload fully processed | ||
this._isBailed = false; // true when lifecycle should end | ||
@@ -138,0 +139,0 @@ this._isReplied = false; // true when response processing started |
@@ -184,8 +184,20 @@ 'use strict'; | ||
const entity = internals.Response.entity(tag, options); | ||
this._header('etag', entity.etag); | ||
this.settings.varyEtag = entity.vary; | ||
return this; | ||
}; | ||
internals.Response.entity = function (tag, options) { | ||
options = options || {}; | ||
Hoek.assert(tag !== '*', 'ETag cannot be *'); | ||
options = options || {}; | ||
this._header('etag', (options.weak ? 'W/' : '') + '"' + tag + '"'); | ||
this.settings.varyEtag = options.vary !== false && !options.weak; // vary defaults to true | ||
return this; | ||
return { | ||
etag: (options.weak ? 'W/' : '') + '"' + tag + '"', | ||
vary: (options.vary !== false && !options.weak), // vary defaults to true | ||
modified: options.modified | ||
}; | ||
}; | ||
@@ -192,0 +204,0 @@ |
@@ -401,2 +401,6 @@ 'use strict'; | ||
if (request._expectContinue) { | ||
request.raw.res.writeContinue(); | ||
} | ||
const onParsed = (err, parsed) => { | ||
@@ -428,3 +432,3 @@ | ||
request._isPayloadPending = false; | ||
request._isPayloadPending = !!(err || (parsed.payload && parsed.payload._readableState)); | ||
return onParsed(err, parsed); | ||
@@ -431,0 +435,0 @@ } |
@@ -11,2 +11,3 @@ 'use strict'; | ||
const Mimos = require('mimos'); | ||
const Podium = require('podium'); | ||
const Connection = require('./connection'); | ||
@@ -17,3 +18,2 @@ const Defaults = require('./defaults'); | ||
const Plugin = require('./plugin'); | ||
const Podium = require('podium'); | ||
const Promises = require('./promises'); | ||
@@ -20,0 +20,0 @@ const Reply = require('./reply'); |
@@ -226,3 +226,5 @@ 'use strict'; | ||
const isInjection = Shot.isInjection(request.raw.req); | ||
if (!isInjection && !request.connection._started) { | ||
if (!(isInjection || request.connection._started) || | ||
(request._isPayloadPending && !request.raw.req._readableState.ended)) { | ||
response._header('connection', 'close'); | ||
@@ -229,0 +231,0 @@ } |
@@ -128,3 +128,7 @@ 'use strict'; | ||
payload: request.payload, | ||
auth: request.auth | ||
auth: request.auth, | ||
app: { | ||
route: request.route.settings.app, | ||
request: request.app | ||
} | ||
} | ||
@@ -224,5 +228,6 @@ }; | ||
payload: request.payload, | ||
auth: { | ||
isAuthenticated: request.auth.isAuthenticated, | ||
credentials: request.auth.credentials | ||
auth: request.auth, | ||
app: { | ||
route: request.route.settings.app, | ||
request: request.app | ||
} | ||
@@ -229,0 +234,0 @@ } |
{ | ||
"name": "hapi", | ||
"version": "16.1.0", | ||
"version": "16.1.1", | ||
"dependencies": { | ||
"accept": { | ||
"version": "2.1.3" | ||
"version": "2.1.4" | ||
}, | ||
"ammo": { | ||
"version": "2.0.3" | ||
"version": "2.0.4" | ||
}, | ||
@@ -15,9 +15,9 @@ "b64": { | ||
"boom": { | ||
"version": "4.2.0" | ||
"version": "5.1.0" | ||
}, | ||
"call": { | ||
"version": "4.0.0" | ||
"version": "4.0.2" | ||
}, | ||
"catbox": { | ||
"version": "7.1.3" | ||
"version": "7.1.4" | ||
}, | ||
@@ -28,15 +28,15 @@ "catbox-memory": { | ||
"content": { | ||
"version": "3.0.3" | ||
"version": "3.0.4" | ||
}, | ||
"cryptiles": { | ||
"version": "3.1.1" | ||
"version": "3.1.2" | ||
}, | ||
"heavy": { | ||
"version": "4.0.3" | ||
"version": "4.0.4" | ||
}, | ||
"hoek": { | ||
"version": "4.1.0" | ||
"version": "4.1.1" | ||
}, | ||
"iron": { | ||
"version": "4.0.4" | ||
"version": "4.0.5" | ||
}, | ||
@@ -50,6 +50,6 @@ "isemail": { | ||
"joi": { | ||
"version": "10.1.0" | ||
"version": "10.5.1" | ||
}, | ||
"mime-db": { | ||
"version": "1.25.0" | ||
"version": "1.28.0" | ||
}, | ||
@@ -63,3 +63,3 @@ "mimos": { | ||
"pez": { | ||
"version": "2.1.4" | ||
"version": "2.1.5" | ||
}, | ||
@@ -73,6 +73,6 @@ "podium": { | ||
"statehood": { | ||
"version": "5.0.1" | ||
"version": "5.0.2" | ||
}, | ||
"subtext": { | ||
"version": "4.3.0" | ||
"version": "4.4.1" | ||
}, | ||
@@ -86,5 +86,5 @@ "topo": { | ||
"wreck": { | ||
"version": "10.0.0" | ||
"version": "12.2.2" | ||
} | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
"homepage": "http://hapijs.com", | ||
"version": "16.1.1", | ||
"version": "16.2.0", | ||
"repository": { | ||
@@ -24,3 +24,3 @@ "type": "git", | ||
"ammo": "2.x.x", | ||
"boom": "4.x.x", | ||
"boom": "5.x.x", | ||
"call": "4.x.x", | ||
@@ -46,5 +46,5 @@ "catbox": "7.x.x", | ||
"inert": "4.x.x", | ||
"lab": "11.x.x", | ||
"lab": "13.x.x", | ||
"vision": "4.x.x", | ||
"wreck": "10.x.x" | ||
"wreck": "12.x.x" | ||
}, | ||
@@ -51,0 +51,0 @@ "scripts": { |
@@ -11,3 +11,3 @@ <img src="https://raw.github.com/hapijs/hapi/master/images/hapi.png" /> | ||
Development version: **16.1.x** ([release notes](https://github.com/hapijs/hapi/issues?labels=release+notes&page=1&state=closed)) | ||
Development version: **16.2.x** ([release notes](https://github.com/hapijs/hapi/issues?labels=release+notes&page=1&state=closed)) | ||
[](http://travis-ci.org/hapijs/hapi) | ||
@@ -14,0 +14,0 @@ |
183894
4520
- Removedboom@4.3.1(transitive)
Updatedboom@5.x.x