qcobjects-cli
Advanced tools
Comparing version 0.1.26 to 0.1.27
@@ -276,4 +276,21 @@ /** | ||
this.request.path = req.url; | ||
server.setMaxListeners(9999999999); | ||
CONFIG.set('backendTimeout',CONFIG.get('backendTimeout') || 20000); | ||
server.setTimeout(CONFIG.get('backendTimeout'), ()=>{ | ||
// end the stream on timeout | ||
try { | ||
logger.info('A timeout occurred...' + CONFIG.get('backendTimeout').toString()); | ||
logger.info('Killing session...'); | ||
res.respond([{ | ||
':status': 408, | ||
'content-type': 'text/html' | ||
}]); | ||
res.write('<h1>408 - REQUEST TIMEOUT</h1>'); | ||
res.end(); | ||
}catch (e){ | ||
logger.debug('An unhandled error occurred during timeout catching...'); | ||
logger.debug(e.message); | ||
} | ||
}); | ||
if (this.request.pathname.indexOf('.')<0){ | ||
@@ -280,0 +297,0 @@ this.request.scriptname = CONFIG.get('documentRootFileIndex'); |
@@ -201,6 +201,34 @@ /** | ||
session.origin('https://'+CONFIG.get('domain'),'http://'+CONFIG.get('domain')); | ||
}); | ||
server.on('stream', (stream, headers, flags) => { | ||
CONFIG.set('backendTimeout',CONFIG.get('backendTimeout') || 20000); | ||
stream.session.setTimeout(CONFIG.get('backendTimeout')); | ||
stream.session.setMaxListeners(9999999999); | ||
stream.session.on('timeout', () => { | ||
// end the stream on timeout | ||
try { | ||
if (!stream.destroyed){ | ||
logger.info('A timeout occurred... '+CONFIG.get('backendTimeout').toString()); | ||
logger.info('Killing session...'); | ||
stream.respond([{ | ||
':status': 408, | ||
'content-type': 'text/html' | ||
}]); | ||
stream.write('<h1>408 - REQUEST TIMEOUT</h1>'); | ||
stream.end(); | ||
} else { | ||
logger.debug('Session was normally finishing...'); | ||
} | ||
}catch(e){ | ||
logger.info('An unhandled error occurred during timeout catching...'); | ||
logger.info(e.message); | ||
} | ||
}); | ||
stream.session.altsvc('h2=":8000"', stream.id); | ||
@@ -207,0 +235,0 @@ stream.session.altsvc('https=":'+CONFIG.get('serverPortHTTPS')+'"', stream.id); |
{ | ||
"name": "qcobjects-cli", | ||
"version": "0.1.26", | ||
"version": "0.1.27", | ||
"description": "qcobjects cli command line tool", | ||
@@ -5,0 +5,0 @@ "main": "qcobjects-cli.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66392
1474