@@ -416,10 +416,19 @@ func TestProxyDialAddr(t *testing.T) {
416416 {"https without port" , "https://proxy.example.com" , "proxy.example.com:443" },
417417 {"http with port" , "http://proxy.example.com:8080" , "proxy.example.com:8080" },
418418 {"http without port" , "http://proxy.example.com" , "proxy.example.com:80" },
419+ {"ipv4 with port" , "http://192.168.1.100:3128" , "192.168.1.100:3128" },
420+ {"ipv4 without port https" , "https://10.0.0.1" , "10.0.0.1:443" },
421+ {"ipv4 without port http" , "http://172.16.0.5" , "172.16.0.5:80" },
422+ {"ipv6 with port" , "http://[::1]:8080" , "[::1]:8080" },
423+ {"ipv6 without port https" , "https://[2001:db8::1]" , "[2001:db8::1]:443" },
424+ {"ipv6 without port http" , "http://[fe80::1]" , "[fe80::1]:80" },
425+ {"localhost with port" , "http://localhost:9090" , "localhost:9090" },
426+ {"localhost without port https" , "https://localhost" , "localhost:443" },
427+ {"localhost without port http" , "http://localhost" , "localhost:80" },
419428 }
420429 for _ , tt := range tests {
421430 t .Run (tt .name , func (t * testing.T ) {
422- u , err := url .Parse (tt .url )
431+ u , err := url .ParseRequestURI (tt .url )
423432 if err != nil {
424433 t .Fatalf ("parse URL: %v" , err )
425434 }
0 commit comments