From 5d462ef47217c98b487bd6c1eaffb0630525ba92 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Mon, 27 Apr 2020 16:48:55 +0200 Subject: Stylistic improvements --- internal/feed/parse.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/internal/feed/parse.go b/internal/feed/parse.go index cc55581..539cad0 100644 --- a/internal/feed/parse.go +++ b/internal/feed/parse.go @@ -13,10 +13,16 @@ import ( ) // share HTTP clients -var stdHTTPClient = &http.Client{Transport: http.DefaultTransport} -var unsafeHTTPClient *http.Client +var ( + stdHTTPClient *http.Client + unsafeHTTPClient *http.Client +) func init() { + // std + stdHTTPClient = &http.Client{Transport: http.DefaultTransport} + + // unsafe tlsConfig := &tls.Config{InsecureSkipVerify: true} transport := http.DefaultTransport.(*http.Transport).Clone() transport.TLSClientConfig = tlsConfig @@ -27,12 +33,11 @@ func context(timeout int) (ctxt.Context, ctxt.CancelFunc) { return ctxt.WithTimeout(ctxt.Background(), time.Duration(timeout)*time.Second) } -func setHTTPClient(parser *gofeed.Parser, disableTLS bool) { +func httpClient(disableTLS bool) *http.Client { if disableTLS { - parser.Client = unsafeHTTPClient - } else { - parser.Client = stdHTTPClient + return unsafeHTTPClient } + return stdHTTPClient } func parseFeed(feed *Feed) error { @@ -40,7 +45,7 @@ func parseFeed(feed *Feed) error { defer cancel() fp := gofeed.NewParser() - setHTTPClient(fp, *feed.NoTLS) + fp.Client = httpClient(*feed.NoTLS) parsedFeed, err := fp.ParseURLWithContext(feed.Url, ctx) if err != nil { -- cgit v1.2.3-70-g09d2 mit/portato/waiting_queue.py?h=v0.14&id=edb012736afad95e069674fbe8ce9db192d39c25&follow=1'>commitdiff
path: root/portato/waiting_queue.py (unfollow)
Commit message (Expand)AuthorFilesLines
2009-08-15Enhanced the extensions.shRené 'Necoro' Neumann1-3/+8
2009-08-15Move eix-format to correct locationRené 'Necoro' Neumann1-0/+0