For the latest stable version, please use Emilua API 0.10! |
tls.socket
tls_ctx = tls.context.new('tlsv13')
local s = ip.tcp.socket.new()
ip.connect(s, ip.tcp.get_address_info('www.example.com', 'https'))
s = tls.socket.new(s, tls_ctx)
s:client_handshake()
s = http.socket.new(s)
local req = http.request.new()
local res = http.response.new()
req.headers.host = 'www.example.com'
s:write_request(req)
s:read_response(res)
Functions
client_handshake(self)
Perform the TLS client handshake and suspend current fiber until operation finishes.
server_handshake(self)
Perform the TLS server handshake and suspend current fiber until operation finishes.
read_some(self, buffer: byte_span) → integer
Read data from the stream socket and blocks current fiber until it completes or errs.
Returns the number of bytes read.
write_some(self, buffer: byte_span) → integer
Write data to the stream socket and blocks current fiber until it completes or errs.
Returns the number of bytes written.