Merge pull request #4952 from hashicorp/fix4848
update winrm to use keepalives
This commit is contained in:
commit
847b09b6ea
|
@ -3,7 +3,9 @@ package winrm
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/masterzen/azure-sdk-for-go/core/http"
|
"github.com/masterzen/azure-sdk-for-go/core/http"
|
||||||
"github.com/masterzen/azure-sdk-for-go/core/tls"
|
"github.com/masterzen/azure-sdk-for-go/core/tls"
|
||||||
|
@ -22,10 +24,15 @@ func (c *ClientAuthRequest) Transport(endpoint *Endpoint) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
InsecureSkipVerify: endpoint.Insecure,
|
InsecureSkipVerify: endpoint.Insecure,
|
||||||
Certificates: []tls.Certificate{cert},
|
Certificates: []tls.Certificate{cert},
|
||||||
},
|
},
|
||||||
|
Dial: (&net.Dialer{
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
|
KeepAlive: 30 * time.Second,
|
||||||
|
}).Dial,
|
||||||
ResponseHeaderTimeout: endpoint.Timeout,
|
ResponseHeaderTimeout: endpoint.Timeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ type Endpoint struct {
|
||||||
HTTPS bool
|
HTTPS bool
|
||||||
// set the flag true for skipping ssl verifications
|
// set the flag true for skipping ssl verifications
|
||||||
Insecure bool
|
Insecure bool
|
||||||
|
// if set, used to verify the hostname on the returned certificate
|
||||||
|
TLSServerName string
|
||||||
// pointer pem certs, and key
|
// pointer pem certs, and key
|
||||||
CACert []byte // cert auth to intdetify the server cert
|
CACert []byte // cert auth to intdetify the server cert
|
||||||
Key []byte // public key for client auth connections
|
Key []byte // public key for client auth connections
|
||||||
|
|
|
@ -4,8 +4,10 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/masterzen/winrm/soap"
|
"github.com/masterzen/winrm/soap"
|
||||||
)
|
)
|
||||||
|
@ -44,7 +46,12 @@ func (c *clientRequest) Transport(endpoint *Endpoint) error {
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
InsecureSkipVerify: endpoint.Insecure,
|
InsecureSkipVerify: endpoint.Insecure,
|
||||||
|
ServerName: endpoint.TLSServerName,
|
||||||
},
|
},
|
||||||
|
Dial: (&net.Dialer{
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
|
KeepAlive: 30 * time.Second,
|
||||||
|
}).Dial,
|
||||||
ResponseHeaderTimeout: endpoint.Timeout,
|
ResponseHeaderTimeout: endpoint.Timeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,15 +579,16 @@
|
||||||
"revision": "95ba30457eb1121fa27753627c774c7cd4e90083"
|
"revision": "95ba30457eb1121fa27753627c774c7cd4e90083"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "kWWDtHJJp7Hiq0zj0xecRGqMoeU=",
|
"checksumSHA1": "LY1os7cX/gWXWTWYCHCtEaf5jSw=",
|
||||||
"path": "github.com/masterzen/winrm",
|
"path": "github.com/masterzen/winrm",
|
||||||
"revision": "acf371f6aff113fc0104a61cd72db45a7c27d310",
|
"revision": "1ca0ba637a877ee12b69abc73c6161fccb77b70a",
|
||||||
"revisionTime": "2017-03-29T23:04:57Z"
|
"revisionTime": "2017-06-01T21:16:37Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "KTsgWipT3ennAAtaKxEZairxero=",
|
"checksumSHA1": "KTsgWipT3ennAAtaKxEZairxero=",
|
||||||
"path": "github.com/masterzen/winrm/soap",
|
"path": "github.com/masterzen/winrm/soap",
|
||||||
"revision": "ef3efbb97f99fc204bd9c7edf778a0dbd9781baf"
|
"revision": "1ca0ba637a877ee12b69abc73c6161fccb77b70a",
|
||||||
|
"revisionTime": "2017-06-01T21:16:37Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "bx+egnFe0OB0BZBcgZcaqsvcmS4=",
|
"checksumSHA1": "bx+egnFe0OB0BZBcgZcaqsvcmS4=",
|
||||||
|
|
Loading…
Reference in New Issue