@@ -1140,7 +1140,7 @@ class Client {
11401140#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
11411141 bool is_ssl_ = false ;
11421142#endif
1143- }; // namespace httplib
1143+ };
11441144
11451145#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
11461146class SSLServer : public Server {
@@ -5660,25 +5660,21 @@ inline void ssl_delete(std::mutex &ctx_mutex, SSL *ssl,
56605660}
56615661
56625662template <typename U>
5663- bool ssl_connect_or_accept_nonblocking (socket_t sock, SSL *ssl, U ssl_connect_or_accept,
5664- time_t timeout_sec, time_t timeout_usec) {
5663+ bool ssl_connect_or_accept_nonblocking (socket_t sock, SSL *ssl,
5664+ U ssl_connect_or_accept,
5665+ time_t timeout_sec,
5666+ time_t timeout_usec) {
56655667 int res = 0 ;
56665668 while ((res = ssl_connect_or_accept (ssl)) != 1 ) {
56675669 auto err = SSL_get_error (ssl, res);
5668- switch (err)
5669- {
5670+ switch (err) {
56705671 case SSL_ERROR_WANT_READ:
5671- if (select_read (sock, timeout_sec, timeout_usec) > 0 ) {
5672- continue ;
5673- }
5672+ if (select_read (sock, timeout_sec, timeout_usec) > 0 ) { continue ; }
56745673 break ;
56755674 case SSL_ERROR_WANT_WRITE:
5676- if (select_write (sock, timeout_sec, timeout_usec) > 0 ) {
5677- continue ;
5678- }
5679- break ;
5680- default :
5675+ if (select_write (sock, timeout_sec, timeout_usec) > 0 ) { continue ; }
56815676 break ;
5677+ default : break ;
56825678 }
56835679 return false ;
56845680 }
@@ -5798,9 +5794,7 @@ inline ssize_t SSLSocketStream::read(char *ptr, size_t size) {
57985794 return SSL_read (ssl_, ptr, static_cast <int >(size));
57995795 } else if (is_readable ()) {
58005796 ret = SSL_read (ssl_, ptr, static_cast <int >(size));
5801- if (ret >= 0 ) {
5802- return ret;
5803- }
5797+ if (ret >= 0 ) { return ret; }
58045798 err = SSL_get_error (ssl_, ret);
58055799 } else {
58065800 return -1 ;
@@ -5902,11 +5896,10 @@ inline bool SSLServer::process_and_close_socket(socket_t sock) {
59025896 auto ssl = detail::ssl_new (
59035897 sock, ctx_, ctx_mutex_,
59045898 [&](SSL *ssl) {
5905- return detail:: ssl_connect_or_accept_nonblocking (sock, ssl, SSL_accept, read_timeout_sec_, read_timeout_usec_);
5899+ return detail::ssl_connect_or_accept_nonblocking (
5900+ sock, ssl, SSL_accept, read_timeout_sec_, read_timeout_usec_);
59065901 },
5907- [](SSL * /* ssl*/ ) {
5908- return true ;
5909- });
5902+ [](SSL * /* ssl*/ ) { return true ; });
59105903
59115904 if (ssl) {
59125905 auto ret = detail::process_server_socket_ssl (
@@ -6100,8 +6093,9 @@ inline bool SSLClient::initialize_ssl(Socket &socket) {
61006093 SSL_set_verify (ssl, SSL_VERIFY_NONE, nullptr );
61016094 }
61026095
6103- if (!detail:: ssl_connect_or_accept_nonblocking (socket.sock , ssl, SSL_connect,
6104- connection_timeout_sec_, connection_timeout_usec_)) {
6096+ if (!detail::ssl_connect_or_accept_nonblocking (
6097+ socket.sock , ssl, SSL_connect, connection_timeout_sec_,
6098+ connection_timeout_usec_)) {
61056099 error_ = Error::SSLConnection;
61066100 return false ;
61076101 }
0 commit comments