28 lines
900 B
Go
Raw Normal View History

2012-03-28 01:13:14 +02:00
// Copyright 2011 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 http
import (
"net/url"
)
2014-09-21 19:33:12 +02:00
// A CookieJar manages storage and use of cookies in HTTP requests.
2012-03-28 01:13:14 +02:00
//
// Implementations of CookieJar must be safe for concurrent use by multiple
// goroutines.
2014-09-21 19:33:12 +02:00
//
// The net/http/cookiejar package provides a CookieJar implementation.
2012-03-28 01:13:14 +02:00
type CookieJar interface {
2014-09-21 19:33:12 +02:00
// SetCookies handles the receipt of the cookies in a reply for the
// given URL. It may or may not choose to save the cookies, depending
// on the jar's policy and implementation.
2012-03-28 01:13:14 +02:00
SetCookies(u *url.URL, cookies []*Cookie)
// Cookies returns the cookies to send in a request for the given URL.
2014-09-21 19:33:12 +02:00
// It is up to the implementation to honor the standard cookie use
// restrictions such as in RFC 6265.
2012-03-28 01:13:14 +02:00
Cookies(u *url.URL) []*Cookie
}