From 9d3f4c8bffeff81db0b5f1f7f06c8ff8b479c9d3 Mon Sep 17 00:00:00 2001 From: Jonas Widen Date: Sun, 16 Mar 2025 18:35:50 +0100 Subject: [PATCH] Fixed crash --- lua/gemini/api.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lua/gemini/api.lua b/lua/gemini/api.lua index f1d4564..c3d2c76 100644 --- a/lua/gemini/api.lua +++ b/lua/gemini/api.lua @@ -53,8 +53,8 @@ local function async_request(url, payload, callback) return end - local ssl = vim.loop.new_tls() - ssl:wrap(client) + -- Create TLS wrapper + local tls_client = vim.loop.new_tls_wrap(client) local request = string.format( "POST %s HTTP/1.1\r\n" .. @@ -68,7 +68,7 @@ local function async_request(url, payload, callback) local response = "" - ssl:write(request, function(err) + tls_client:write(request, function(err) if err then vim.schedule(function() callback(nil, "Write error: " .. err) @@ -76,7 +76,7 @@ local function async_request(url, payload, callback) return end - ssl:read_start(function(err, chunk) + tls_client:read_start(function(err, chunk) if err then vim.schedule(function() callback(nil, "Read error: " .. err) @@ -99,7 +99,7 @@ local function async_request(url, payload, callback) end end) - ssl:close() + tls_client:close() client:close() end end)