Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const Boom = require('@hapi/boom');
const Hoek = require('@hapi/hoek');
const Joi = require('@hapi/joi');
const Podium = require('@hapi/podium');
const Pending = require('./pending');
const internals = {
day: 24 * 60 * 60 * 1000,
events: Podium.validate([
{ name: 'error', channels: ['generate', 'persist'] }
])
};
internals.schema = Joi.object({
expiresIn: Joi.number().integer().min(1),
expiresAt: Joi.string().regex(/^\d\d?\:\d\d$/),
staleIn: [
Joi.number().integer().min(1).when('expiresAt', { is: Joi.required(), then: Joi.number().max(86400000 - 1) }), // One day - 1 (max is inclusive)
Joi.func()
],
staleTimeout: Joi.number().integer().min(1),
generateFunc: Joi.func(),
generateTimeout: Joi.number().integer().min(1).allow(false),
generateOnReadError: Joi.boolean(),
const Querystring = require('querystring');
const Url = require('url');
const Boom = require('@hapi/boom');
const Bounce = require('@hapi/bounce');
const Hoek = require('@hapi/hoek');
const Podium = require('@hapi/podium');
const Cors = require('./cors');
const Response = require('./response');
const Toolkit = require('./toolkit');
const Transmit = require('./transmit');
const internals = {
events: Podium.validate(['finish', { name: 'peek', spread: true }, 'disconnect']),
reserved: ['server', 'url', 'query', 'path', 'method', 'mime', 'setUrl', 'setMethod', 'headers', 'id', 'app', 'plugins', 'route', 'auth', 'pre', 'preResponses', 'info', 'orig', 'params', 'paramsArray', 'payload', 'state', 'jsonp', 'response', 'raw', 'domain', 'log', 'logs', 'generateResponse']
};
exports = module.exports = internals.Request = class {
constructor(server, req, res, options) {
this._allowInternals = !!options.allowInternals;
this._core = server._core;
this._entity = null; // Entity information set via h.entity()
this._eventContext = { request: this };
this._events = null; // Assigned an emitter when request.events is accessed
this._expectContinue = !!options.expectContinue;
this._isPayloadPending = !!(req.headers['content-length'] || req.headers['transfer-encoding']); // Changes to false when incoming payload fully processed
this._isReplied = false; // true when response processing started
'use strict';
const Stream = require('stream');
const Boom = require('@hapi/boom');
const Bounce = require('@hapi/bounce');
const Hoek = require('@hapi/hoek');
const Podium = require('@hapi/podium');
const Streams = require('./streams');
const internals = {
events: Podium.validate(['finish', { name: 'peek', spread: true }]),
hopByHop: {
connection: true,
'keep-alive': true,
'proxy-authenticate': true,
'proxy-authorization': true,
'te': true,
'trailer': true,
'transfer-encoding': true,
'upgrade': true
}
};
exports = module.exports = internals.Response = class {
constructor(source, request, options = {}) {