I'm trying to download a file, https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe or https://www.7-zip.org/a/7z1806-x64.exe, without using curl or wget; rather, I want to download the file by using telnet as follows.
(echo 'GET /~sgtatham/putty/latest/w64/putty.exe'; echo ""; sleep 1; ) | telnet the.earth.li 80 > s.exe
This does not work; when I use cat the file contents are as follows.
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>
openssl s_client -host the.earth.li -port 443 -crlfwill do the job. Otherwise you may want to put a copy somewhere HTTP-accessible.