Skip to content

Commit

Permalink
Don't follow redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
danroc committed Nov 10, 2018
1 parent 4deb513 commit f2f3cf3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion htp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -81,3 +83,7 @@ func max(a, b int64) int64 {
}
return b
}

func noRedirect(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
}

0 comments on commit f2f3cf3

Please # to comment.