Commit 7af1dc42 by creamlike1024

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

parent 82163b4b
...@@ -237,7 +237,7 @@ func (p *SSRFProtection) ValidateURL(urlStr string) error { ...@@ -237,7 +237,7 @@ func (p *SSRFProtection) ValidateURL(urlStr string) error {
host, portStr, err := net.SplitHostPort(u.Host) host, portStr, err := net.SplitHostPort(u.Host)
if err != nil { if err != nil {
// 没有端口,使用默认端口 // 没有端口,使用默认端口
host = u.Host host = u.Hostname()
if u.Scheme == "https" { if u.Scheme == "https" {
portStr = "443" portStr = "443"
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment