소스 검색

fix: use u.Hostname() instead of u.Host to avoid ipv6 host parse failed

creamlike1024 5 달 전
부모
커밋
00f4594062
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      common/ssrf_protection.go

+ 1 - 1
common/ssrf_protection.go

@@ -237,7 +237,7 @@ func (p *SSRFProtection) ValidateURL(urlStr string) error {
 	host, portStr, err := net.SplitHostPort(u.Host)
 	if err != nil {
 		// 没有端口,使用默认端口
-		host = u.Host
+		host = u.Hostname()
 		if u.Scheme == "https" {
 			portStr = "443"
 		} else {