http/cookiejar
少于1分钟
cookiejar
https://pkg.go.dev/net/http/cookiejar@go1.20.1
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
常量
This section is empty.
变量
This section is empty.
函数
This section is empty.
类型
type Jar
|
|
Jar implements the http.CookieJar interface from the net/http package.
func New
|
|
New returns a new cookie jar. A nil *Options is equivalent to a zero Options.
Example
|
|
(*Jar) Cookies
|
|
Cookies implements the Cookies method of the http.CookieJar interface.
It returns an empty slice if the URL’s scheme is not HTTP or HTTPS.
(*Jar) SetCookies
|
|
SetCookies implements the SetCookies method of the http.CookieJar interface.
It does nothing if the URL’s scheme is not HTTP or HTTPS.
type Options
|
|
Options are the options for creating a new Jar.
type PublicSuffixList
|
|
PublicSuffixList provides the public suffix of a domain. For example:
- the public suffix of “example.com” is “com”,
- the public suffix of “foo1.foo2.foo3.co.uk” is “co.uk”, and
- the public suffix of “bar.pvt.k12.ma.us” is “pvt.k12.ma.us”.
Implementations of PublicSuffixList must be safe for concurrent use by multiple goroutines.
An implementation that always returns "" is valid and may be useful for testing but it is not secure: it means that the HTTP server for foo.com can set a cookie for bar.com.
A public suffix list implementation is in the package golang.org/x/net/publicsuffix.