From 1d916603e8ab705f4af9b0a14d9fa2bfc620dfaf Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 4 Feb 2023 10:26:30 +0800 Subject: add headers for downloader --- xmake/modules/net/http/download.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xmake/modules/net/http/download.lua b/xmake/modules/net/http/download.lua index 0b266a248..038d3fb03 100644 --- a/xmake/modules/net/http/download.lua +++ b/xmake/modules/net/http/download.lua @@ -85,6 +85,14 @@ function _curl_download(tool, url, outputfile, opt) table.insert(argv, "-k") end + -- add custom headers + if opt.headers then + for _, header in ipairs(opt.headers) do + table.insert(argv, "-H") + table.insert(argv, header) + end + end + -- continue to download? if opt.continue then table.insert(argv, "-C") @@ -150,6 +158,13 @@ function _wget_download(tool, url, outputfile, opt) table.insert(argv, "--no-check-certificate") end + -- add custom headers + if opt.headers then + for _, header in ipairs(opt.headers) do + table.insert(argv, "--header=" .. header) + end + end + -- continue to download? if opt.continue then table.insert(argv, "-c") -- cgit v1.3.1