mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
[tls socket] update definition
This commit is contained in:
parent
470ee52159
commit
b8fb38d8ff
2 changed files with 1 additions and 29 deletions
|
@ -4991,7 +4991,7 @@ unix = {
|
||||||
---@class tls
|
---@class tls
|
||||||
local tls = {}
|
local tls = {}
|
||||||
|
|
||||||
--- Creates a new TLS socket.
|
--- Creates a new TLS client.
|
||||||
---@param fd integer File descriptor of the socket
|
---@param fd integer File descriptor of the socket
|
||||||
---@param verify? boolean Whether to verify the server's certificate (default: true)
|
---@param verify? boolean Whether to verify the server's certificate (default: true)
|
||||||
---@param timeout? integer Read timeout in milliseconds (default: 0, no timeout)
|
---@param timeout? integer Read timeout in milliseconds (default: 0, no timeout)
|
||||||
|
@ -4999,14 +4999,6 @@ local tls = {}
|
||||||
---@return string? error
|
---@return string? error
|
||||||
function tls.TlsClient(fd, verify, timeout) end
|
function tls.TlsClient(fd, verify, timeout) end
|
||||||
|
|
||||||
--- Connects to a server using TLS.
|
|
||||||
---@param context TlsContext
|
|
||||||
---@param server_name string
|
|
||||||
---@param server_port string
|
|
||||||
---@return boolean success
|
|
||||||
---@return string? error
|
|
||||||
function tls:connect(server_name, server_port) end
|
|
||||||
|
|
||||||
--- Writes data to the TLS connection.
|
--- Writes data to the TLS connection.
|
||||||
---@param context TlsContext
|
---@param context TlsContext
|
||||||
---@param data string
|
---@param data string
|
||||||
|
@ -5021,10 +5013,6 @@ function tls:write(data) end
|
||||||
---@return string? error
|
---@return string? error
|
||||||
function tls:read(bufsiz) end
|
function tls:read(bufsiz) end
|
||||||
|
|
||||||
--- Closes the TLS connection.
|
|
||||||
---@param context TlsContext
|
|
||||||
function tls:close() end
|
|
||||||
|
|
||||||
--- Opens file.
|
--- Opens file.
|
||||||
---
|
---
|
||||||
--- Returns a file descriptor integer that needs to be closed, e.g.
|
--- Returns a file descriptor integer that needs to be closed, e.g.
|
||||||
|
|
|
@ -254,21 +254,6 @@ static int tls_read(lua_State *L) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tls_close(lua_State *L) {
|
|
||||||
TlsContext **tlsp = checktls(L);
|
|
||||||
TlsContext *tls = *tlsp;
|
|
||||||
|
|
||||||
mbedtls_ssl_free(&tls->ssl);
|
|
||||||
mbedtls_ssl_config_free(&tls->conf);
|
|
||||||
mbedtls_ctr_drbg_free(&tls->ctr_drbg);
|
|
||||||
mbedtls_entropy_free(&tls->entropy);
|
|
||||||
free(tls->read_buffer);
|
|
||||||
tls->read_buffer = NULL;
|
|
||||||
tls->read_buffer_size = 0;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tls_tostring(lua_State *L) {
|
static int tls_tostring(lua_State *L) {
|
||||||
TlsContext **tlsp = checktls(L);
|
TlsContext **tlsp = checktls(L);
|
||||||
TlsContext *tls = *tlsp;
|
TlsContext *tls = *tlsp;
|
||||||
|
@ -280,7 +265,6 @@ static int tls_tostring(lua_State *L) {
|
||||||
static const struct luaL_Reg tls_methods[] = {
|
static const struct luaL_Reg tls_methods[] = {
|
||||||
{"write", tls_write},
|
{"write", tls_write},
|
||||||
{"read", tls_read},
|
{"read", tls_read},
|
||||||
{"close", tls_close},
|
|
||||||
{"__gc", tls_gc},
|
{"__gc", tls_gc},
|
||||||
{"__tostring", tls_tostring},
|
{"__tostring", tls_tostring},
|
||||||
{"__repr", tls_tostring},
|
{"__repr", tls_tostring},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue