From f2f3cf3db61e389c8856da260a078e0c157805ce Mon Sep 17 00:00:00 2001 From: Daniel Rocha Date: Sat, 10 Nov 2018 14:26:13 +0100 Subject: [PATCH] Don't follow redirects --- htp.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htp.go b/htp.go index e2e2c73..6f39b5d 100644 --- a/htp.go +++ b/htp.go @@ -18,11 +18,13 @@ const ( ) func main() { - host := flag.String("u", "https://www.google.com", "Host URL") + host := flag.String("u", "https://google.com", "Host URL") count := flag.Uint("n", 8, "Number of requests") quiet := flag.Bool("q", false, "Do not output time offset") flag.Parse() + http.DefaultClient.CheckRedirect = noRedirect + var ( offset int64 lo int64 = math.MinInt64 @@ -81,3 +83,7 @@ func max(a, b int64) int64 { } return b } + +func noRedirect(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse +}