From a849603d8becb6dd976039d93192048dfba89cb8 Mon Sep 17 00:00:00 2001 From: ahmetlutfu Date: Wed, 6 Dec 2023 23:07:52 +0300 Subject: [PATCH] added timeout for http client --- handlers/proxy.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/handlers/proxy.go b/handlers/proxy.go index bedfbde..1668216 100644 --- a/handlers/proxy.go +++ b/handlers/proxy.go @@ -9,6 +9,7 @@ import ( "os" "regexp" "strings" + "time" "ladder/pkg/ruleset" @@ -181,7 +182,9 @@ func fetchSite(urlpath string, queries map[string]string) (string, *http.Request } // Fetch the site - client := &http.Client{} + client := &http.Client{ + Timeout: time.Second * 15, + } req, _ := http.NewRequest("GET", url, nil) if rule.Headers.UserAgent != "" {