Source File
header.go
Belonging Package
net/http
package http
import (
)
func ( Header) (, string) {
textproto.MIMEHeader().Add(, )
}
func ( Header) (, string) {
textproto.MIMEHeader().Set(, )
}
func ( Header) ( string) {
textproto.MIMEHeader().Del()
}
func ( string) ( time.Time, error) {
for , := range timeFormats {
, = time.Parse(, )
if == nil {
return
}
}
return
}
var headerNewlineToSpace = strings.NewReplacer("\n", " ", "\r", " ")
type headerSorter struct {
kvs []keyValues
}
func ( *headerSorter) () int { return len(.kvs) }
func ( *headerSorter) (, int) { .kvs[], .kvs[] = .kvs[], .kvs[] }
func ( *headerSorter) (, int) bool { return .kvs[].key < .kvs[].key }
var headerSorterPool = sync.Pool{
New: func() interface{} { return new(headerSorter) },
}
func ( Header) ( io.Writer, map[string]bool) error {
return .writeSubset(, , nil)
}
func ( Header) ( io.Writer, map[string]bool, *httptrace.ClientTrace) error {
, := .(io.StringWriter)
if ! {
= stringWriter{}
}
, := .sortedKeyValues()
var []string
for , := range {
for , := range .values {
= headerNewlineToSpace.Replace()
= textproto.TrimString()
for , := range []string{.key, ": ", , "\r\n"} {
if , := .WriteString(); != nil {
headerSorterPool.Put()
return
}
}
if != nil && .WroteHeaderField != nil {
= append(, )
}
}
if != nil && .WroteHeaderField != nil {
.WroteHeaderField(.key, )
= nil
}
}
headerSorterPool.Put()
return nil
}
func ( string) string { return textproto.CanonicalMIMEHeaderKey() }
if := []; != [0] && |0x20 != [0] {
continue
if > 0 && !isTokenBoundary([-1]) {
continue
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |