Browse Source

store received data in the client data field

master
nixo 2 years ago
parent
commit
33841887c0
  1. 5
      src/types.jl

5
src/types.jl

@ -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[]

Loading…
Cancel
Save