SEND command


Syntax:

  SEND [TYPE content-type] [BINARY|TEXT] [AS name]
  SEND COMPLETE

SEND and SEND COMPLETE are used to start and end a response which is composed of more than one piece of data. The response is started by the SEND command (without the COMPLETE keyword) and, if using HTTP, the HTTP header is sent at that point.

After a SEND command, the completion commands (FILE, VAR, STRING, etc.) no longer cause the response to be completed, nor do they have any HTML wrapper or HTTP header, etc., added. Instead, the plain data generated by the command (or the response to CLOSE or CONTROL, or nothing for NODATA) is sent to the client.

Following any data commands, SEND COMPLETE is used to indicate that the response is complete, and will write a 'C' audit line if the appropriate auditing is in effect (see "The audit mechanism").

SET NETBUFFER can be used to control whether data are buffered (collected into packets) before being sent or are sent immediately. NETBUFFER is ON by default.

The optional keywords on the SEND command to start the response may be specified in any order, and have the following effects:

Here is an example of returning an HTML document to a Web client, including a file in the middle.

  /* This is Rexx code */
  'send type text/html as MultiDoc'
  'string <!doctype html public "-//IETF//DTD HTML 2.0//EN">'
  'string <html><head><title>Multiple...</title></head>'
  'string <body><h2>Here is a test file:</h2><hr>'
  'file name test.dat'
  'string <hr></body></html>'
  'send complete'               /* complete and audit the send */

See GOFILTER.80 for an example of a more dynamic document, in the DOPUSH function.

Notes:

  1. 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.
  2. The TYPE and AS options are associated with the SEND command, not the included data (as the header is sent immediately). Therefore, TYPE and AS are not allowed on the FILE or VAR commands once SEND has been used.
  3. BINARY and TEXT are, however, permitted on FILE and VAR after a SEND (for example, a file included may be a text file with a trailing DOS end-of-file character, and another might be binary). A gopher server will add a terminating period line only if the most recent specification was TEXT (on SEND, FILE, or VAR).
  4. A 'C' audit line indicates normal completion (see "The audit mechanism"), and once SEND has been used it is only written when SEND COMPLETE is executed. If no SEND COMPLETE is executed. GoServe will close the connection automatically, but no 'C' audit line will be written.

[ previous section | contents | next section ]

From 'goserve.doc', version 2.50.
Copyright © IBM Corporation, 1993, 1997. All rights reserved.