VAR command
Syntax:
VAR [TYPE content-type] [BINARY|TEXT] [AS name] NAME varname
The contents of the Rexx variable named by 'varname' will be sent to the
client. 'varname' is a symbolic name, as it would be written in the
filter, and should be no more than 50 characters long. The variable
named must have been assigned a value, or an error will be returned.
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:
-
TYPE -- [HTTP protocol only] the data will be prefixed by an HTTP
"OK" response line and an HTTP header, including the length of the
variable. The value of the TYPE option ('content-type') should be a
Internet Media Type such as "text/html" or "image/gif". See the
notes under "FILE command" 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 data are binary, and forms the
entire response to the client. GoServe will close the TCP/IP
connection to indicate that all the data have been sent.
A Gopher server should use this option for all data that are not
simple text or menus.
-
TEXT -- [default for Gopher] the data is text. 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.
-
AS -- the 'name' given should be used in the audit file instead of
the name of the variable. This can be used to create a more
meaningful audit record when (for example) the variable contains a
modified version of a file. The 'name' may be up to 50 characters
long.
Here are some examples (see also GOREMOTE.80):
-
Returning an HTML document to a Web client:
/* This is Rexx code */
doc='<html> .... </html>' /* may be large */
'var type text/html name doc' /* return the data */
return
-
Returning some binary data to a Web client:
/* This is Rexx code */
data='001122334455'x /* may be large, '00'x is OK */
'var type application/octet-stream name data' /* this sends it */
return
Notes:
-
The filter must be active when the VAR command is executed (or the
variable will not exist). Therefore this command cannot be passed
back to the server by a RETURN instruction for later execution.
-
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.
[ previous section | GoServe | next section ]
From 'goserve.doc', version 2.32.
Copyright © International Business Machines Corporation, 1993, 1995.
All rights reserved.