Source File
clone.go
Belonging Package
net/http
// Copyright 2019 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package httpimport (_ // for linkname)// cloneURLValues should be an internal detail,// but widely used packages access it using linkname.// Notable members of the hall of shame include:// - github.com/searKing/golang//// Do not remove or change the type signature.// See go.dev/issue/67401.////go:linkname cloneURLValuesfunc ( url.Values) url.Values {if == nil {return nil}// http.Header and url.Values have the same representation, so temporarily// treat it like http.Header, which does have a clone:return url.Values(Header().Clone())}// cloneURL should be an internal detail,// but widely used packages access it using linkname.// Notable members of the hall of shame include:// - github.com/searKing/golang//// Do not remove or change the type signature.// See go.dev/issue/67401.////go:linkname cloneURLfunc ( *url.URL) *url.URL {if == nil {return nil}:= new(url.URL)* = *if .User != nil {.User = new(url.Userinfo)*.User = *.User}return}// cloneMultipartForm should be an internal detail,// but widely used packages access it using linkname.// Notable members of the hall of shame include:// - github.com/searKing/golang//// Do not remove or change the type signature.// See go.dev/issue/67401.////go:linkname cloneMultipartFormfunc ( *multipart.Form) *multipart.Form {if == nil {return nil}:= &multipart.Form{Value: (map[string][]string)(Header(.Value).Clone()),}if .File != nil {:= make(map[string][]*multipart.FileHeader)for , := range .File {:= make([]*multipart.FileHeader, len())for , := range {[] = cloneMultipartFileHeader()}[] =}.File =}return}// cloneMultipartFileHeader should be an internal detail,// but widely used packages access it using linkname.// Notable members of the hall of shame include:// - github.com/searKing/golang//// Do not remove or change the type signature.// See go.dev/issue/67401.////go:linkname cloneMultipartFileHeaderfunc ( *multipart.FileHeader) *multipart.FileHeader {if == nil {return nil}:= new(multipart.FileHeader)* = *.Header = textproto.MIMEHeader(Header(.Header).Clone())return}// cloneOrMakeHeader invokes Header.Clone but if the// result is nil, it'll instead make and return a non-nil Header.//// cloneOrMakeHeader should be an internal detail,// but widely used packages access it using linkname.// Notable members of the hall of shame include:// - github.com/searKing/golang//// Do not remove or change the type signature.// See go.dev/issue/67401.////go:linkname cloneOrMakeHeaderfunc ( Header) Header {:= .Clone()if == nil {= make(Header)}return}
![]() |
The pages are generated with Golds v0.7.6. (GOOS=linux 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 @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |