diff --git a/Csocket.cpp b/Csocket.cpp index 8b94e048..afec535e 100644 --- a/Csocket.cpp +++ b/Csocket.cpp @@ -2109,7 +2109,18 @@ int Csock::GetPending() { #ifdef HAVE_LIBSSL if( m_ssl ) - return( SSL_pending( m_ssl ) ); + { + // in v23 method, the pending function is initialized to ssl_undefined_const_function + // which throws SSL_UNDEFINED_CONST_FUNCTION on to the error stack + // this is one of the more stupid things in openssl, it seems bizarre that even though SSL_pending + // returns an int, they don't bother returning in error to notify us, so basically + // we have to always clear errors here generated by SSL_pending, otherwise the stack could + // have a lame error on it causing SSL_write to fail in certain instances. + ERR_set_mark(); + int iBytes = SSL_pending( m_ssl ); + ERR_pop_to_mark(); + return( iBytes ); + } else return( 0 ); #else