@@ -168,12 +168,24 @@ func getOCSPForCert(ocspConfig OCSPConfig, bundle []byte) ([]byte, *ocsp.Respons
168
168
return nil , nil , fmt .Errorf ("override disables querying OCSP responder: %v" , issuedCert .OCSPServer [0 ])
169
169
}
170
170
171
+ // configure HTTP client if necessary
172
+ httpClient := http .DefaultClient
173
+ if ocspConfig .HTTPProxy != nil {
174
+ httpClient = & http.Client {
175
+ Transport : & http.Transport {
176
+ Proxy : ocspConfig .HTTPProxy ,
177
+ },
178
+ Timeout : 30 * time .Second ,
179
+ }
180
+ }
181
+
182
+ // get issuer certificate if needed
171
183
if len (certificates ) == 1 {
172
184
if len (issuedCert .IssuingCertificateURL ) == 0 {
173
185
return nil , nil , fmt .Errorf ("no URL to issuing certificate" )
174
186
}
175
187
176
- resp , err := http .Get (issuedCert .IssuingCertificateURL [0 ])
188
+ resp , err := httpClient .Get (issuedCert .IssuingCertificateURL [0 ])
177
189
if err != nil {
178
190
return nil , nil , fmt .Errorf ("getting issuer certificate: %v" , err )
179
191
}
@@ -202,7 +214,7 @@ func getOCSPForCert(ocspConfig OCSPConfig, bundle []byte) ([]byte, *ocsp.Respons
202
214
}
203
215
204
216
reader := bytes .NewReader (ocspReq )
205
- req , err := http .Post (respURL , "application/ocsp-request" , reader )
217
+ req , err := httpClient .Post (respURL , "application/ocsp-request" , reader )
206
218
if err != nil {
207
219
return nil , nil , fmt .Errorf ("making OCSP request: %v" , err )
208
220
}
0 commit comments