projects
/
blackbox_exporter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2a04b8e
)
ensure resp.Body is discarded to avoid broken tcp sockets (#348)
author
Thomas Maier
<contact@thomas-maier.net>
Tue, 14 Aug 2018 14:38:07 +0000
(16:38 +0200)
committer
Brian Brazil
<brian.brazil@robustperception.io>
Tue, 14 Aug 2018 14:38:07 +0000
(15:38 +0100)
Signed-off-by: Thomas Maier <contact@thomas-maier.net>
prober/http.go
patch
|
blob
|
blame
|
history
diff --git
a/prober/http.go
b/prober/http.go
index 5f2af6932d958f4896e52b6c6187c3ac818b2832..bbc454340a03589bca4ee35293326ca27e28ca9f 100644
(file)
--- a/
prober/http.go
+++ b/
prober/http.go
@@
-296,7
+296,10
@@
func ProbeHTTP(ctx context.Context, target string, module config.Module, registr
if err != nil && resp == nil {
level.Error(logger).Log("msg", "Error for HTTP request", "err", err)
} else {
- defer resp.Body.Close()
+ defer func() {
+ io.Copy(ioutil.Discard, resp.Body)
+ resp.Body.Close()
+ }()
level.Info(logger).Log("msg", "Received HTTP response", "status_code", resp.StatusCode)
if len(httpConfig.ValidStatusCodes) != 0 {
for _, code := range httpConfig.ValidStatusCodes {