From 904ce6004f09f1b8db376b20caff6246e8561e8b Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Mon, 22 Feb 2016 16:38:16 -0500 Subject: [PATCH] notifier: add a timeout on the http client --- notifier/notifiers/webhook.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notifier/notifiers/webhook.go b/notifier/notifiers/webhook.go index 12acd92e..21f48277 100644 --- a/notifier/notifiers/webhook.go +++ b/notifier/notifiers/webhook.go @@ -25,6 +25,7 @@ import ( "io/ioutil" "net/http" "net/url" + "time" "gopkg.in/yaml.v2" @@ -33,6 +34,8 @@ import ( "github.com/coreos/clair/notifier" ) +const timeout = 5 * time.Second + // A WebhookNotifier dispatches notifications to a webhook endpoint. type WebhookNotifier struct { endpoint string @@ -89,6 +92,7 @@ func (h *WebhookNotifier) Configure(config *config.NotifierConfig) (bool, error) Transport: &http.Transport{ TLSClientConfig: tlsConfig, }, + Timeout: timeout, } return true, nil }