http_client: Always close socket on exception (#4399)

This commit is contained in:
Teddy Reed 2018-05-17 23:26:25 -04:00 committed by GitHub
parent b49feec0d3
commit b4c7abb2b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 10 deletions

View File

@ -60,9 +60,6 @@ void Client::closeSocket() {
if (sock_.is_open()) {
boost_system::error_code rc;
sock_.shutdown(boost_asio::ip::tcp::socket::shutdown_both, rc);
if (rc) {
return;
}
sock_.close(rc);
}
}

View File

@ -102,13 +102,6 @@ http::Client::Options TLSTransport::getOptions() {
options.proxy_hostname(FLAGS_proxy_hostname);
}
#if defined(DEBUG)
// Configuration may allow unsafe TLS testing if compiled as a debug target.
if (FLAGS_tls_allow_unsafe) {
options.always_verify_peer(false);
}
#endif
options.openssl_ciphers(kTLSCiphers);
options.openssl_options(SSL_OP_NO_SSLv3 | SSL_OP_NO_SSLv2 | SSL_OP_ALL);
@ -154,6 +147,13 @@ http::Client::Options TLSTransport::getOptions() {
options.openssl_sni_hostname(it->value.GetString());
}
#if defined(DEBUG)
// Configuration may allow unsafe TLS testing if compiled as a debug target.
if (FLAGS_tls_allow_unsafe) {
options.always_verify_peer(false);
}
#endif
return options;
}