Deploying to gh-pages from @ 7d452472de 🚀
This commit is contained in:
@@ -171,6 +171,7 @@ const publicConfigSchema = Joi.object({
|
||||
handleInternalErrors: Joi.boolean().required(),
|
||||
fetchLimit: Joi.string().regex(/^[0-9]+(b|kb|mb|gb|tb)$/i),
|
||||
requestTimeoutSeconds: nonNegativeInteger,
|
||||
requestTimeoutMaxAgeSeconds: nonNegativeInteger,
|
||||
documentRoot: Joi.string().default(
|
||||
path.resolve(__dirname, '..', '..', 'public')
|
||||
),
|
||||
@@ -505,6 +506,18 @@ class Server {
|
||||
this.registerServices()
|
||||
|
||||
camp.timeout = this.config.public.requestTimeoutSeconds * 1000
|
||||
if (this.config.public.requestTimeoutSeconds > 0) {
|
||||
camp.on('timeout', socket => {
|
||||
const maxAge = this.config.public.requestTimeoutMaxAgeSeconds
|
||||
socket.write('HTTP/1.1 408 Request Timeout\n')
|
||||
socket.write('Content-Type: text/html; charset=UTF-8\n')
|
||||
socket.write('Content-Encoding: UTF-8\n')
|
||||
socket.write(`Cache-Control: max-age=${maxAge}, s-maxage=${maxAge}\n`)
|
||||
socket.write('Connection: close\n\n')
|
||||
socket.write('Request Timeout')
|
||||
socket.end()
|
||||
})
|
||||
}
|
||||
camp.listenAsConfigured()
|
||||
|
||||
await new Promise(resolve => camp.on('listening', () => resolve()))
|
||||
@@ -565,7 +578,7 @@ module.exports = Server
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Sun Apr 11 2021 13:14:04 GMT+0000 (Coordinated Universal Time)
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Sun Apr 11 2021 20:30:25 GMT+0000 (Coordinated Universal Time)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
|
||||
Reference in New Issue
Block a user