Subject: Re: telnet for HTTP download
To: Rose, Brian <Brian.Rose@icn.siemens.com>
From: Greg A. Woods <woods@weird.com>
List: netbsd-users
Date: 06/14/2002 16:05:34
[ On Friday, June 14, 2002 at 15:18:17 (-0400), Rose, Brian wrote: ]
> Subject: telnet for HTTP download
>
> 
> Is there a way to download a file on a HTTP server by doing a GET request
> from within a telnet. I'm not a telnet expert, but I know you can go into
> telnet and connect to web servers and view the pages (in source form). Can
> you also do a GET on a linked binary file and redirect it to a file?

What form of access did you use to login on the system where you are
running telnet?

I tried using the "script" utility to save the output of the session and
then used emacs to strip off all the crud.  The file looked right but
'xv' was unable to process it:

$ telnet www 80 
mesg: /dev/ttypd: Operation not permitted
_telnet: exit code: 2
Trying 204.92.254.17...
Connected to virtually.weird.com.
Escape character is '^]'.
GET http://www.weird.com/~woods/new.gif HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 14 Jun 2002 19:59:10 GMT
Server: Apache/1.3.12 (Unix)
Last-Modified: Sat, 02 Sep 1995 00:30:07 GMT
ETag: "17a7de-74-3047a58f"
Accept-Ranges: bytes
Content-Length: 116
Connection: close
Content-Type: image/gif

GIF89a~
       ,A!(B!,Ay(Bc``,~
                 aEŒo‚Š!,A\b(By,AOQ(BD,A+“(B6,A{(Bu@‘,A@(Bif,A$F(B      ,Ag“(B*,A[&fk:1(B8,AB1(B",Aq(Bz,A0\‰HŠA(B"2,A9(BIA-,ALE*H(B
                                                                               MTR;Connection closed by foreign host.
$ exit
Script done, output file is typescript
$ # edit typescript with emacs....
$ file public_html/new.gif                                         
public_html/new.gif: GIF image data, version 89a, 31 x 12,
$ file typescript
typescript: GIF image data, version 89a, 31 x 12,
$ xv typescript
# xv complains about the file format....
ksh: exit code: 255

An attempt to cut&paste the telnet output on an xterm didn't work
either, and resulted in corruption even 'file' could see (the image
really is 31x12 pixels):

$ cat > type.gif
# paste the output that looks like the GIF
$ file type.gif
type.gif: GIF image data, version 89a, 2686 x 8224,
$ 


-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>