summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert S. Gerus <ar@bash.org.pl>2015-12-23 12:51:27 +0100
committerRobert S. Gerus <ar@bash.org.pl>2015-12-23 12:51:27 +0100
commit81886be013f7d1cb1518c34e1eacedbe2afb63b1 (patch)
treef8bcb791cc532684db8402595f92c0bc75e92cc4
parent055cb0328a826cc572f7356102d848b166bd31be (diff)
downloadgorepost-81886be013f7d1cb1518c34e1eacedbe2afb63b1.tar.gz
gorepost-81886be013f7d1cb1518c34e1eacedbe2afb63b1.tar.bz2
gorepost-81886be013f7d1cb1518c34e1eacedbe2afb63b1.zip
Use net/http/cookiejar as http cookie jar.
Fixes #52
-rw-r--r--bot/helpers.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/helpers.go b/bot/helpers.go
index cab3b9c..274a338 100644
--- a/bot/helpers.go
+++ b/bot/helpers.go
@@ -9,6 +9,7 @@ import (
"errors"
"io"
"net/http"
+ "net/http/cookiejar"
"os"
"time"
@@ -22,11 +23,15 @@ var errElementNotFound = errors.New("element not found in document")
func httpGet(link string) ([]byte, error) {
var buf []byte
+ cj, err := cookiejar.New(nil)
tr := &http.Transport{
TLSHandshakeTimeout: 20 * time.Second,
ResponseHeaderTimeout: 20 * time.Second,
}
- client := &http.Client{Transport: tr}
+ client := &http.Client{
+ Transport: tr,
+ Jar: cj,
+ }
req, err := http.NewRequest("GET", link, nil)
if err != nil {