我正在尝试切换此curl
命令,wget
因为curl
它会给系统带来一些漏洞。
curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64
wget
参数相当于什么curl -L
?提前致谢!
答案1
没有这个参数,wget
默认重定向如下。
例子:
% wget --verbose https://google.com --output-document=/dev/null
--2022-12-06 15:40:20-- https://google.com/
Resolving google.com (google.com)... 216.58.220.110
Connecting to google.com (google.com)|216.58.220.110|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.google.com/ [following]
--2022-12-06 15:40:20-- https://www.google.com/
Resolving www.google.com (www.google.com)... 142.251.42.164
Connecting to www.google.com (www.google.com)|142.251.42.164|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘/dev/null’
/dev/null [ <=> ] 14.82K --.-KB/s in 0s
2022-12-06 15:40:20 (49.4 MB/s) - ‘/dev/null’ saved [15179]
你可以禁用通过设置--max-redirect
为 0 进行以下重定向:
% wget --verbose https://google.com --output-document=/dev/null --max-redirect=0
--2022-12-06 15:41:00-- https://google.com/
Resolving google.com (google.com)... 216.58.220.110
Connecting to google.com (google.com)|216.58.220.110|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.google.com/ [following]
0 redirections exceeded.
因此,就以下重定向而言,这些大致相同:
获取 | 卷曲 |
---|---|
wget |
curl -L |
wget --max-redirect=0 |
curl |