Просмотр исходного кода

Fix: tried to apply blank proxy setting in unfronted meek mode

Rod Hynes 11 лет назад
Родитель
Сommit
8b3e3c8fd3
1 измененных файлов с 11 добавлено и 9 удалено
  1. 11 9
      psiphon/meekConn.go

+ 11 - 9
psiphon/meekConn.go

@@ -126,16 +126,18 @@ func DialMeek(
 		// In this case, host is both what is dialed and what ends up in the HTTP Host header
 		host = fmt.Sprintf("%s:%d", serverEntry.IpAddress, serverEntry.MeekServerPort)
 
-		// For unfronted meek, we let the http.Transport handle proxying, as the
-		// target server hostname has to be in the HTTP request line. Also, in this
-		// case, we don't require the proxy to support CONNECT and so we can work
-		// throigh HTTP proxies that don't support it.
-		url, err := url.Parse(fmt.Sprintf("http://%s", meekConfig.UpstreamHttpProxyAddress))
-		if err != nil {
-			return nil, ContextError(err)
+		if meekConfig.UpstreamHttpProxyAddress != "" {
+			// For unfronted meek, we let the http.Transport handle proxying, as the
+			// target server hostname has to be in the HTTP request line. Also, in this
+			// case, we don't require the proxy to support CONNECT and so we can work
+			// throigh HTTP proxies that don't support it.
+			url, err := url.Parse(fmt.Sprintf("http://%s", meekConfig.UpstreamHttpProxyAddress))
+			if err != nil {
+				return nil, ContextError(err)
+			}
+			proxyUrl = http.ProxyURL(url)
+			meekConfig.UpstreamHttpProxyAddress = ""
 		}
-		proxyUrl = http.ProxyURL(url)
-		meekConfig.UpstreamHttpProxyAddress = ""
 
 		dialer = NewTCPDialer(meekConfig)
 	}