File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,21 @@ extension Socket {
5252 reason = " The operation did not complete because an application callback set by SSL_CTX_set_client_cert_cb() has asked to be called again. "
5353 case SSL_ERROR_SYSCALL:
5454 reason = String ( validatingUTF8: strerror ( errno) ) ?? " System call error "
55+ case SSL_ERROR_SSL:
56+ let bio = BIO_new ( BIO_s_mem ( ) )
57+
58+ defer {
59+ BIO_free ( bio)
60+ }
61+
62+ ERR_print_errors ( bio)
63+ let written = BIO_number_written ( bio)
64+
65+ var buffer : [ Int8 ] = Array ( repeating: 0 , count: Int ( written) + 1 )
66+ reason = buffer. withUnsafeMutableBufferPointer { buf in
67+ BIO_read ( bio, buf. baseAddress, Int32 ( written) )
68+ return String ( validatingUTF8: buf. baseAddress!)
69+ }
5570 default :
5671 reason = " A failure in the SSL library occurred. "
5772 }
You can’t perform that action at this time.
0 commit comments