Add insecure HTTPS requests to IP addresses
This commit is contained in:
+5
-1
@@ -32,7 +32,7 @@ func Do(req *http.Request) (*http.Response, error) {
|
||||
|
||||
var client *http.Client
|
||||
|
||||
if req.URL.Scheme == "httpx" {
|
||||
if req.URL.Scheme == "httpx" || (req.URL.Scheme == "https" && IsIP(req.URL.Hostname())) {
|
||||
req.URL.Scheme = "https"
|
||||
|
||||
if insecureClient == nil {
|
||||
@@ -125,3 +125,7 @@ func Close(res *http.Response) {
|
||||
_ = res.Body.Close()
|
||||
}
|
||||
}
|
||||
|
||||
func IsIP(hostname string) bool {
|
||||
return net.ParseIP(hostname) != nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user