aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/mail.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2022-01-08 20:08:36 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2022-01-08 20:08:36 +0100
commit5c5ea3caa6770c89c9c3b8e8be6916e74e29f27e (patch)
tree130f59f0b659f9e23d6cd79a5dbc54e7910ae0b7 /internal/feed/mail.go
parent180aa45d40e5d58d579fcaba44b94bcb8e3e08be (diff)
downloadfeed2imap-go-5c5ea3caa6770c89c9c3b8e8be6916e74e29f27e.tar.gz
feed2imap-go-5c5ea3caa6770c89c9c3b8e8be6916e74e29f27e.tar.bz2
feed2imap-go-5c5ea3caa6770c89c9c3b8e8be6916e74e29f27e.zip
Introduce http.Context to bundle http specific parameters
Diffstat (limited to 'internal/feed/mail.go')
-rw-r--r--internal/feed/mail.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/feed/mail.go b/internal/feed/mail.go
index 6914b76..444f76a 100644
--- a/internal/feed/mail.go
+++ b/internal/feed/mail.go
@@ -226,8 +226,8 @@ func (feed *Feed) Messages() (msg.Messages, error) {
return mails, nil
}
-func getImage(src string, timeout int, disableTLS bool) ([]byte, string, error) {
- resp, cancel, err := http.Get(src, timeout, disableTLS)
+func getImage(src string, ctx http.Context) ([]byte, string, error) {
+ resp, cancel, err := http.Get(src, ctx)
if err != nil {
return nil, "", fmt.Errorf("fetching from '%s': %w", src, err)
}
@@ -294,7 +294,7 @@ func (item *Item) downloadImage(src string) string {
imgUrl := item.resolveUrl(src)
- img, mime, err := getImage(imgUrl, feed.Global.Timeout, feed.NoTLS)
+ img, mime, err := getImage(imgUrl, feed.Context())
if err != nil {
log.Errorf("Feed %s: Item %s: Error fetching image: %s",
feed.Name, item.Link, err)