%HTTP_SERVER_SEND

Send a response to a client

WTSupported in traditional Synergy on Windows

 

USupported on UNIX
VSupported on OpenVMS
status = %HTTP_SERVER_SEND(instance_id, status, reason, handle, length, error, [headers], 
&      [log_file], [version][, dont_close])

Return value

status

One of the following values:

0 = Successful

error_number = The number of the error that occurred (not successful)

Arguments

instance_id

The ID of the created instance of a Synergy HTTP or HTTPS server, returned by %HTTP_SERVER_CREATE. (n)

status

The HTTP status code for the response message. (n)

reason

The HTTP reason code associated with the status code. (a)

handle

The static memory handle of the returned document. (D_HANDLE)

length

The length of the returned document. (n)

error

Returned with an error message if status is nonzero. Otherwise, it is blank. (a)

headers

(optional) An array of one or more HTTP header strings. Each string has the form header_name[:value]. ([*]a)

log_file

(optional) The name and location of a log file to log HTTP packet contents. (a)

version

(optional) A string that contains the HTTP version number to be placed in the document header. The default version number is 1.0. (a)

dont_close

(optional) If passed and nonzero, do not close the socket when %HTTP_SERVER_SEND completes successfully. (n)

Discussion

Every time a client makes a request, a response is required. The %HTTP_SERVER_SEND method sends a response back to the client.

Status and reason must be of valid HTTP types. Standard status codes are numbered as follows:

100 ‑ 199

Informational codes

200 ‑ 299

Successful codes

300 ‑ 399

Redirection codes

400 ‑ 499

Client error codes

500 ‑ 599

Server error codes

For your convenience, the most common status and reason codes are defined in the synxml.def file.

If handle and length have a length of zero, the response HTTP message will not contain a body.

If you send valid handle and length arguments, you are responsible for freeing any memory allocated by this routine.

The headers argument enables a Synergy HTTP or HTTPS server to add or modify HTTP headers in its response message.

Passing a log_file causes the HTTP response packet to be logged to the specified file. This logging feature is available primarily for debugging purposes. Logs of a response packet include the HTTP version, status, reason, all HTTP headers, and the body of the HTTP packet. Log entries are always appended to an existing log file. If the log file does not exist, it is created. A log file can only be created on a local drive; remote drives are not supported.

Examples

See %HTTP_SERVER_CREATE Examples.