@@ -18,18 +18,21 @@ type DigestRequest struct {
1818Auth * authorization
1919Wa * wwwAuthenticate
2020CertVal bool
21+ Timeout time.Duration
2122}
2223
2324type DigestTransport struct {
2425Password string
2526Username string
27+ Timeout time.Duration
2628}
2729
2830// NewRequest creates a new DigestRequest object
2931func NewRequest (username , password , method , uri , body string ) DigestRequest {
3032dr := DigestRequest {}
3133dr .UpdateRequest (username , password , method , uri , body )
3234dr .CertVal = true
35+ dr .Timeout = 30 * time .Second
3336return dr
3437}
3538
@@ -38,6 +41,7 @@ func NewTransport(username, password string) DigestTransport {
3841dt := DigestTransport {}
3942dt .Password = password
4043dt .Username = username
44+ dt .Timeout = 30 * time .Second
4145return dt
4246}
4347
@@ -68,6 +72,7 @@ func (dt *DigestTransport) RoundTrip(req *http.Request) (resp *http.Response, er
6872}
6973
7074dr := NewRequest (username , password , method , uri , body )
75+ dr .Timeout = dt .Timeout
7176return dr .Execute ()
7277}
7378
@@ -85,7 +90,7 @@ func (dr *DigestRequest) Execute() (resp *http.Response, err error) {
8590req .Header = dr .Header
8691
8792client := & http.Client {
88- Timeout : 30 * time . Second ,
93+ Timeout : dr . Timeout ,
8994}
9095
9196if ! dr .CertVal {
@@ -156,7 +161,7 @@ func (dr *DigestRequest) executeRequest(authString string) (resp *http.Response,
156161req .Header .Add ("Authorization" , authString )
157162
158163client := & http.Client {
159- Timeout : 30 * time . Second ,
164+ Timeout : dr . Timeout ,
160165}
161166
162167if ! dr .CertVal {
0 commit comments