1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net.openssl, net.mbedtls: add support for -d trace_ssl, for easier tracing of binary protocol problems to https servers

This commit is contained in:
Delyan Angelov
2023-01-15 15:49:31 +02:00
parent 7f3531077d
commit bfb47005c8
4 changed files with 136 additions and 15 deletions

View File

@@ -3,6 +3,9 @@ module openssl
// ssl_error returns non error ssl code or error if unrecoverable and we should panic
fn ssl_error(ret int, ssl voidptr) !SSLError {
res := C.SSL_get_error(ssl, ret)
$if trace_ssl ? {
eprintln('${@METHOD} ret: ${ret} | ssl: ${ssl:x} | res: ${res}')
}
match unsafe { SSLError(res) } {
.ssl_error_syscall {
return error_with_code('unrecoverable syscall (${res})', res)