biscuit

package module
v0.0.0-...-c44fbed Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2017 License: GPL-3.0 Imports: 8 Imported by: 2

Documentation

Overview

Package biscuit contains functions for reading http cookies from files.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadCookies

func ReadCookies(r io.Reader) ([]*http.Cookie, error)

ReadCookies reads a set of cookies from a Netscape-format cookies.txt file format spec, such as it is: http://www.cookiecentral.com/faq/#3.5

Example
example := `# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

.theguardian.com	TRUE	/	FALSE	1504398562	GU_mvt_id	975374
www.theguardian.com	FALSE	/	FALSE	0	GU_geo_continent	OC
#HttpOnly_.stackoverflow.com	TRUE	/	FALSE	2682374400	prov	7341b18d-42b0-5071-d792-f57c4c74188f
`

cookies, err := ReadCookies(strings.NewReader(example))
if err != nil {
	panic(err)
}
for _, c := range cookies {
	fmt.Println(c)
}
Output:

GU_mvt_id=975374; Path=/; Domain=theguardian.com; Expires=Sun, 03 Sep 2017 00:29:22 GMT
GU_geo_continent=OC; Path=/; Domain=www.theguardian.com
prov=7341b18d-42b0-5071-d792-f57c4c74188f; Path=/; Domain=stackoverflow.com; Expires=Fri, 01 Jan 2055 00:00:00 GMT; HttpOnly

Types

This section is empty.

Jump to

Keyboard shortcuts

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