1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net.http: support passing client certificates in http.fetch (#11356)

This commit is contained in:
Delyan Angelov
2021-09-01 01:43:35 +03:00
committed by GitHub
parent d1974f500f
commit 56993b9e2d
5 changed files with 64 additions and 12 deletions

View File

@@ -22,6 +22,11 @@ pub mut:
cookies map[string]string
user_agent string = 'v.http'
verbose bool
//
validate bool // set this to true, if you want to stop requests, when their certificates are found to be invalid
verify string // the path to a rootca.pem file, containing trusted CA certificate(s)
cert string // the path to a cert.pem file, containing client certificate(s) for the request
cert_key string // the path to a key.pem file, containing private keys for the client certificate(s)
}
pub fn new_request(method Method, url_ string, data string) ?Request {
@@ -119,6 +124,10 @@ pub fn fetch(config FetchConfig) ?Response {
user_agent: config.user_agent
user_ptr: 0
verbose: config.verbose
validate: config.validate
verify: config.verify
cert: config.cert
cert_key: config.cert_key
}
res := req.do() ?
return res