فهرست منبع

Merge pull request #91 from rod-hynes/master

Revert to using ResponseHeaderTimeout
Rod Hynes 11 سال پیش
والد
کامیت
8ac1ed0a8e
2فایلهای تغییر یافته به همراه10 افزوده شده و 5 حذف شده
  1. 1 1
      psiphon/dataStore.go
  2. 9 4
      psiphon/httpProxy.go

+ 1 - 1
psiphon/dataStore.go

@@ -548,7 +548,7 @@ func ReportAvailableRegions() {
 
 		// Some server entries do not have a region, but it makes no sense to return
 		// an empty string as an "available region".
-		if (region != "") {
+		if region != "" {
 			regions = append(regions, region)
 		}
 	}

+ 9 - 4
psiphon/httpProxy.go

@@ -87,13 +87,16 @@ func NewHttpProxy(
 		return tunneler.Dial(addr, false, nil)
 	}
 	httpTunneledRelay := &http.Transport{
-		Dial:                tunneledDialer,
-		MaxIdleConnsPerHost: HTTP_PROXY_MAX_IDLE_CONNECTIONS_PER_HOST,
+		Dial:                  tunneledDialer,
+		MaxIdleConnsPerHost:   HTTP_PROXY_MAX_IDLE_CONNECTIONS_PER_HOST,
+		ResponseHeaderTimeout: HTTP_PROXY_ORIGIN_SERVER_TIMEOUT,
 	}
 	httpTunneledClient := &http.Client{
 		Transport: httpTunneledRelay,
 		Jar:       nil, // TODO: cookie support for URL proxy?
-		Timeout:   HTTP_PROXY_ORIGIN_SERVER_TIMEOUT,
+
+		// This timeout cuts downloads of large response bodies
+		//Timeout:   HTTP_PROXY_ORIGIN_SERVER_TIMEOUT,
 	}
 
 	directDialer := func(_, addr string) (conn net.Conn, err error) {
@@ -107,7 +110,9 @@ func NewHttpProxy(
 	httpDirectClient := &http.Client{
 		Transport: httpDirectRelay,
 		Jar:       nil,
-		Timeout:   HTTP_PROXY_ORIGIN_SERVER_TIMEOUT,
+
+		// This timeout cuts downloads of large response bodies
+		//Timeout:   HTTP_PROXY_ORIGIN_SERVER_TIMEOUT,
 	}
 
 	proxy = &HttpProxy{