type Header … // Add adds the key, value pair to the header. // It appends to any existing values associated with key. // The key is case insensitive; it is canonicalized by // [CanonicalHeaderKey]. func (h Header) Add(key, value string) { … } // Set sets the header entries associated with key to the // single element value. It replaces any existing values // associated with key. The key is case insensitive; it is // canonicalized by [textproto.CanonicalMIMEHeaderKey]. // To use non-canonical keys, assign to the map directly. func (h Header) Set(key, value string) { … } // Get gets the first value associated with the given key. If // there are no values associated with the key, Get returns "". // It is case insensitive; [textproto.CanonicalMIMEHeaderKey] is // used to canonicalize the provided key. Get assumes that all // keys are stored in canonical form. To use non-canonical keys, // access the map directly. func (h Header) Get(key string) string { … } // Values returns all values associated with the given key. // It is case insensitive; [textproto.CanonicalMIMEHeaderKey] is // used to canonicalize the provided key. To use non-canonical // keys, access the map directly. // The returned slice is not a copy. func (h Header) Values(key string) []string { … } // get is like Get, but key must already be in CanonicalHeaderKey form. func (h Header) get(key string) string { … } // has reports whether h has the provided key defined, even if it's // set to 0-length slice. func (h Header) has(key string) bool { … } // Del deletes the values associated with key. // The key is case insensitive; it is canonicalized by // [CanonicalHeaderKey]. func (h Header) Del(key string) { … } // Write writes a header in wire format. func (h Header) Write(w io.Writer) error { … } func (h Header) write(w io.Writer, trace *httptrace.ClientTrace) error { … } // Clone returns a copy of h or nil if h is nil. func (h Header) Clone() Header { … } var timeFormats … // ParseTime parses a time header (such as the Date: header), // trying each of the three formats allowed by HTTP/1.1: // [TimeFormat], [time.RFC850], and [time.ANSIC]. func ParseTime(text string) (t time.Time, err error) { … } var headerNewlineToSpace … type stringWriter … func (w stringWriter) WriteString(s string) (n int, err error) { … } type keyValues … type headerSorter … var headerSorterPool … // sortedKeyValues returns h's keys sorted in the returned kvs // slice. The headerSorter used to sort is also returned, for possible // return to headerSorterCache. func (h Header) sortedKeyValues(exclude map[string]bool) (kvs []keyValues, hs *headerSorter) { … } // WriteSubset writes a header in wire format. // If exclude is not nil, keys where exclude[key] == true are not written. // Keys are not canonicalized before checking the exclude map. func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) error { … } func (h Header) writeSubset(w io.Writer, exclude map[string]bool, trace *httptrace.ClientTrace) error { … } // CanonicalHeaderKey returns the canonical format of the // header key s. The canonicalization converts the first // letter and any letter following a hyphen to upper case; // the rest are converted to lowercase. For example, the // canonical key for "accept-encoding" is "Accept-Encoding". // If s contains a space or invalid header field bytes, it is // returned without modifications. func CanonicalHeaderKey(s string) string { … } // hasToken reports whether token appears with v, ASCII // case-insensitive, with space or comma boundaries. // token must be all lowercase. // v may contain mixed cased. func hasToken(v, token string) bool { … } func isTokenBoundary(b byte) bool { … }