From ee69afadd0da8518624407dac99bfbc5437043e9 Mon Sep 17 00:00:00 2001 From: Cory Bennett Date: Sat, 4 Aug 2018 14:20:03 -0700 Subject: [PATCH] [#201] update required library, failing to populate cookiejar from cookies file --- Gopkg.lock | 2 +- vendor/github.com/coryb/oreo/oreo.go | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 3c1a58f6..25a9fbe9 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -39,7 +39,7 @@ branch = "master" name = "github.com/coryb/oreo" packages = ["."] - revision = "efd7a2135270bc44f64af39446c7226057e6953d" + revision = "3e1b88fc08f134aa91ccfb5d58c983ca8ab42589" [[projects]] name = "github.com/davecgh/go-spew" diff --git a/vendor/github.com/coryb/oreo/oreo.go b/vendor/github.com/coryb/oreo/oreo.go index 48486325..6bc368ae 100644 --- a/vendor/github.com/coryb/oreo/oreo.go +++ b/vendor/github.com/coryb/oreo/oreo.go @@ -182,11 +182,14 @@ func (c *Client) initCookieJar() (err error) { return err } for _, cookie := range cookies { - url, err := url.Parse(cookie.Domain) - if err != nil { - return err + // this is dumb, cookie.Domain *must not* have a scheme or port url.Parse will parse strings like "localhost" + // into the Path variable, not Host. So lets just force Host. We also need to set arbitrary http/https Scheme + // as Jar.SetCookies will ignore cookies where the url does not have a http/https Scheme + u := &url.URL{ + Scheme: "http", + Host: cookie.Domain, } - c.Jar.SetCookies(url, []*http.Cookie{cookie}) + c.Jar.SetCookies(u, []*http.Cookie{cookie}) } return nil }