add Http::set_ssl_version() to set the available TLS version to use

This commit is contained in:
2022-12-19 14:17:30 +01:00
parent 32c30cf536
commit 9c0cd6eb5e
2 changed files with 70 additions and 0 deletions

View File

@@ -73,6 +73,8 @@ Http & Http::begin()
debug_info = nullptr;
follow_location = true;
verify_ssl_cert = true;
forse_ssl_version = false;
ssl_version = 0;
return *this;
}
@@ -451,6 +453,13 @@ void Http::allow_redirects(bool allow_redirects)
}
void Http::set_ssl_version(long ssl_version)
{
this->forse_ssl_version = true;
this->ssl_version = ssl_version;
}
void Http::verify_ssl(bool verify)
{
this->verify_ssl_cert = verify;
@@ -557,6 +566,11 @@ bool Http::fetch_internal(Method method, const char * url, const std::string * i
curl_easy_setopt(curl, CURLOPT_HEADERDATA, &out_headers_stream);
}
if( forse_ssl_version )
{
curl_easy_setopt(curl, CURLOPT_SSLVERSION, ssl_version);
}
// block the Expect: 100-continue header
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect
// https://httpwg.org/specs/rfc7231.html#header.expect