예제 #1
0
파일: client.go 프로젝트: maddyonline/gddo
func newHTTPClient() *http.Client {
	return &http.Client{
		Transport: httputil.NewAuthTransport(
			&http.Transport{
				Proxy: http.ProxyFromEnvironment,
				Dial: (&net.Dialer{
					Timeout:   *dialTimeout,
					KeepAlive: *requestTimeout / 2,
				}).Dial,
				ResponseHeaderTimeout: *requestTimeout / 2,
				TLSHandshakeTimeout:   *requestTimeout / 2,
			},
		),
		Timeout: *requestTimeout,
	}
}
예제 #2
0
파일: client.go 프로젝트: golang/gddo
func newHTTPClient() *http.Client {
	t := newCacheTransport()
	t.Transport = &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		Dial: (&net.Dialer{
			Timeout:   *dialTimeout,
			KeepAlive: *requestTimeout / 2,
		}).Dial,
		ResponseHeaderTimeout: *requestTimeout / 2,
		TLSHandshakeTimeout:   *requestTimeout / 2,
	}
	return &http.Client{
		// Wrap the cached transport with GitHub authentication.
		Transport: httputil.NewAuthTransport(t),
		Timeout:   *requestTimeout,
	}
}