not_go17.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.
  4. // +build !go1.7
  5. package http2
  6. import (
  7. "net"
  8. "net/http"
  9. )
  10. type contextContext interface{}
  11. type fakeContext struct{}
  12. func (fakeContext) Done() <-chan struct{} { return nil }
  13. func (fakeContext) Err() error { panic("should not be called") }
  14. func reqContext(r *http.Request) fakeContext {
  15. return fakeContext{}
  16. }
  17. func setResponseUncompressed(res *http.Response) {
  18. // Nothing.
  19. }
  20. type clientTrace struct{}
  21. func requestTrace(*http.Request) *clientTrace { return nil }
  22. func traceGotConn(*http.Request, *ClientConn) {}
  23. func traceFirstResponseByte(*clientTrace) {}
  24. func traceWroteHeaders(*clientTrace) {}
  25. func traceWroteRequest(*clientTrace, error) {}
  26. func traceGot100Continue(trace *clientTrace) {}
  27. func traceWait100Continue(trace *clientTrace) {}
  28. func nop() {}
  29. func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
  30. return nil, nop
  31. }
  32. func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
  33. return ctx, nop
  34. }
  35. func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
  36. return req
  37. }