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