Skip to content

Commit

Permalink
Code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
danroc committed Jun 17, 2020
1 parent e3a5234 commit 5b9fc93
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions htp.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ func main() {
}

logger := log.New(os.Stderr, "", 0)
client := http.DefaultClient
client.CheckRedirect = noRedirect
client := &http.Client{}
client.Timeout = 10 * time.Second
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
}

req, err := http.NewRequest("HEAD", opts.host, nil)
if err != nil {
logger.Fatal("Invalid HTTP request: ", err)
}
req.Header.Add("Cache-Control", "no-cache")

var (
t0, t1 int64
Expand Down Expand Up @@ -144,7 +145,3 @@ func mod(x, m int64) int64 {
}
return m + y
}

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

0 comments on commit 5b9fc93

Please # to comment.