@@ -105,16 +105,17 @@ func fetchCRL(url string) (*pkix.CertificateList, error) {
105
105
resp, err := HTTPClient.Get(url)
106
106
if err != nil {
107
107
return nil, err
108
-
} else if resp.StatusCode >= 300 {
108
+
}
109
+
defer resp.Body.Close()
110
+
111
+
if resp.StatusCode >= 300 {
109
112
return nil, errors.New("failed to retrieve CRL")
110
113
}
111
114
112
115
body, err := crlRead(resp.Body)
113
116
if err != nil {
114
117
return nil, err
115
118
}
116
-
resp.Body.Close()
117
-
118
119
return x509.ParseCRL(body)
119
120
}
120
121
@@ -212,12 +213,12 @@ func fetchRemote(url string) (*x509.Certificate, error) {
212
213
if err != nil {
213
214
return nil, err
214
215
}
216
+
defer resp.Body.Close()
215
217
216
218
in, err := remoteRead(resp.Body)
217
219
if err != nil {
218
220
return nil, err
219
221
}
220
-
resp.Body.Close()
221
222
222
223
p, _ := pem.Decode(in)
223
224
if p != nil {
@@ -290,6 +291,7 @@ func sendOCSPRequest(server string, req []byte, leaf, issuer *x509.Certificate)
290
291
if err != nil {
291
292
return nil, err
292
293
}
294
+
defer resp.Body.Close()
293
295
294
296
if resp.StatusCode != http.StatusOK {
295
297
return nil, errors.New("failed to retrieve OSCP")
@@ -299,7 +301,6 @@ func sendOCSPRequest(server string, req []byte, leaf, issuer *x509.Certificate)
299
301
if err != nil {
300
302
return nil, err
301
303
}
302
-
resp.Body.Close()
303
304
304
305
switch {
305
306
case bytes.Equal(body, ocsp.UnauthorizedErrorResponse):
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