From 5e9fb54aaedcf5949e42c0d8e7a25093bdc6ac14 Mon Sep 17 00:00:00 2001 From: unwox Date: Mon, 3 Feb 2025 15:44:36 +0600 Subject: do not follow redirect when calling luna.http.request --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index d7974a1..96f0a18 100644 --- a/main.go +++ b/main.go @@ -37,7 +37,12 @@ func main() { } luaArgv := flag.Args() mustExist(luaArgv[0]) - httpClient := &http.Client{} + httpClient := &http.Client{ + // do not follow redirects + CheckRedirect: func(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse + }, + } // queue for http messages for workers to handle msgs := make(chan *HTTPRequest, 4096) -- cgit v1.2.3