Insecure read method added.
This commit is contained in:
parent
e92cde6958
commit
b904822ba7
1 changed files with 11 additions and 0 deletions
11
rss.go
11
rss.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
"crypto/tls"
|
||||||
|
|
||||||
"github.com/paulrosania/go-charset/charset"
|
"github.com/paulrosania/go-charset/charset"
|
||||||
_ "github.com/paulrosania/go-charset/data" //initialize only
|
_ "github.com/paulrosania/go-charset/data" //initialize only
|
||||||
|
@ -89,6 +90,16 @@ func Read(url string) (*Channel, error) {
|
||||||
return ReadWithClient(url, http.DefaultClient)
|
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
|
//ReadWithClient a string url and custom client that must match the Fetcher interface
|
||||||
//returns a Channel struct, error
|
//returns a Channel struct, error
|
||||||
func ReadWithClient(url string, client Fetcher) (*Channel, error) {
|
func ReadWithClient(url string, client Fetcher) (*Channel, error) {
|
||||||
|
|
Loading…
Reference in a new issue