xinsnake / go-http-digest-auth-client

Golang Http Digest Authentication Client
BSD 2-Clause "Simplified" License
41 stars 68 forks source link

enable passing in a http client, for customizing TLS config and timeouts #13

Closed nickysemenza closed 5 years ago

nickysemenza commented 6 years ago

i'm using this to allow setting custom timeouts and tls config like so:

dr := dac.NewRequest(...)
verifyCert := func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
    // 
    return nil
}
dr.HTTPClient = &http.Client{
    Timeout: 15 * time.Second,
    Transport: &http.Transport{
        TLSClientConfig: &tls.Config{
            InsecureSkipVerify: true,
            VerifyPeerCertificate: verifyCert,
        },
    },
}
res, err = dr.Execute()

I've kept it backwards compatible with the existing CertVal functionality

amuttsch commented 5 years ago

@xinsnake Can you review and merge this PR please? I could use this functionality in one of my projects.