lib/curl/Easy: add methods SetVerify{Host,Peer}()

This commit is contained in:
Max Kellermann 2021-01-22 12:33:27 +01:00
parent d56a51cb5e
commit 33ac3eb551
3 changed files with 18 additions and 2 deletions

View File

@ -432,8 +432,8 @@ CurlInputStream::InitEasy()
StringFormat<1024>("%s:%s", proxy_user,
proxy_password).c_str());
request->SetOption(CURLOPT_SSL_VERIFYPEER, verify_peer ? 1L : 0L);
request->SetOption(CURLOPT_SSL_VERIFYHOST, verify_host ? 2L : 0L);
request->SetVerifyPeer(verify_peer);
request->SetVerifyHost(verify_host);
request->SetOption(CURLOPT_HTTPHEADER, request_headers.Get());
}

View File

@ -136,6 +136,14 @@ public:
SetOption(CURLOPT_FAILONERROR, (long)value);
}
void SetVerifyHost(bool value) {
SetOption(CURLOPT_SSL_VERIFYHOST, value ? 2L : 0L);
}
void SetVerifyPeer(bool value) {
SetOption(CURLOPT_SSL_VERIFYPEER, (long)value);
}
void SetConnectTimeout(long timeout) {
SetOption(CURLOPT_CONNECTTIMEOUT, timeout);
}

View File

@ -120,6 +120,14 @@ public:
easy.SetRequestHeaders(request_headers);
}
void SetVerifyHost(bool value) {
easy.SetVerifyHost(value);
}
void SetVerifyPeer(bool value) {
easy.SetVerifyPeer(value);
}
void SetNoBody(bool value=true) {
easy.SetNoBody(value);
}