Skip to content
This repository has been archived by the owner on May 21, 2022. It is now read-only.

Commit

Permalink
update cmd/fdns to not initialize http.Client if it's not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jimen0 committed Mar 30, 2018
1 parent 053100f commit d030c70
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions cmd/fdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,24 @@ func main() {
}
}()

client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
Timeout: 15 * time.Second,
Transport: &http.Transport{
TLSHandshakeTimeout: 15 * time.Second,
ResponseHeaderTimeout: 16 * time.Second,
MaxIdleConnsPerHost: 15,
DisableKeepAlives: false,
MaxIdleConns: 100,
IdleConnTimeout: 16 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}

var r io.Reader
if *url != "" {
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
Timeout: 15 * time.Second,
Transport: &http.Transport{
TLSHandshakeTimeout: 15 * time.Second,
ResponseHeaderTimeout: 16 * time.Second,
MaxIdleConnsPerHost: 15,
DisableKeepAlives: false,
MaxIdleConns: 100,
IdleConnTimeout: 16 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}

req, err := http.NewRequest("GET", *url, nil)
if err != nil {
log.Fatalf("could not create request: %v", err)
Expand Down

0 comments on commit d030c70

Please sign in to comment.