// RemoveCookieFasthttp deletes a cookie by it's name/key.
358204
func RemoveCookieFasthttp(ctx *fasthttp.RequestCtx, config Config) {
	ctx.Response.Header.DelCookie(config.Cookie)

	cookie := fasthttp.AcquireCookie()
	//cookie := &fasthttp.Cookie{}
	cookie.SetKey(config.Cookie)
	cookie.SetValue("")
	cookie.SetPath("/")
	cookie.SetDomain(formatCookieDomain(string(ctx.Host()), config.DisableSubdomainPersistence))
	cookie.SetHTTPOnly(true)
	exp := time.Now().Add(-time.Duration(1) * time.Minute) //RFC says 1 second, but let's do it 1 minute to make sure is working...
	cookie.SetExpire(exp)
	AddCookieFasthttp(ctx, cookie)
	fasthttp.ReleaseCookie(cookie)
	// delete request's cookie also, which is temporary available
	ctx.Request.Header.DelCookie(config.Cookie)
}
199703
func DeleteUserCookie(w http.ResponseWriter, r *http.Request) {
	DeleteUserCookieName(w, r, Config.CookieName)
}
1228970
func (h *HTTPBin) DeleteCookies(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,
			MaxAge:   -1,
			Expires:  time.Now().Add(-1 * 24 * 365 * time.Hour),
		})
	}
	w.Header().Set("Location", "/cookies")
	w.WriteHeader(http.StatusFound)
}
566477
func (b *BigIP) DeleteHttpProfile(name string) error {
	return b.delete(uriLtm, uriProfile, uriHttp, name)
}
451081
func DeleteCookies(w http.ResponseWriter, cookieNames ...string) {
	for _, n := range cookieNames {
		c := &http.Cookie{
			Name:    n,
			Value:   "",
			Path:    "/",
			MaxAge:  -1,
			Expires: time.Time{},
		}
		http.SetCookie(w, c)
	}
}
1242779
func (s *ScraperTargetStoreService) RemoveTarget(ctx context.Context, id influxdb.ID) error {
	st, err := s.s.GetTargetByID(ctx, id)
	if err != nil {
		return err
	}

	if err := authorizeWriteScraper(ctx, st.OrgID, id); err != nil {
		return err
	}

	return s.s.RemoveTarget(ctx, id)
}
27918
func SetSecureCookiePath(w http.ResponseWriter, name, val string, age int64, path string, cookieSecret string) {
	SetSecureCookiePathWithFlags(w, name, val, age, path, cookieSecret, false, false)
}
473122
func GetUserCookie(r *http.Request) (User, error) {
	return GetUserCookieName(r, Config.CookieName)
}
1229088
func SetCookiePath(w http.ResponseWriter, name, value string, age int64, path string) {
	SetCookiePathWithFlags(w, name, value, age, path, false, false)
}
1268526
func RemoveCookie(w http.ResponseWriter, r *http.Request, config Config) {
	c, err := r.Cookie(config.Cookie)
	if err != nil {
		return
	}

	c.Expires = CookieExpireDelete
	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
	c.MaxAge = -1
	c.Value = ""
	c.Path = "/"
	c.Domain = formatCookieDomain(r.URL.Host, config.DisableSubdomainPersistence)
	AddCookie(w, r, c, config.AllowReclaim)

	if config.AllowReclaim {
		// delete request's cookie also, which is temporary available.
		r.Header.Set("Cookie", "")
	}
}
884975
func (req *Request) Cookie(key string) (ServerCookie, error) {
	if req.Header.Server != nil {
		return req.Header.Server.GetCookie(key)
	}
	return nil, http.ErrNoCookie
}
369326
func (ca *CookieAuth) AddAuthHeaders(req *http.Request) {
	authString := "AuthSession=" + ca.AuthToken
	req.Header.Set("Cookie", authString)
	req.Header.Set("X-CouchDB-WWW-Authenticate", "Cookie")
}
78364
func (c ClientCookies) DeleteState(w http.ResponseWriter, r *http.Request, id string) error {
	cookie, err := r.Cookie(stateCookiePrefix + id)
	if err != nil {
		return err
	}
	cookie.Value = ""
	cookie.Expires = time.Unix(1, 0) // past time as close to epoch as possible, but not zero time.Time{}
	http.SetCookie(w, cookie)
	return nil
}
947775
func removeCookie(rw http.ResponseWriter, r *http.Request, cookie string) {
	if prev, err := r.Cookie(cookie); err == nil {
		cpy := *prev
		cpy.Value = "deleted"
		cpy.Path = "/"
		cpy.MaxAge = -1
		cpy.Expires = time.Unix(1, 0)
		http.SetCookie(rw, &cpy)
	}
}
1009620
func (this *Request) Cookie(n string, i ...interface{}) string {

	cookie, err := this.Request.Cookie(n)

	if err != nil {
		return ""
	}

	/*
	   Unescape the cookie.
	*/
	var v string
	var e error
	v, e = url.QueryUnescape(cookie.Value)
	v, e = Decode(v)

	if e != nil {
		return ""
	}

	/*
	   If no interface was given then just return the Value.
	*/

	if len(i) == 0 {
		return v
	}

	json.Unmarshal([]byte(v), i[0])

	return v
}
917580
func SetCookiesHandler(w http.ResponseWriter, r *http.Request) {
	for k := range r.URL.Query() {
		v := r.URL.Query().Get(k)
		http.SetCookie(w, &http.Cookie{
			Name:  k,
			Value: v,
			Path:  "/",
		})
	}
	w.Header().Set("Location", "/cookies")
	w.WriteHeader(http.StatusFound)
}
1307033
func (s *LocalStore) RemoveHTTPChallengeToken(token, domain string) error {
	s.lock.Lock()
	defer s.lock.Unlock()

	if s.storedData.HTTPChallenges == nil {
		return nil
	}

	if _, ok := s.storedData.HTTPChallenges[token]; ok {
		delete(s.storedData.HTTPChallenges[token], domain)
		if len(s.storedData.HTTPChallenges[token]) == 0 {
			delete(s.storedData.HTTPChallenges, token)
		}
	}
	return nil
}