Telnetを使用したファイルのダウンロード

Telnetを使用したファイルのダウンロード

ファイルをダウンロードしようとしていますが、 https://the.earth.li/~sgtatham/putty/latest/w64/putty.exeまたはhttps://www.7-zip.org/a/7z1806-x64.execurlまたは;代わりに、以下を使用してファイルをダウンロードし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

おすすめ記事