home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
goserv.zip
/
gofilter.70
next >
Wrap
Text File
|
1994-12-30
|
1KB
|
27 lines
/* Sample minimal GoServe filter program */
parse arg source, selector, selector2 /* Get arguments */
parse var source server port transaction who . /* Often useful */
say who':' selector /* [show filter running] */
dir=datadir() /* Data root directory (e.g. "d:/gogopher/") */
/* This very simple filter just builds the full path name of a file from */
/* the selector and returns that. Note we do not put the full path in */
/* menus, as this could allow clients to access all files on the server */
/* machine, which is rarely desirable. */
if left(selector,1)<>'!' then do /* this is not a control request */
if selector='' then selector='mainmenu.'port /* 'startup' case */
if translate(right(selector,4))='.ZIP' /* use Binary for ZIP files */
then data='Binary'
else data='Text'
return 'File' data 'name' dir''selector /* normal selector case */
end
/* Drop through to here if this is a control request */
owners=server 1.23.45.67 /* list of authorized addresses */
if wordpos(who, owners)=0 then return /* ignore unauthorized requests */
return 'control' substr(selector,2) /* remainder of string is request */