Add timeout on proxy connections

This commit is contained in:
Bilal
2020-05-22 16:08:59 +02:00
parent 5fb5d22ff2
commit 0772c2ba1b
3 changed files with 7 additions and 1 deletions

View File

@@ -170,7 +170,10 @@ func fetchPage(url string, connectionId int) (string, error) {
func getHttpClient(connectionId int) (*http.Client, error) {
// setup a http client
httpTransport := &http.Transport{}
httpClient := &http.Client{Transport: httpTransport}
httpClient := &http.Client{
Transport: httpTransport,
Timeout: time.Duration(c.ClientConfig.FetchTimeout) * time.Second,
}
if len(proxyList) == 0 {
log.Printf("(%d) [PROXY] No proxy found, will continue without proxy!\n", connectionId)