我正在尝试下载一个文件, https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe或者https://www.7-zip.org/a/7z1806-x64.exe,不使用curl
或wget
;相反,我想使用telnet
如下方式下载文件。
(echo 'GET /~sgtatham/putty/latest/w64/putty.exe'; echo ""; sleep 1; ) | telnet the.earth.li 80 > s.exe
这是行不通的;当我使用时cat
文件内容如下。
HTTP/1.1 302 Found
Date: Sun, 17 Feb 2019 18:40:22 GMT
Server: Apache
Location: https://the.earth.li/~sgtatham/putty/0.70/w64/putty.exe
Content-Length: 301
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://the.earth.li/~sgtatham/putty/0.70/w64/putty.exe">here</a>.</p>
<hr>
<address>Apache Server at the.earth.li Port 80</address>
</body></html>
答案1
从回复中可以看到“文档已移至”https://the.earth.li/~sgtatham/putty/0.70/w64/putty.exe”,所以您应该更改命令中的链接(将“最新”更改为“0.70”)。
您的浏览器会自动执行此操作。命令应该是:
(echo 'GET /~sgtatham/putty/0.70/w64/putty.exe'; echo ""; sleep 1; ) | telnet the.earth.li 80 > s.exe