From 1f914618538920db4bfec7b106ee97038b157c9b Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 22 Jun 2017 01:00:27 +0200 Subject: Add vendor (steam) --- .../Philipp15b/go-steam/community/community.go | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 vendor/github.com/Philipp15b/go-steam/community/community.go (limited to 'vendor/github.com/Philipp15b/go-steam/community') diff --git a/vendor/github.com/Philipp15b/go-steam/community/community.go b/vendor/github.com/Philipp15b/go-steam/community/community.go new file mode 100644 index 00000000..641c3942 --- /dev/null +++ b/vendor/github.com/Philipp15b/go-steam/community/community.go @@ -0,0 +1,35 @@ +package community + +import ( + "net/http" + "net/http/cookiejar" + "net/url" +) + +const cookiePath = "https://steamcommunity.com/" + +func SetCookies(client *http.Client, sessionId, steamLogin, steamLoginSecure string) { + if client.Jar == nil { + client.Jar, _ = cookiejar.New(new(cookiejar.Options)) + } + base, err := url.Parse(cookiePath) + if err != nil { + panic(err) + } + client.Jar.SetCookies(base, []*http.Cookie{ + // It seems that, for some reason, Steam tries to URL-decode the cookie. + &http.Cookie{ + Name: "sessionid", + Value: url.QueryEscape(sessionId), + }, + // steamLogin is already URL-encoded. + &http.Cookie{ + Name: "steamLogin", + Value: steamLogin, + }, + &http.Cookie{ + Name: "steamLoginSecure", + Value: steamLoginSecure, + }, + }) +} -- cgit v1.2.3