control/controlclient: restore Options.HTTPC as Options.HTTPTestClient

I removed the HTTPC field in b6fa5a69be but it was apparently still
used in [oss-skipped] tests.

Restore it, but name it so it's more obvious that it's only for
tests. (It currently is, and I'd like to keep it like that for now.)
reviewable/pr331/r1
Brad Fitzpatrick 5 years ago
parent 6fcbd4c4d4
commit eb6de2bd88

@ -102,6 +102,7 @@ type Options struct {
NewDecompressor func() (Decompressor, error)
KeepAlive bool
Logf logger.Logf
HTTPTestClient *http.Client // optional HTTP client to use (for tests only)
}
type Decompressor interface {
@ -128,10 +129,13 @@ func NewDirect(opts Options) (*Direct, error) {
opts.Logf = log.Printf
}
tr := http.DefaultTransport.(*http.Transport).Clone()
tr.ForceAttemptHTTP2 = true
tr.TLSClientConfig = tlsdial.Config(serverURL.Host, tr.TLSClientConfig)
httpc := &http.Client{Transport: tr}
httpc := opts.HTTPTestClient
if httpc == nil {
tr := http.DefaultTransport.(*http.Transport).Clone()
tr.ForceAttemptHTTP2 = true
tr.TLSClientConfig = tlsdial.Config(serverURL.Host, tr.TLSClientConfig)
httpc = &http.Client{Transport: tr}
}
c := &Direct{
httpc: httpc,

Loading…
Cancel
Save