not_go17.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 nop() {}
  27. func serverConnBaseContext(c net.Conn, opts *ServeConnOpts) (ctx contextContext, cancel func()) {
  28. return nil, nop
  29. }
  30. func contextWithCancel(ctx contextContext) (_ contextContext, cancel func()) {
  31. return ctx, nop
  32. }
  33. func requestWithContext(req *http.Request, ctx contextContext) *http.Request {
  34. return req
  35. }