You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by fr...@apache.org on 2018/04/17 00:53:39 UTC

calcite-avatica-go git commit: Remove go-cleanhttp

Repository: calcite-avatica-go
Updated Branches:
  refs/heads/master 7590ce93f -> f2f4ba03e


Remove go-cleanhttp


Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/f2f4ba03
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/tree/f2f4ba03
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/diff/f2f4ba03

Branch: refs/heads/master
Commit: f2f4ba03e3f4dee333ec13d050b2336c391ca835
Parents: 7590ce9
Author: Francis Chuang <fr...@apache.org>
Authored: Tue Apr 17 10:41:59 2018 +1000
Committer: Francis Chuang <fr...@apache.org>
Committed: Tue Apr 17 10:41:59 2018 +1000

----------------------------------------------------------------------
 Gopkg.lock     |  6 ------
 Gopkg.toml     |  4 ----
 http_client.go | 22 ++++++++++++++++++----
 3 files changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/blob/f2f4ba03/Gopkg.lock
----------------------------------------------------------------------
diff --git a/Gopkg.lock b/Gopkg.lock
index 958c548..b29160f 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -9,12 +9,6 @@
 
 [[projects]]
   branch = "master"
-  name = "github.com/hashicorp/go-cleanhttp"
-  packages = ["."]
-  revision = "d5fe4b57a186c716b0e00b8c301cbd9b4182694d"
-
-[[projects]]
-  branch = "master"
   name = "github.com/hashicorp/go-uuid"
   packages = ["."]
   revision = "27454136f0364f2d44b1276c552d69105cf8c498"

http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/blob/f2f4ba03/Gopkg.toml
----------------------------------------------------------------------
diff --git a/Gopkg.toml b/Gopkg.toml
index 99f0c8e..9439ef4 100644
--- a/Gopkg.toml
+++ b/Gopkg.toml
@@ -31,10 +31,6 @@
 
 [[constraint]]
   branch = "master"
-  name = "github.com/hashicorp/go-cleanhttp"
-
-[[constraint]]
-  branch = "master"
   name = "github.com/satori/go.uuid"
 
 [[constraint]]

http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/blob/f2f4ba03/http_client.go
----------------------------------------------------------------------
diff --git a/http_client.go b/http_client.go
index b58a62a..3d3bfed 100644
--- a/http_client.go
+++ b/http_client.go
@@ -22,12 +22,14 @@ import (
 	"database/sql/driver"
 	"fmt"
 	"io/ioutil"
+	"net"
 	"net/http"
 	"regexp"
+	"runtime"
+	"time"
 
 	avaticaMessage "github.com/apache/calcite-avatica-go/message"
 	"github.com/golang/protobuf/proto"
-	"github.com/hashicorp/go-cleanhttp"
 	"github.com/xinsnake/go-http-digest-auth-client"
 	"golang.org/x/net/context"
 	"golang.org/x/net/context/ctxhttp"
@@ -72,13 +74,25 @@ func (e avaticaError) Error() string {
 // NewHTTPClient creates a new httpClient from a host.
 func NewHTTPClient(host string, authenticationConf httpClientAuthConfig) (*httpClient, error) {
 
-	hc := cleanhttp.DefaultPooledClient()
-
 	c := &httpClient{
 		host:       host,
 		authConfig: authenticationConf,
 
-		httpClient: hc,
+		httpClient: &http.Client{
+			Transport: &http.Transport{
+				Proxy: http.ProxyFromEnvironment,
+				DialContext: (&net.Dialer{
+					Timeout:   30 * time.Second,
+					KeepAlive: 30 * time.Second,
+					DualStack: true,
+				}).DialContext,
+				MaxIdleConns:          100,
+				IdleConnTimeout:       90 * time.Second,
+				TLSHandshakeTimeout:   10 * time.Second,
+				ExpectContinueTimeout: 1 * time.Second,
+				MaxIdleConnsPerHost:   runtime.GOMAXPROCS(0) + 1,
+			},
+		},
 	}
 
 	if authenticationConf.authenticationType == digest {