A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/cloudflare/cfssl/commit/7a59a7dbae656717661d880ecdb35990334cda8a below:

Allow users to use custom HTTP client · cloudflare/cfssl@7a59a7d · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+11

-5

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+11

-5

lines changed Original file line number Diff line number Diff line change

@@ -32,6 +32,9 @@ import (

32 32

// When unspecified, downloaded intermediates are not saved.

33 33

var IntermediateStash string

34 34 35 +

// HTTPClient is an instance of http.Client that will be used for all HTTP requests.

36 +

var HTTPClient = http.DefaultClient

37 + 35 38

// BundleFlavor is named optimization strategy on certificate chain selection when bundling.

36 39

type BundleFlavor string

37 40

@@ -333,7 +336,7 @@ type fetchedIntermediate struct {

333 336

func fetchRemoteCertificate(certURL string) (fi *fetchedIntermediate, err error) {

334 337

log.Debugf("fetching remote certificate: %s", certURL)

335 338

var resp *http.Response

336 -

resp, err = http.Get(certURL)

339 +

resp, err = HTTPClient.Get(certURL)

337 340

if err != nil {

338 341

log.Debugf("failed HTTP get: %v", err)

339 342

return

Original file line number Diff line number Diff line change

@@ -25,6 +25,9 @@ import (

25 25

"github.com/cloudflare/cfssl/log"

26 26

)

27 27 28 +

// HTTPClient is an instance of http.Client that will be used for all HTTP requests.

29 +

var HTTPClient = http.DefaultClient

30 + 28 31

// HardFail determines whether the failure to check the revocation

29 32

// status of a certificate (i.e. due to network failure) causes

30 33

// verification to fail (a hard failure).

@@ -99,7 +102,7 @@ func revCheck(cert *x509.Certificate) (revoked, ok bool, err error) {

99 102 100 103

// fetchCRL fetches and parses a CRL.

101 104

func fetchCRL(url string) (*pkix.CertificateList, error) {

102 -

resp, err := http.Get(url)

105 +

resp, err := HTTPClient.Get(url)

103 106

if err != nil {

104 107

return nil, err

105 108

} else if resp.StatusCode >= 300 {

@@ -205,7 +208,7 @@ func VerifyCertificateError(cert *x509.Certificate) (revoked, ok bool, err error

205 208

}

206 209 207 210

func fetchRemote(url string) (*x509.Certificate, error) {

208 -

resp, err := http.Get(url)

211 +

resp, err := HTTPClient.Get(url)

209 212

if err != nil {

210 213

return nil, err

211 214

}

@@ -278,10 +281,10 @@ func sendOCSPRequest(server string, req []byte, leaf, issuer *x509.Certificate)

278 281

var err error

279 282

if len(req) > 256 {

280 283

buf := bytes.NewBuffer(req)

281 -

resp, err = http.Post(server, "application/ocsp-request", buf)

284 +

resp, err = HTTPClient.Post(server, "application/ocsp-request", buf)

282 285

} else {

283 286

reqURL := server + "/" + neturl.QueryEscape(base64.StdEncoding.EncodeToString(req))

284 -

resp, err = http.Get(reqURL)

287 +

resp, err = HTTPClient.Get(reqURL)

285 288

}

286 289 287 290

if err != nil {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4