From 72a5eff6a7a81f0b235d87c5ad9ce23cf6867330 Mon Sep 17 00:00:00 2001 From: arielherself Date: Tue, 28 May 2024 19:12:00 +0800 Subject: [PATCH] feat(curl): add option to disallow redirections --- lua/plenary/curl.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/plenary/curl.lua b/lua/plenary/curl.lua index b7fc9974..e2322269 100644 --- a/lua/plenary/curl.lua +++ b/lua/plenary/curl.lua @@ -15,6 +15,7 @@ all curl methods accepts http_version = "HTTP version to use: 'HTTP/0.9', 'HTTP/1.0', 'HTTP/1.1', 'HTTP/2', or 'HTTP/3'" (string) proxy = "[protocol://]host[:port] Use this proxy" (string) insecure = "Allow insecure server connections" (boolean) + redirect = "Allow redirection" (boolean) and returns table: @@ -214,7 +215,7 @@ parse.request = function(opts) opts.raw_body = b end end - local result = { "-sSL", opts.dump } + local result = { "-sS", opts.dump } local append = function(v) if v then table.insert(result, v) @@ -230,6 +231,9 @@ parse.request = function(opts) if opts.compressed then table.insert(result, "--compressed") end + if opts.redirect ~= false then + table.insert(result, '-L') + end append(parse.method(opts.method)) append(parse.headers(opts.headers)) append(parse.accept_header(opts.accept))