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.
17 type contextContext interface {
18 Done() <-chan struct{}
22 var errCanceled = errors.New("canceled")
24 type fakeContext struct{}
26 func (fakeContext) Done() <-chan struct{} { return nil }
27 func (fakeContext) Err() error { panic("should not be called") }
29 func reqContext(r *http.Request) fakeContext {
33 func setResponseUncompressed(res *http.Response) {
37 type clientTrace struct{}
39 func requestTrace(*http.Request) *clientTrace { return nil }
40 func traceGetConn(*http.Request, string) {}
41 func traceGotConn(*http.Request, *ClientConn) {}
42 func traceFirstResponseByte(*clientTrace) {}
43 func traceWroteHeaders(*clientTrace) {}
44 func traceWroteRequest(*clientTrace, error) {}
45 func traceGot100Continue(trace *clientTrace) {}
46 func traceWait100Continue(trace *clientTrace) {}
50 func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
54 func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
58 func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
62 // temporary copy of Go 1.6's private tls.Config.clone:
63 func cloneTLSConfig(c *tls.Config) *tls.Config {
67 Certificates: c.Certificates,
68 NameToCertificate: c.NameToCertificate,
69 GetCertificate: c.GetCertificate,
71 NextProtos: c.NextProtos,
72 ServerName: c.ServerName,
73 ClientAuth: c.ClientAuth,
74 ClientCAs: c.ClientCAs,
75 InsecureSkipVerify: c.InsecureSkipVerify,
76 CipherSuites: c.CipherSuites,
77 PreferServerCipherSuites: c.PreferServerCipherSuites,
78 SessionTicketsDisabled: c.SessionTicketsDisabled,
79 SessionTicketKey: c.SessionTicketKey,
80 ClientSessionCache: c.ClientSessionCache,
81 MinVersion: c.MinVersion,
82 MaxVersion: c.MaxVersion,
83 CurvePreferences: c.CurvePreferences,
87 func (cc *ClientConn) Ping(ctx contextContext) error {
91 func (cc *ClientConn) Shutdown(ctx contextContext) error {
92 return cc.shutdown(ctx)
95 func (t *Transport) idleConnTimeout() time.Duration { return 0 }