From b904822ba7bf5bf72040edd659707e491e576693 Mon Sep 17 00:00:00 2001 From: Ruslan Zalalov Date: Mon, 30 Jul 2018 00:41:17 +0300 Subject: [PATCH] Insecure read method added. --- rss.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rss.go b/rss.go index ec045fc..f7ed661 100644 --- a/rss.go +++ b/rss.go @@ -5,6 +5,7 @@ import ( "encoding/xml" "net/http" "time" + "crypto/tls" "github.com/paulrosania/go-charset/charset" _ "github.com/paulrosania/go-charset/data" //initialize only @@ -89,6 +90,16 @@ func Read(url string) (*Channel, error) { return ReadWithClient(url, http.DefaultClient) } +//Read without certificate check +func InsecureRead(url string) (*Channel, error) { + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + client := &http.Client{Transport: tr} + + return ReadWithClient(url, client) +} + //ReadWithClient a string url and custom client that must match the Fetcher interface //returns a Channel struct, error func ReadWithClient(url string, client Fetcher) (*Channel, error) {