// updateCookie gains the ability of updating the session browser cookie to any method which wants to update it
191604
func (s *Sessions) updateCookie(ctx context.Context, sid string, expires time.Duration) {
	cookie := &http.Cookie{}

	// The RFC makes no mention of encoding url value, so here I think to encode both sessionid key and the value using the safe(to put and to use as cookie) url-encoding
	cookie.Name = s.config.Cookie

	cookie.Value = sid
	cookie.Path = "/"
	cookie.Domain = formatCookieDomain(ctx, s.config.DisableSubdomainPersistence)
	cookie.HttpOnly = true
	// MaxAge=0 means no 'Max-Age' attribute specified.
	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
	// MaxAge>0 means Max-Age attribute present and given in seconds
	if expires >= 0 {
		if expires == 0 { // unlimited life
			cookie.Expires = CookieExpireUnlimited
		} else { // > 0
			cookie.Expires = time.Now().Add(expires)
		}
		cookie.MaxAge = int(cookie.Expires.Sub(time.Now()).Seconds())
	}

	// set the cookie to secure if this is a tls wrapped request
	// and the configuration allows it.
	if ctx.Request().TLS != nil && s.config.CookieSecureTLS {
		cookie.Secure = true
	}

	// encode the session id cookie client value right before send it.
	cookie.Value = s.encodeCookieValue(cookie.Value)
	AddCookie(ctx, cookie, s.config.AllowReclaim)
}
1126583
func (b *HttpRequest) SetCookie(cookie *http.Cookie) *HttpRequest {
	b.req.Header.Add("Cookie", cookie.String())
	return b
}
1284417
func (self *simplePBundle) UpdateSession(i interface{}) (Session, error) {
	return self.mgr.Update(self.s, i)
}
745874
func (c *SessionTrackingConfiguration) Update(config *SessionTrackingConfiguration) {
	c.mutex.Lock()
	defer c.mutex.Unlock()
	if config.PublishInterval != 0 {
		c.PublishInterval = config.PublishInterval
	}
	if config.APIKey != "" {
		c.APIKey = config.APIKey
	}
	if config.Endpoint != "" {
		c.Endpoint = config.Endpoint
	}
	if config.Version != "" {
		c.Version = config.Version
	}
	if config.ReleaseStage != "" {
		c.ReleaseStage = config.ReleaseStage
	}
	if config.Hostname != "" {
		c.Hostname = config.Hostname
	}
	if config.AppType != "" {
		c.AppType = config.AppType
	}
	if config.AppVersion != "" {
		c.AppVersion = config.AppVersion
	}
	if config.Transport != nil {
		c.Transport = config.Transport
	}
	if config.Logger != nil {
		c.Logger = config.Logger
	}
	if config.NotifyReleaseStages != nil {
		c.NotifyReleaseStages = config.NotifyReleaseStages
	}
	if config.AutoCaptureSessions != nil {
		c.AutoCaptureSessions = config.AutoCaptureSessions
	}
}
59624
func SetCookie(w http.ResponseWriter, c config.Cookie, session Session) {
	c.Set(w, session.Key, session.Expires)
}
1275735
func (state *UserState) SetUsernameCookie(w http.ResponseWriter, username string) error {
	if username == "" {
		return ErrCookieEmptyUsername
	}
	if !state.HasUser(username) {
		return ErrCookieUserMissing
	}
	// Create a cookie that lasts for a while ("timeout" seconds),
	// this is the equivivalent of a session for a given username.
	cookie.SetSecureCookiePath(w, "user", username, state.cookieTime, "/", state.cookieSecret)
	return nil
}
1089172
func (l *lru) UpdateCache(mts []core.Metric, _ string) {
	l.updateCache(mts)
}
382388
func (c *FakeMutatingWebhookConfigurations) Update(mutatingWebhookConfiguration *v1beta1.MutatingWebhookConfiguration) (result *v1beta1.MutatingWebhookConfiguration, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(mutatingwebhookconfigurationsResource, mutatingWebhookConfiguration), &v1beta1.MutatingWebhookConfiguration{})
	if obj == nil {
		return nil, err
	}
	return obj.(*v1beta1.MutatingWebhookConfiguration), err
}
946675
func (c *Context) ResetCookies() error {
	jar, err := cookiejar.New(&cookiejar.Options{
		PublicSuffixList: publicsuffix.List,
	})
	if err != nil {
		return err
	}
	c.Client.Jar = jar
	return nil
}
771442
func (ca *CookieAuth) GetUpdatedAuth() map[string]string {
	am := make(map[string]string)
	if ca.UpdatedAuthToken != "" {
		am["AuthSession"] = ca.UpdatedAuthToken
	}
	return am
}
461777
func (gr *GoReq) AddCookies(cookies []*http.Cookie) *GoReq {
	gr.Cookies = append(gr.Cookies, cookies...)
	return gr
}
1277762
func (ctx *Context) Cookie(key string, defaults ...string) string {
	return ctx.Cookies().MustString(key, defaults...)
}
440514
func (t *Tab) DeleteCookie(cookieName, url string) error {
	_, err := t.Page.DeleteCookie(cookieName, url)
	return err
}
516040
func AddCookie(ctx context.Context, cookie *http.Cookie, reclaim bool) {
	if reclaim {
		ctx.Request().AddCookie(cookie)
	}
	ctx.SetCookie(cookie)
}
1187766
func (bsh *BufferedServerHeader) GetCookie(key string) (ServerCookie, error) {
	return bsh.original.GetCookie(key)
}
562800
func (h *HTTPBin) SetCookies(w http.ResponseWriter, r *http.Request) {
	params := r.URL.Query()
	for k := range params {
		http.SetCookie(w, &http.Cookie{
			Name:     k,
			Value:    params.Get(k),
			HttpOnly: true,
		})
	}
	w.Header().Set("Location", "/cookies")
	w.WriteHeader(http.StatusFound)
}
613861
func (p *WebPage) SetCookies(cookies []*http.Cookie) error {
	a := make([]cookieJSON, len(cookies))
	for i := range cookies {
		a[i] = encodeCookieJSON(cookies[i])
	}
	req := map[string]interface{}{"ref": p.ref.id, "cookies": a}
	return p.ref.process.doJSON("POST", "/webpage/SetCookies", req, nil)
}