Skip to content

Commit 61ab425

Browse files
committed
go: drop dependency on go-httpclient
Believe that Go standard net.Transport now covers what we need.
1 parent 7bfcd4e commit 61ab425

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

go/client/ctclient/ctclient.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/google/certificate-transparency/go/jsonclient"
1616
"github.com/google/certificate-transparency/go/x509"
1717
"github.com/google/certificate-transparency/go/x509util"
18-
httpclient "github.com/mreiferson/go-httpclient"
1918
"golang.org/x/net/context"
2019
)
2120

@@ -176,13 +175,17 @@ func dieWithUsage(msg string) {
176175
func main() {
177176
flag.Parse()
178177
httpClient := &http.Client{
179-
Transport: &httpclient.Transport{
180-
ConnectTimeout: 10 * time.Second,
181-
RequestTimeout: 30 * time.Second,
178+
Timeout: 10 * time.Second,
179+
Transport: &http.Transport{
180+
TLSHandshakeTimeout: 30 * time.Second,
182181
ResponseHeaderTimeout: 30 * time.Second,
183182
MaxIdleConnsPerHost: 10,
184183
DisableKeepAlives: false,
185-
}}
184+
MaxIdleConns: 100,
185+
IdleConnTimeout: 90 * time.Second,
186+
ExpectContinueTimeout: 1 * time.Second,
187+
},
188+
}
186189
var opts jsonclient.Options
187190
if *pubKey != "" {
188191
pubkey, err := ioutil.ReadFile(*pubKey)

go/preload/main/preload.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/google/certificate-transparency/go/jsonclient"
1919
"github.com/google/certificate-transparency/go/preload"
2020
"github.com/google/certificate-transparency/go/scanner"
21-
httpclient "github.com/mreiferson/go-httpclient"
2221
"golang.org/x/net/context"
2322
)
2423

@@ -152,15 +151,18 @@ func main() {
152151
}
153152
}()
154153

155-
transport := &httpclient.Transport{
156-
ConnectTimeout: 10 * time.Second,
157-
RequestTimeout: 30 * time.Second,
154+
transport := &http.Transport{
155+
TLSHandshakeTimeout: 30 * time.Second,
158156
ResponseHeaderTimeout: 30 * time.Second,
159157
MaxIdleConnsPerHost: 10,
160158
DisableKeepAlives: false,
159+
MaxIdleConns: 100,
160+
IdleConnTimeout: 90 * time.Second,
161+
ExpectContinueTimeout: 1 * time.Second,
161162
}
162163

163164
fetchLogClient, err := client.New(*sourceLogURI, &http.Client{
165+
Timeout: 10 * time.Second,
164166
Transport: transport,
165167
}, jsonclient.Options{})
166168
if err != nil {

go/scanner/main/scanner.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"github.com/google/certificate-transparency/go/client"
1515
"github.com/google/certificate-transparency/go/jsonclient"
1616
"github.com/google/certificate-transparency/go/scanner"
17-
httpclient "github.com/mreiferson/go-httpclient"
1817
)
1918

2019
const (
@@ -100,12 +99,15 @@ func createMatcherFromFlags() (scanner.Matcher, error) {
10099
func main() {
101100
flag.Parse()
102101
logClient, err := client.New(*logURI, &http.Client{
103-
Transport: &httpclient.Transport{
104-
ConnectTimeout: 10 * time.Second,
105-
RequestTimeout: 30 * time.Second,
102+
Timeout: 10 * time.Second,
103+
Transport: &http.Transport{
104+
TLSHandshakeTimeout: 30 * time.Second,
106105
ResponseHeaderTimeout: 30 * time.Second,
107106
MaxIdleConnsPerHost: 10,
108107
DisableKeepAlives: false,
108+
MaxIdleConns: 100,
109+
IdleConnTimeout: 90 * time.Second,
110+
ExpectContinueTimeout: 1 * time.Second,
109111
},
110112
}, jsonclient.Options{})
111113
if err != nil {

0 commit comments

Comments
 (0)