FILE command
Syntax:
FILE [ERASE] [TYPE content-type] [BINARY|TEXT] [NOCACHE] NAME filespec
The file named by 'filespec' will be sent to the client. 'filespec'
should normally be a fully qualified name (if it is not, GoServe would
look for it in the GoServe working directory). Either forward or
backward slashes may be used as directory separators; the OS/2 file
systems accept either.
After this command has ended, the connection to the client is closed, so
this is a 'completion command'.
The optional keywords may be specified, in any order, and have the
following effects:
-
ERASE -- the file is a temporary file, and should be erased after
being sent. [The transaction number and port can be used for
generating a safe name for a temporary file.]
-
TYPE -- [HTTP protocol only] the file will be prefixed by an HTTP
"OK" response line and an HTTP header, including the content length
derived from measuring the file. The value of the TYPE option
('content-type') should be a Internet Media Type such as "text/html"
or "image/gif". See notes below for more information.
The TYPE option may only be used if GoServe is started with the HTTP
parameter (HTTP headers are not used by Gopher), and should normally
always be used when running as a Web server.
-
BINARY -- [default for HTTP] the file is a binary file, and forms
the entire response to the client. GoServe will close the TCP/IP
connection as soon as the complete file has been sent.
A Gopher server should use this option for all files that are not
simple text or menus, for example ".ZIP" files, etc.
-
TEXT -- [default for Gopher] the file is a text file: any trailing
DOS end-of-file character will not be sent to the client.
If running as a Gopher server, a Gopher terminator line (just a
period) will be sent at the end of the document, before the
connection is closed.
-
NOCACHE -- prevents this FILE command being cached (that is, this
command will not be associated with a request). See "File command
cache" for more details.
Here are some examples:
-
Returning an HTML file to a Web client:
file type text/html name d:/gohttp/index.htm
-
Returning a temporary image file to a Web client:
file erase type image/gif name d:/gohttp/$7681.80
-
Returning a .ZIP file to a Gopher client:
file binary name d:/gogopher/gogopher.zip
Notes:
-
The filespec may not include an 'upwards reference' sequence ("..\"
or "../"), as such a sequence could possibly allow clients access
to any file on the server machine.
-
All data sent to a client with an HTTP header should be described
by a Content-Type field in the header; GoServe will therefore only
generate a header automatically if the TYPE option was specified or
the HEADER command has been used to add header lines. In this
latter case, it is the responsibility of the filter to supply the
Content-Type field if the TYPE option was not used.
-
Internet Media Types were formerly known as MIME (Multipurpose
Internet Mail Extensions) Content Types. MIME is described in RFC
1521 and RFC 1522. The media types are used in the HTTP protocol
so that clients can determine how to process data received from
servers. Some common types are listed in the sample filter.
[ previous section | GoServe | next section ]
From 'goserve.doc', version 2.32.
Copyright © International Business Machines Corporation, 1993, 1995.
All rights reserved.