cookiejar

package
v0.0.0-...-5e4b918 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCookies

func ReadCookies(s string) ([]*http.Cookie, bool)

ReadCookies reads cookies from multiline string

Types

type Jar

type Jar struct {
	// contains filtered or unexported fields
}

Jar implements the http.CookieJar interface from the net/http package.

func New

func New(o *Options) (*Jar, error)

New returns a new cookie jar. A nil *Options is equivalent to a zero Options.

func (*Jar) Cookies

func (j *Jar) Cookies(u *url.URL) (cookies []*http.Cookie)

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.

func (*Jar) DumpCookies

func (j *Jar) DumpCookies() (cookies []*http.Cookie)

DumpCookies dumps all cookies

func (*Jar) SetCookies

func (j *Jar) SetCookies(u *url.URL, cookies []*http.Cookie)

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

type Options struct {
	// PublicSuffixList is the public suffix list that determines whether
	// an HTTP server can set a cookie for a domain.
	//
	// A nil value is valid and may be useful for testing but it is not
	// secure: it means that the HTTP server for foo.co.uk can set a cookie
	// for bar.co.uk.
	PublicSuffixList cookiejar.PublicSuffixList
}

Options are the options for creating a new Jar.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL