github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/net/http2/go111.go (about)

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