1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
16 type contextContext interface {
17 Done() <-chan struct{}
21 type fakeContext struct{}
23 func (fakeContext) Done() <-chan struct{} { return nil }
24 func (fakeContext) Err() error { panic("should not be called") }
26 func reqContext(r *http.Request) fakeContext {
30 func setResponseUncompressed(res *http.Response) {
34 type clientTrace struct{}
36 func requestTrace(*http.Request) *clientTrace { return nil }
37 func traceGotConn(*http.Request, *ClientConn) {}
38 func traceFirstResponseByte(*clientTrace) {}
39 func traceWroteHeaders(*clientTrace) {}
40 func traceWroteRequest(*clientTrace, error) {}
41 func traceGot100Continue(trace *clientTrace) {}
42 func traceWait100Continue(trace *clientTrace) {}
46 func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
50 func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
54 func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
58 // temporary copy of Go 1.6's private tls.Config.clone:
59 func cloneTLSConfig(c *tls.Config) *tls.Config {
63 Certificates: c.Certificates,
64 NameToCertificate: c.NameToCertificate,
65 GetCertificate: c.GetCertificate,
67 NextProtos: c.NextProtos,
68 ServerName: c.ServerName,
69 ClientAuth: c.ClientAuth,
70 ClientCAs: c.ClientCAs,
71 InsecureSkipVerify: c.InsecureSkipVerify,
72 CipherSuites: c.CipherSuites,
73 PreferServerCipherSuites: c.PreferServerCipherSuites,
74 SessionTicketsDisabled: c.SessionTicketsDisabled,
75 SessionTicketKey: c.SessionTicketKey,
76 ClientSessionCache: c.ClientSessionCache,
77 MinVersion: c.MinVersion,
78 MaxVersion: c.MaxVersion,
79 CurvePreferences: c.CurvePreferences,
83 func (cc *ClientConn) Ping(ctx contextContext) error {
87 func (t *Transport) idleConnTimeout() time.Duration { return 0 }