Minor cleanups in http client
All integers in a callback should be taken by value, not reference.
Fix a typo on "Async"
Implement a TODO on libssl, where a macro was removed, so we can now
directly call the function
Tested: Unit tests pass.
Change-Id: Iaccd100a6b5f0dc871ec2d2cb1f01bed3ceefde2
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/http/http_client.hpp b/http/http_client.hpp
index 99565be..21e0909 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -151,7 +151,7 @@
boost::beast::flat_static_buffer<httpReadBufferSize> buffer;
Response res;
- // Ascync callables
+ // Async callables
std::function<void(bool, uint32_t, Response&)> callback;
boost::asio::io_context& ioc;
@@ -354,7 +354,7 @@
void afterRead(const std::shared_ptr<ConnectionInfo>& /*self*/,
const boost::beast::error_code& ec,
- const std::size_t& bytesTransferred)
+ const std::size_t bytesTransferred)
{
// The operation already timed out. We don't want do continue down
// this branch
@@ -583,16 +583,8 @@
}
// Create a null terminated string for SSL
std::string hostname(host.encoded_host_address());
- // NOTE: The SSL_set_tlsext_host_name is defined in tlsv1.h header
- // file but its having old style casting (name is cast to void*).
- // Since bmcweb compiler treats all old-style-cast as error, its
- // causing the build failure. So replaced the same macro inline and
- // did corrected the code by doing static_cast to viod*. This has to
- // be fixed in openssl library in long run. Set SNI Hostname (many
- // hosts need this to handshake successfully)
- if (SSL_ctrl(sslConn->native_handle(), SSL_CTRL_SET_TLSEXT_HOSTNAME,
- TLSEXT_NAMETYPE_host_name,
- static_cast<void*>(hostname.data())) == 0)
+ if (SSL_set_tlsext_host_name(sslConn->native_handle(),
+ hostname.data()) == 0)
{
boost::beast::error_code ec{static_cast<int>(::ERR_get_error()),