diff --git a/tool/net/definitions.lua b/tool/net/definitions.lua index 61e1d76bc..d7aac81f4 100644 --- a/tool/net/definitions.lua +++ b/tool/net/definitions.lua @@ -7982,8 +7982,8 @@ function unix.Errno:__tostring() end --- --- Initiates the connection handshake immediately. ---@param fd integer ----@param hostname string for validating that the hostname on the certificate matches what is expected ----@return crypto.tls.Connection +---@param hostname string # for validating that the hostname on the certificate matches what is expected +---@return crypto.tls.Connection # a connection object, with methods documented below. ---@nodiscard function crypto.tls.wrap(fd, hostname) end @@ -7998,7 +7998,7 @@ function crypto.tls.Connection:read() end --- --- This call is blocking. ---@param data string # the data to write to the connection. ----@return nil +---@return integer # the number of bytes written to the connection. function crypto.tls.Connectino:write() end --- Close the connection. diff --git a/tool/net/redbean.c b/tool/net/redbean.c index f122a86be..d0b36d67e 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -5179,13 +5179,13 @@ int LuaCryptoTlsConnectionWrite(lua_State *L) { size_t size; const char *data; data = luaL_checklstring(L, 2, &size); - return TlsConnectionWrite(GetTlsConnection(L), data, size); + lua_pushinteger(L, TlsConnectionWrite(GetTlsConnection(L), data, size)); + return 1; } int LuaCryptoTlsConnectionClose(lua_State *L) { TlsConnectionClose(GetTlsConnection(L)); - lua_pop(L, 1); - return 1; + return 0; } static int LuaCryptoTlsConnectionTostring(lua_State *L) {