http: abort probing when request could not be created
authorMichael Stapelberg <stapelberg@google.com>
Tue, 24 Nov 2015 17:10:48 +0000 (18:10 +0100)
committerMichael Stapelberg <stapelberg@google.com>
Tue, 24 Nov 2015 17:14:28 +0000 (18:14 +0100)
As per https://play.golang.org/p/4keb0zznDB, passing a nil http.Request
to Client.Do() results in a runtime error.

http.go

diff --git a/http.go b/http.go
index 0d1c279aa89322fd99c1b4aab5db0c3b806ee6c0..52ccfd4ef07dffbb0a27d59687989e8f3d1f9e7e 100644 (file)
--- a/http.go
+++ b/http.go
@@ -48,6 +48,7 @@ func probeHTTP(target string, w http.ResponseWriter, module Module) (success boo
        request, err := http.NewRequest(config.Method, target, nil)
        if err != nil {
                log.Errorf("Error creating request for target %s: %s", target, err)
+               return
        }
 
        resp, err := client.Do(request)