reject(newError(`<p>This does not look like an installation script.</p><p>(Its content type is not text/plain, text/x-shellscript, application/x-sh, or application/x-csh.)</p>`))
reject(newError(`<p>This does not look like an installation script.</p><p>(Its content type is not text/plain, text/x-sh, text/x-shellscript, application/x-sh, or application/x-csh.)</p>`))
}
if(parseInt(reportedContentSize)>100000){
reject(newError('The script is over 100KB in size. This is huge for an installation script. Be careful.'))
}
resolve()
})
headRequest.on('error',error=>{
reject(error)
})
headRequest.setTimeout(3000,()=>{
reject(newError('Timed out while attempting to get information about the script.'))
})
...
...
@@ -56,7 +66,6 @@ function preVerifyDownloadViaHeadRequest (url) {
// other folks to not get owned ;)
asyncfunctiondownloadInstallationScript(url){
awaitpreVerifyDownloadViaHeadRequest(url)
returnnewPromise((resolve,reject)=>{
constgetRequest=https.get(url,response=>{
conststatusCode=response.statusCode
...
...
@@ -72,6 +81,9 @@ async function downloadInstallationScript(url) {
response.on('end',()=>{resolve(body)})
})
getRequest.on('error',error=>{
reject(error)
})
getRequest.setTimeout(3000,()=>{
reject(newError('Timed out while attempting to download the script.'))