store received data in the client data field

master
nixo 2020-10-24 22:35:36 +02:00
parent ea00124a51
commit 33841887c0
1 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ struct BIO_Method ptr end
struct SSL_Context ptr end
mutable struct SSLContext <: IO
data
data::Vector{UInt8}
ptr::Ptr{SSL_Context}
"Construct the SSLContext object, initializing its relatvie SSL_Context
@ -18,6 +18,7 @@ mutable struct SSLContext <: IO
# TODO: check error stack and report the right exception
throw(ErrorException("Could not create SSL context"))
end
ssl_context.data = UInt8[]
ssl_context
end
end
@ -36,7 +37,7 @@ mutable struct SSLClient{T}
client = new{T}()
client.context = ctx
client.ssl = SSL_new(ctx)
client.io_on_read = (data) -> nothing
client.io_on_read = (data) -> append!(client.context.data, data)
SSL_accept_state(client)
set_bio!(client, bio_new(), bio_new())
client.write_buf = UInt8[]