2021-01-17 21:46:25 +08:00
|
|
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
2018-09-14 13:02:13 +08:00
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
|
|
// If a copy of the MIT was not distributed with this file,
|
2019-02-02 16:18:25 +08:00
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
2018-09-14 13:02:13 +08:00
|
|
|
|
|
|
|
package ghttp
|
|
|
|
|
|
|
|
import (
|
2019-09-11 21:19:45 +08:00
|
|
|
"time"
|
2018-09-14 13:02:13 +08:00
|
|
|
)
|
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// SetCookieMaxAge sets the CookieMaxAge for server.
|
2019-09-11 21:19:45 +08:00
|
|
|
func (s *Server) SetCookieMaxAge(ttl time.Duration) {
|
|
|
|
s.config.CookieMaxAge = ttl
|
2018-09-14 13:02:13 +08:00
|
|
|
}
|
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// SetCookiePath sets the CookiePath for server.
|
2019-06-19 09:06:52 +08:00
|
|
|
func (s *Server) SetCookiePath(path string) {
|
|
|
|
s.config.CookiePath = path
|
2018-09-14 13:02:13 +08:00
|
|
|
}
|
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// SetCookieDomain sets the CookieDomain for server.
|
2019-06-19 09:06:52 +08:00
|
|
|
func (s *Server) SetCookieDomain(domain string) {
|
|
|
|
s.config.CookieDomain = domain
|
2018-09-14 13:02:13 +08:00
|
|
|
}
|
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// GetCookieMaxAge returns the CookieMaxAge of server.
|
2019-09-11 21:19:45 +08:00
|
|
|
func (s *Server) GetCookieMaxAge() time.Duration {
|
2019-06-19 09:06:52 +08:00
|
|
|
return s.config.CookieMaxAge
|
2018-09-14 13:02:13 +08:00
|
|
|
}
|
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// GetCookiePath returns the CookiePath of server.
|
2019-06-19 09:06:52 +08:00
|
|
|
func (s *Server) GetCookiePath() string {
|
|
|
|
return s.config.CookiePath
|
2018-09-14 13:02:13 +08:00
|
|
|
}
|
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// GetCookieDomain returns CookieDomain of server.
|
2019-06-19 09:06:52 +08:00
|
|
|
func (s *Server) GetCookieDomain() string {
|
|
|
|
return s.config.CookieDomain
|
2018-09-14 13:02:13 +08:00
|
|
|
}
|