home *** CD-ROM | disk | FTP | other *** search
/ ftp.muug.mb.ca / 2014.06.ftp.muug.mb.ca.tar / ftp.muug.mb.ca / pub / src / gopher / gopher1.01 / misc / gopher2ftp / ReadMe~ < prev   
Text File  |  1992-02-10  |  7KB  |  154 lines

  1. In this distribution is a simple and relatively (ha!) readable
  2. Perl script called g2ftpd.  The script implements an internet
  3. Gopher to FTP gateway. The gopher client connects to the g2ftpd
  4. daemon and tells it what the name of the ftp site is, (and perhaps
  5. what file it wishes to retrieve from there).  The daemon connects
  6. to the remote host, retrieves a directory listing (or file) via
  7. anonymous ftp, and returns it to the gopher client.  Of course
  8. all this happens without any new knowledge by the gopher client.
  9.  
  10. Running the script on a UNIX box gives folks running gopher clients
  11. access to all that good stuff available out there for anonymous ftp.
  12. The script assumes a nice healthy unixy ftp server at the ftp end...
  13. that is to say it is probably not going to work with funky IBM or
  14. TOPS-20 ftp implementations.  This is left as an exercise for the
  15. hacker...  er... reader.
  16.  
  17. The script is designed to be run by inetd as a TCP daemon.
  18. The easiest way to explain how to set it up and how it works
  19. is to use an example.
  20.  
  21. Let us assume that we want to run a gopher to FTP gateway on
  22. a machine called hell.micro.umn.edu. 
  23.  
  24. 1.  You need to have Perl available on the machine.  If you don't you
  25. can ftp the sources from a variety of anonymous ftp sites including
  26.  
  27.     uunet.uu.net
  28.     jpl-devvax.jpl.nasa.gov
  29.     tut.cis.ohio-state.edu
  30.  
  31. 2.  Edit the first few, (marked) lines of the g2ftpd file for your
  32. local configuration; in this case change the marked lines as follows:
  33.  
  34. #----Stuff here must be customized for your machine----
  35. $myName = "hell.micro.umn.edu";     #host full domain name
  36. $myPort = "7997";                   #port at which inetd will listen
  37. $ftp = "/usr/ucb/ftp";              #whereever on your box this lives
  38. #----end local customizations-------
  39.  
  40. 3.  Become root and place the gtoftpd file someplace nice (like
  41. /usr/local/bin or /usr/etc or wherever you place stuff like this);
  42. assume we put it in /usr/local/bin.  Make it owned by root and
  43. executable:
  44.  
  45.     chown root g2ftpd
  46.     chmod 755 g2ftpd
  47.  
  48. 4.  Update /etc/services by adding the following line to the
  49. /etc/services file (note it's tab between g2ftpd and 7997):
  50.  
  51.     g2ftpd    7997/tcp
  52.  
  53. Nothing sacred about 7997.  Run it at 6666 if you like...
  54. For SUNs running yp, you'll also want to do a make services:
  55.     cd /var/yp
  56.     make services
  57.  
  58. 5. Now update /etc/inetd.conf (for BSD-ish systems) or
  59. /etc/servers (on Ultrix or A/UX or others) depending on what you
  60. have.
  61. For /etc/inetd.conf, add a line:
  62.  
  63. g2ftpd    stream    tcp    nowait    root    /usr/local/bin/g2ftpd    g2ftpd
  64.  
  65. For /etc/servers, add a line:
  66.  
  67. g2ftpd    tcp    /usr/local/bin/g2ftpd
  68.  
  69. Note tabs between fields.
  70.  
  71. 6.  Kill and restart the inetd daemon whatever the prescribed way
  72. to do that on your machine.
  73.  
  74. 7.  You can confirm that g2ftpd is running now at port 7997 by
  75. telneting to hell.micro.umn.edu at port 7997. Type a hostname at 
  76. it (eg: boombox.micro.umn.edu), and it should respond by returning
  77. the anonymous ftp directories available at boombox.micro.umn.edu.
  78.  
  79. 8.  Now make some links from a regular gopher server to the g2ftpd
  80. service.  On a unix server, the links could look like this (on a 
  81. Mac server, do the functional equivalent using Gopher's Helper):
  82.  
  83.     Name=Sumex-aim:  Large collection of public domain Mac software.
  84.     Type=1
  85.     Port=7997
  86.     Path=sumex-aim.stanford.edu@info-mac/
  87.     Host=hell.micro.umn.edu
  88.  
  89.     Name=boombox:  Home of POPmail and Gopher Central.
  90.     Type=1
  91.     Port=7997
  92.     Path=boombox.micro.umn.edu@pub/
  93.     Host=hell.micro.umn.edu
  94.  
  95. And you're all set.
  96.  
  97. What happens is that the user sees the full Name (as always), say
  98. "boombox: Home of POPmail and Gopher Central".  It would appear as
  99. a directory (or folder icon on a Mac).  If selected (double-clicked
  100. on a Mac), the client would open a connection to hell.micro.umn.edu
  101. at port 7997.  The gtoftpd daemon would accept.  The client would
  102. then send it the selector string "boombox.micro.umn.edu@pub/".  The
  103. daemon would interpret this as "Go out to boombox.micro.umn.edu
  104. via anonymous ftp and get a listing of the pub directory."  The
  105. daemon would return this listing to the client in nice gopher
  106. format.  And everything else happens by magic as you would expect.
  107.  
  108. To the client it looks just like any other gopher-type directory.
  109. The script does assume that files ending in .hqx are BinHex files
  110. and gives them the type 4.  It also makes rash assumptions about the
  111. plethora of DOS binary files (.zip et. al.), and maps them all
  112. to a type 5.  Type 5 used to be "IBM BinHex" in the protocol notes,
  113. but since nobody really uses that, we've decided to map all these
  114. pesky binaries into type 5.  The client can decide what to do with
  115. them based on the .xxx extension that most seem to carry. Finally,
  116. it gives tar and Z files a filetype of 9.  And 9 is a new gopher
  117. item type (actually the only one we've allocated since we set up
  118. standards for the protocol.  All other files are given normal 
  119. type 0: that is text.
  120.  
  121. If your client is capable of handling binary types then it can
  122. allow type 5 and/or type 9 in directory listings.  It should be
  123. prepared to do things based just on the extensions (.xxx) of the
  124. files that the user requests.  In particular, it will need to
  125. just read from the connection until the server closes the connection
  126. when sending a binary file.  So there will be no concluding period,
  127. and obviously lines are meaningless.
  128.  
  129. WATCH OUT: The script has no way of knowing for sure that a file at an
  130. ftp site is binary (other than educated guesses based on the suffix of
  131. the filename), so when it presents gopherized listings, it must show
  132. these files too.  When a client attempts to retrieve a file, the script
  133. can peek into the file and make a much more educated guess as to
  134. whether it contains text.  So it should prevent a client from
  135. transferring totally gonzo binary.  I can hear the unix folks, the GIF
  136. folks, the PICT and TIFF folks and all the other special interest
  137. binary folks screaming.... :-) Yes, we need to do add some types... but
  138. we'd like to keep them as few as possible.
  139.  
  140. It would probably be wise to place caution ReadMe files out there for
  141. the users.  Also, if possible good gopher administrators would place
  142. the link all the way inside the "pub" or whatever directory at the
  143. server end.  We really don't want users fumbling around inside the bin
  144. or etc directories and attempting to suck down binary files.
  145.  
  146. Once more: the binary question is still open and we need to resolve
  147. that one yet.
  148.  
  149. All credit for this great and simple idea should go to Craig Rice
  150. (cdr@stolaf.edu).  Thanks Craig.  
  151.  
  152. FXA.
  153.  
  154.