From 42490568db4cf4bc65fc436b41cfcffb8eadd8d1 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 15 Jul 2016 16:46:09 -0300 Subject: [PATCH] 9438: Added a new var DefaultSecureClient and assigned a 5 minute timeout to both InsecureHTTPClient and DefaultSecureClient --- sdk/go/arvados/client.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sdk/go/arvados/client.go b/sdk/go/arvados/client.go index d6d610da91..50f853462e 100644 --- a/sdk/go/arvados/client.go +++ b/sdk/go/arvados/client.go @@ -10,6 +10,7 @@ import ( "net/http" "net/url" "os" + "time" ) // A Client is an HTTP client with an API endpoint and a set of @@ -20,7 +21,7 @@ import ( // of results using List APIs. type Client struct { // HTTP client used to make requests. If nil, - // http.DefaultClient or InsecureHTTPClient will be used. + // DefaultSecureClient or InsecureHTTPClient will be used. Client *http.Client // Hostname (or host:port) of Arvados API server. @@ -39,7 +40,12 @@ type Client struct { var InsecureHTTPClient = &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{ - InsecureSkipVerify: true}}} + InsecureSkipVerify: true}}, + Timeout: time.Duration(5 * time.Minute)} + +// The default http.Client used by a Client otherwise. +var DefaultSecureClient = &http.Client{ + Timeout: time.Duration(5 * time.Minute)} // NewClientFromEnv creates a new Client that uses the default HTTP // client with the API endpoint and credentials given by the @@ -169,7 +175,7 @@ func (c *Client) httpClient() *http.Client { case c.Insecure: return InsecureHTTPClient default: - return http.DefaultClient + return DefaultSecureClient } } -- 2.30.2