diff options
| author | ruki <[email protected]> | 2023-02-04 10:26:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-04 10:26:30 +0800 |
| commit | 1d916603e8ab705f4af9b0a14d9fa2bfc620dfaf (patch) | |
| tree | 9b9dc71c534e9b45a869a3d98f164e697a666a19 | |
| parent | c814b6d5fde13577d46184ef9aae0c1bd21e24e2 (diff) | |
add headers for downloader
| -rw-r--r-- | xmake/modules/net/http/download.lua | 15 |
1 files changed, 15 insertions, 0 deletions
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") |
