Merge pull request #4952 from hashicorp/fix4848

update winrm to use keepalives
This commit is contained in:
Matthew Hooker 2017-06-01 15:18:52 -07:00 committed by GitHub
commit 847b09b6ea
4 changed files with 21 additions and 4 deletions

View File

@ -3,7 +3,9 @@ package winrm
import (
"fmt"
"io/ioutil"
"net"
"strings"
"time"
"github.com/masterzen/azure-sdk-for-go/core/http"
"github.com/masterzen/azure-sdk-for-go/core/tls"
@ -22,10 +24,15 @@ func (c *ClientAuthRequest) Transport(endpoint *Endpoint) error {
}
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: endpoint.Insecure,
Certificates: []tls.Certificate{cert},
},
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
ResponseHeaderTimeout: endpoint.Timeout,
}

View File

@ -18,6 +18,8 @@ type Endpoint struct {
HTTPS bool
// set the flag true for skipping ssl verifications
Insecure bool
// if set, used to verify the hostname on the returned certificate
TLSServerName string
// pointer pem certs, and key
CACert []byte // cert auth to intdetify the server cert
Key []byte // public key for client auth connections

View File

@ -4,8 +4,10 @@ import (
"crypto/tls"
"fmt"
"io/ioutil"
"net"
"net/http"
"strings"
"time"
"github.com/masterzen/winrm/soap"
)
@ -44,7 +46,12 @@ func (c *clientRequest) Transport(endpoint *Endpoint) error {
Proxy: http.ProxyFromEnvironment,
TLSClientConfig: &tls.Config{
InsecureSkipVerify: endpoint.Insecure,
ServerName: endpoint.TLSServerName,
},
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
ResponseHeaderTimeout: endpoint.Timeout,
}

9
vendor/vendor.json vendored
View File

@ -579,15 +579,16 @@
"revision": "95ba30457eb1121fa27753627c774c7cd4e90083"
},
{
"checksumSHA1": "kWWDtHJJp7Hiq0zj0xecRGqMoeU=",
"checksumSHA1": "LY1os7cX/gWXWTWYCHCtEaf5jSw=",
"path": "github.com/masterzen/winrm",
"revision": "acf371f6aff113fc0104a61cd72db45a7c27d310",
"revisionTime": "2017-03-29T23:04:57Z"
"revision": "1ca0ba637a877ee12b69abc73c6161fccb77b70a",
"revisionTime": "2017-06-01T21:16:37Z"
},
{
"checksumSHA1": "KTsgWipT3ennAAtaKxEZairxero=",
"path": "github.com/masterzen/winrm/soap",
"revision": "ef3efbb97f99fc204bd9c7edf778a0dbd9781baf"
"revision": "1ca0ba637a877ee12b69abc73c6161fccb77b70a",
"revisionTime": "2017-06-01T21:16:37Z"
},
{
"checksumSHA1": "bx+egnFe0OB0BZBcgZcaqsvcmS4=",