From: mitra@pandora.sf.ca.us (Mitra)
Subject: Re: Gopher and FTP - is there a better way to do it
Organization: Pandora Systems
Date: Thu, 24 Dec 1992 19:09:27 GMT
X-Newsreader: TIN [version 1.1 PL6]


I'll leave tackling the problem of moving the ftp protocols into the client
to someone else, but here is a patch that will allow the client to 
override the Host and Port for Path's starting with "ftp:". The method
used would work well to be extended to other special cases as well. 

The rational - for those who missed the earlier post - is that it is crazy to 
ftp a file via a gateway specified by the Gopher that gave you the pointer
to the file. That Gopher has no idea which is the most efficient ftp gateway
for you. If I can get it from a local gopher-server then it reduces the 
bandwidth requirement (and potentially response time) by a factor of two.

To apply the patch do something like
"cd gopher1.1+ ; patch -l -p1 <gopher1.1.ftp.patch"

I dont believe this patch is dependant on any of the others I've distributed?

- Mitra


diff -b -c -r gopher1.1sc.re.pa.co/conf.h gopher1.1+/conf.h
*** gopher1.1sc.re.pa.co/conf.h	Wed Dec 23 17:04:20 1992
--- gopher1.1+/conf.h	Wed Dec 23 21:39:31 1992
***************
*** 41,46 ****
--- 41,49 ----
  #define CLIENT1_PORT 70
  #define CLIENT2_PORT 0
  
+ /* Define a reliable and close gopher->ftp gateway */
+ #define GOPHERTOFTP_HOST CLIENT1_HOST
+ #define GOPHERTOFTP_PORT CLIENT1_PORT
  
  /*
   * Override some defaults for various platforms
diff -b -c -r gopher1.1sc.re.pa.co/object/GDgopherdir.c gopher1.1+/object/GDgopherdir.c
*** gopher1.1sc.re.pa.co/object/GDgopherdir.c	Thu Dec 10 15:28:20 1992
--- gopher1.1+/object/GDgopherdir.c	Wed Dec 23 21:34:28 1992
***************
*** 200,205 ****
--- 200,209 ----
  	  GSinit(TempGopher);
  	  i = GSfromNet(TempGopher, sockfd);
  
+ #ifdef PANDORA
+ 	  GSprocessObject(TempGopher);
+ #endif
+ 
  	  if (i==0) {
  	       GDaddGS(gd, TempGopher);
  	       if (eachitem != NULL) 
diff -b -c -r gopher1.1sc.re.pa.co/object/GSgopherobj.c gopher1.1+/object/GSgopherobj.c
*** gopher1.1sc.re.pa.co/object/GSgopherobj.c	Thu Dec 10 15:28:20 1992
--- gopher1.1+/object/GSgopherobj.c	Wed Dec 23 21:33:51 1992
***************
*** 46,51 ****
--- 46,55 ----
  
  #include "Malloc.h"
  
+ #ifdef PANDORA
+ #include "../conf.h"
+ #endif
+ 
  /*
   * Make a new gopherobj, set the fields accordingly...
   */
***************
*** 229,234 ****
--- 233,251 ----
  extern int readfield();
  extern int readline();
  
+ #ifdef PANDORA
+ void
+ GSprocessObject(gs)
+   GopherObj *gs;
+ {
+ #ifdef GOPHERTOFTP_HOST
+     if (strncmp(GSgetPath(gs),"ftp:",4) == 0) {
+ 	GSsetPort(gs,GOPHERTOFTP_PORT);
+ 	GSsetHost(gs,GOPHERTOFTP_HOST);
+     }
+ #endif
+ }
+ #endif
  int
  GSfromNet(gs, sockfd)
    GopherObj *gs;
diff -b -c -r gopher1.1sc.re.pa.co/object/Makefile gopher1.1+/object/Makefile
*** gopher1.1sc.re.pa.co/object/Makefile	Thu Dec 10 15:28:20 1992
--- gopher1.1+/object/Makefile	Wed Dec 23 21:06:53 1992
***************
*** 1,6 ****
  include ../Makefile.config
  
! CCFLAGS	= $(OPT) $(COMPAT) $(GSYSTYPE) -I. 
  
  OBJS	= STRstring.o GDgopherdir.o GSgopherobj.o DAarray.o util.o  \
  	  compatible.o 
--- 1,6 ----
  include ../Makefile.config
  
! CCFLAGS	= $(OPT) $(LOCALINCLUDES) $(COMPAT) $(GSYSTYPE) -I. 
  
  OBJS	= STRstring.o GDgopherdir.o GSgopherobj.o DAarray.o util.o  \
  	  compatible.o