Adding ability to execute requests when there are defects in the cert.
diff --git a/digest_auth_client.go b/digest_auth_client.go
index 0d8ef8f..f796c11 100644
--- a/digest_auth_client.go
+++ b/digest_auth_client.go
@@ -2,6 +2,7 @@
import (
"bytes"
+ "crypto/tls"
"fmt"
"net/http"
"time"
@@ -16,6 +17,7 @@
Header http.Header
Auth *authorization
Wa *wwwAuthenticate
+ CertVal bool
}
type DigestTransport struct {
@@ -27,6 +29,7 @@
func NewRequest(username, password, method, uri, body string) DigestRequest {
dr := DigestRequest{}
dr.UpdateRequest(username, password, method, uri, body)
+ dr.CertVal = true
return dr
}
@@ -84,6 +87,14 @@
client := &http.Client{
Timeout: 30 * time.Second,
}
+
+ if !dr.CertVal {
+ tr := &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
+ }
+ client.Transport = tr
+ }
+
if resp, err = client.Do(req); err != nil {
return nil, err
}
@@ -148,5 +159,12 @@
Timeout: 30 * time.Second,
}
+ if !dr.CertVal {
+ tr := &http.Transport{
+ TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
+ }
+ client.Transport = tr
+ }
+
return client.Do(req)
}