Quellcode durchsuchen

fix #303

Signed-off-by: allan716 <[email protected]>
allan716 vor 3 Jahren
Ursprung
Commit
efab4ff859
1 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen
  1. 7 3
      pkg/url_connectedness_helper/url_connectedness_helper.go

+ 7 - 3
pkg/url_connectedness_helper/url_connectedness_helper.go

@@ -6,6 +6,7 @@ import (
 	"net/http"
 	"net/url"
 	"regexp"
+	"strings"
 	"time"
 )
 
@@ -22,14 +23,17 @@ func UrlConnectednessTest(testUrl, proxyAddr string) (bool, int64, error) {
 	} else {
 		// 需要代理
 		// 检测代理iP访问地址
-		if proxyAddressValidHttpFormat(proxyAddr) == false {
-			return false, 0, errors.New("proxy address illegal, only support http://xx:xx")
-		}
+		//if proxyAddressValidHttpFormat(proxyAddr) == false {
+		//	return false, 0, errors.New("proxy address illegal, only support http://xx:xx")
+		//}
 		// 解析代理地址
 		proxy, err := url.Parse(proxyAddr)
 		if err != nil {
 			return false, 0, err
 		}
+		if strings.ToLower(proxy.Scheme) != "http" {
+			return false, 0, errors.New("proxy address illegal, only support http://xx:xx")
+		}
 		// 设置网络传输
 		netTransport := &http.Transport{
 			Proxy:                 http.ProxyURL(proxy),