Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

Commit 2455ab6

Browse files
authored
Merge pull request #185 from cviecco/enhance-timeouts-client
Enhance timeouts client
2 parents 3ac1bbf + 2101e44 commit 2455ab6

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ endif
1010
BINARY=keymaster
1111

1212
# These are the values we want to pass for Version and BuildTime
13-
VERSION=1.4.11
13+
VERSION=1.4.12
1414
#BUILD_TIME=`date +%FT%T%z`
1515

1616
# Setup the -ldflags option for go build here, interpolate the variable values

keymaster.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: keymaster
2-
Version: 1.4.11
2+
Version: 1.4.12
33
Release: 1%{?dist}
44
Summary: Short term access certificate generator and client
55

lib/client/twofa/twofa.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func getCertsFromServer(
118118
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
119119
req.Header.Add("Accept", "application/json")
120120

121+
logger.Debugf(1, "About to start login request\n")
121122
loginResp, err := client.Do(req) //client.Get(targetUrl)
122123
if err != nil {
123124
logger.Printf("got error from req")

lib/client/util/util.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"encoding/pem"
1111
"fmt"
1212
"io/ioutil"
13+
"net"
1314
"net/http"
1415
"net/http/cookiejar"
1516
"net/url"
@@ -76,6 +77,11 @@ func genKeyPair(
7677
func getHttpClient(tlsConfig *tls.Config) (*http.Client, error) {
7778
clientTransport := &http.Transport{
7879
TLSClientConfig: tlsConfig,
80+
DialContext: (&net.Dialer{
81+
Timeout: 10 * time.Second,
82+
KeepAlive: 30 * time.Second,
83+
DualStack: true,
84+
}).DialContext,
7985
}
8086

8187
// proxy env variables in ascending order of preference, lower case 'http_proxy' dominates
@@ -93,7 +99,7 @@ func getHttpClient(tlsConfig *tls.Config) (*http.Client, error) {
9399
}
94100

95101
// TODO: change timeout const for a flag
96-
client := &http.Client{Transport: clientTransport, Jar: jar, Timeout: 5 * time.Second}
102+
client := &http.Client{Transport: clientTransport, Jar: jar, Timeout: 25 * time.Second}
97103
return client, nil
98104
}
99105

0 commit comments

Comments
 (0)