From e34cf27a9747d297a1265c69ab1feb915347fe7d Mon Sep 17 00:00:00 2001 From: TsvetanMilanov Date: Thu, 31 Jan 2019 15:50:24 +0200 Subject: [PATCH] Don't set request timeout for PUT and POST The current stuck request timeout does not handle the missing server hello case but it fixes the problem with stuck requests other than PUT and POST. --- lib/common/http-client.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/common/http-client.ts b/lib/common/http-client.ts index cb30d342b2..2eb04f04d7 100644 --- a/lib/common/http-client.ts +++ b/lib/common/http-client.ts @@ -134,14 +134,16 @@ export class HttpClient implements Server.IHttpClient { const requestObj = request(options); cleanupRequestData.req = requestObj; - stuckRequestTimerId = setTimeout(() => { - clearTimeout(stuckRequestTimerId); - stuckRequestTimerId = null; - if (!hasResponse) { - this.setResponseResult(promiseActions, cleanupRequestData, { err: new Error(HttpClient.STUCK_REQUEST_ERROR_MESSAGE) }); - } - }, options.timeout || HttpClient.STUCK_REQUEST_TIMEOUT); - cleanupRequestData.timers.push(stuckRequestTimerId); + if (options.method !== "PUT" && options.method !== "POST") { + stuckRequestTimerId = setTimeout(() => { + clearTimeout(stuckRequestTimerId); + stuckRequestTimerId = null; + if (!hasResponse) { + this.setResponseResult(promiseActions, cleanupRequestData, { err: new Error(HttpClient.STUCK_REQUEST_ERROR_MESSAGE) }); + } + }, options.timeout || HttpClient.STUCK_REQUEST_TIMEOUT); + cleanupRequestData.timers.push(stuckRequestTimerId); + } requestObj .on("error", (err: IHttpRequestError) => {