From 5c6496b80d0ee5d8f7983fe9dd6a00edcb6de9c8 Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Sat, 5 Nov 2016 12:12:27 +0000 Subject: [PATCH] Add scheme before attempting URL parsing. (#75) The url parsing is treating URLs without schemes as paths rather than hosts. --- http.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http.go b/http.go index 61550f5..5bf9473 100644 --- a/http.go +++ b/http.go @@ -74,6 +74,9 @@ func probeHTTP(target string, w http.ResponseWriter, module Module) (success boo } else { fallbackProtocol = "ip6" } + if !strings.HasPrefix(target, "http://") && !strings.HasPrefix(target, "https://") { + target = "http://" + target + } dialProtocol = module.HTTP.Protocol if module.HTTP.Protocol == "tcp" { @@ -132,9 +135,6 @@ func probeHTTP(target string, w http.ResponseWriter, module Module) (success boo return nil } - if !strings.HasPrefix(target, "http://") && !strings.HasPrefix(target, "https://") { - target = "http://" + target - } if config.Method == "" { config.Method = "GET" } -- 2.25.1