Fixes C4267 MSVC warning in server_https.hpp
std::min result is limited by SSL_MAX_SSL_SESSION_ID_LENGTH, which fully fits in unsigned int. So the cast won't truncate anything.
This commit is contained in:
parent
3c2b8c7e53
commit
bf94fc838d
1 changed files with 4 additions and 2 deletions
|
|
@ -47,8 +47,10 @@ namespace SimpleWeb {
|
||||||
// Creating session_id_context from address:port but reversed due to small SSL_MAX_SSL_SESSION_ID_LENGTH
|
// Creating session_id_context from address:port but reversed due to small SSL_MAX_SSL_SESSION_ID_LENGTH
|
||||||
auto session_id_context = std::to_string(acceptor->local_endpoint().port()) + ':';
|
auto session_id_context = std::to_string(acceptor->local_endpoint().port()) + ':';
|
||||||
session_id_context.append(config.address.rbegin(), config.address.rend());
|
session_id_context.append(config.address.rbegin(), config.address.rend());
|
||||||
SSL_CTX_set_session_id_context(context.native_handle(), reinterpret_cast<const unsigned char *>(session_id_context.data()),
|
const auto session_id_length = static_cast<unsigned int>(std::min<std::size_t>(session_id_context.size(), SSL_MAX_SSL_SESSION_ID_LENGTH));
|
||||||
std::min<std::size_t>(session_id_context.size(), SSL_MAX_SSL_SESSION_ID_LENGTH));
|
SSL_CTX_set_session_id_context(context.native_handle(),
|
||||||
|
reinterpret_cast<const unsigned char *>(session_id_context.data()),
|
||||||
|
session_id_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue