go111.go 722 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2018 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. //go:build go1.11
  5. // +build go1.11
  6. package http2
  7. import (
  8. "net/http/httptrace"
  9. "net/textproto"
  10. )
  11. func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
  12. return trace != nil && trace.WroteHeaderField != nil
  13. }
  14. func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
  15. if trace != nil && trace.WroteHeaderField != nil {
  16. trace.WroteHeaderField(k, []string{v})
  17. }
  18. }
  19. func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
  20. if trace != nil {
  21. return trace.Got1xxResponse
  22. }
  23. return nil
  24. }