Example #1
0
// CreateSessionIDer provides a default implement for extracting the session from a cookie jar
func CreateSessionIDer(jar http.CookieJar) RequestIDer {
	return func(req *http.Request) string {
		for _, c := range jar.Cookies(req.URL) {
			if c.Name == RETSSessionID {
				return c.Value
			}
		}
		return ""
	}
}
Example #2
0
func getSessionId(jar http.CookieJar) string {
	key := "phpbb2mysql_sid"
	url, _ := url.Parse("egal")
	for _, cookie := range jar.Cookies(url) {
		if cookie.Name == key {
			return cookie.Value
		}
	}
	panic("no sessionid found")
}
Example #3
0
File: client.go Project: cmars/oo
// MacaroonsForURL returns any macaroons associated with the
// given URL in the given cookie jar.
func MacaroonsForURL(jar http.CookieJar, u *url.URL) []macaroon.Slice {
	return cookiesToMacaroons(jar.Cookies(u))
}