@@ -18,18 +18,21 @@ type DigestRequest struct {
18
18
Auth * authorization
19
19
Wa * wwwAuthenticate
20
20
CertVal bool
21
+ Timeout time.Duration
21
22
}
22
23
23
24
type DigestTransport struct {
24
25
Password string
25
26
Username string
27
+ Timeout time.Duration
26
28
}
27
29
28
30
// NewRequest creates a new DigestRequest object
29
31
func NewRequest (username , password , method , uri , body string ) DigestRequest {
30
32
dr := DigestRequest {}
31
33
dr .UpdateRequest (username , password , method , uri , body )
32
34
dr .CertVal = true
35
+ dr .Timeout = 30 * time .Second
33
36
return dr
34
37
}
35
38
@@ -38,6 +41,7 @@ func NewTransport(username, password string) DigestTransport {
38
41
dt := DigestTransport {}
39
42
dt .Password = password
40
43
dt .Username = username
44
+ dt .Timeout = 30 * time .Second
41
45
return dt
42
46
}
43
47
@@ -68,6 +72,7 @@ func (dt *DigestTransport) RoundTrip(req *http.Request) (resp *http.Response, er
68
72
}
69
73
70
74
dr := NewRequest (username , password , method , uri , body )
75
+ dr .Timeout = dt .Timeout
71
76
return dr .Execute ()
72
77
}
73
78
@@ -85,7 +90,7 @@ func (dr *DigestRequest) Execute() (resp *http.Response, err error) {
85
90
req .Header = dr .Header
86
91
87
92
client := & http.Client {
88
- Timeout : 30 * time . Second ,
93
+ Timeout : dr . Timeout ,
89
94
}
90
95
91
96
if ! dr .CertVal {
@@ -156,7 +161,7 @@ func (dr *DigestRequest) executeRequest(authString string) (resp *http.Response,
156
161
req .Header .Add ("Authorization" , authString )
157
162
158
163
client := & http.Client {
159
- Timeout : 30 * time . Second ,
164
+ Timeout : dr . Timeout ,
160
165
}
161
166
162
167
if ! dr .CertVal {
0 commit comments