File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -2931,11 +2931,17 @@ func (pc *persistConn) closeLocked(err error) {
29312931 pc .mutateHeaderFunc = nil
29322932}
29332933
2934- var portMap = map [string ]string {
2935- "http" : "80" ,
2936- "https" : "443" ,
2937- "socks5" : "1080" ,
2938- "socks5h" : "1080" ,
2934+ func schemePort (scheme string ) string {
2935+ switch scheme {
2936+ case "http" :
2937+ return "80"
2938+ case "https" :
2939+ return "443"
2940+ case "socks5" , "socks5h" :
2941+ return "1080"
2942+ default :
2943+ return ""
2944+ }
29392945}
29402946
29412947func idnaASCIIFromURL (url * url.URL ) string {
@@ -2950,7 +2956,7 @@ func idnaASCIIFromURL(url *url.URL) string {
29502956func canonicalAddr (url * url.URL ) string {
29512957 port := url .Port ()
29522958 if port == "" {
2953- port = portMap [ url .Scheme ]
2959+ port = schemePort ( url .Scheme )
29542960 }
29552961 return net .JoinHostPort (idnaASCIIFromURL (url ), port )
29562962}
You can’t perform that action at this time.
0 commit comments