NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

# ns_adp_ctl(n) 4.99.8 naviserver "NaviServer Built-in Commands"

## Name

ns_adp_ctl - ADP control command

## Table Of Contents

## Synopsis

- ns_adp_ctl autoabort ?bool?
- ns_adp_ctl bufsize ?size?
- ns_adp_ctl cache ?bool?
- ns_adp_ctl channel ?chan?
- ns_adp_ctl detailerror ?bool?
- ns_adp_ctl displayerror ?bool?
- ns_adp_ctl expire ?bool?
- ns_adp_ctl safe ?bool?
- ns_adp_ctl singlescript ?bool?
- ns_adp_ctl stream ?bool?
- ns_adp_ctl stricterror ?bool?
- ns_adp_ctl trace ?bool?
- ns_adp_ctl trimspace ?bool?

## Description

This command enables control of the current ADP execution environment. Aside from the bufsize and chan subcommands, they all return a boolean value for a given ADP option. If the bool argument is given, the option is set to the given value and the previous value is returned.

## COMMANDS

ns_adp_ctl autoabort ?bool?
ns_adp_ctl bufsize ?size?
ns_adp_ctl cache ?bool?
ns_adp_ctl channel ?chan?
ns_adp_ctl detailerror ?bool?
ns_adp_ctl displayerror ?bool?
ns_adp_ctl expire ?bool?
ns_adp_ctl safe ?bool?
ns_adp_ctl singlescript ?bool?
ns_adp_ctl stream ?bool?
ns_adp_ctl stricterror ?bool?
ns_adp_ctl trace ?bool?
ns_adp_ctl trimspace ?bool?

  bufsize This command returns the currently ADP output buffer size, setting it to a new value if the optionial size argument is specified.

  channel This command is used to specify an open file channel to receive output when the buffer is flushed. If channel is the null string, the output channel is cleared. This capability can be useful for specialized uses of ADP outside the context of an HTTP connection, e.g., for debugging or testing. Use an empty argument to reset the channel.

  autoabort Query or set the autoabort option. When enabled, failure to flush a buffer (normally the result of a closed HTTP connection) generates an ADP exception, unwinding the ADP call stack.

  detailerror Query or set the detailerror option. When enabled, errors in ADP pages are formatted with information about the context of the HTTP request. This can be very helpful in debugging ADP errors but potentially a security risk if the HTTP context (e.g., cookie headers) contains personal or sensitive data. Errors are logged to the server log and, if displayerror is enabled, appened to the output buffer.

  displayerror Query or set the displayerror option. When enabled, errors in ADP pages are formatted and appended to the output stream, normally visiable to a user's browser. This option should generally be enabled in development and disabled in production.

  expire Query or set the expire option. When enabled, the ADP request processing code adds an "Expires: now" header in the response buffer to disable any caching. In practice, more thoughtful cache control mechanisms should be used based on the HTTP/1.1 spec.

  cache Query or set the cache option. When disabled, all requests to cache executed ADP blocks via the ns_adp_include -cache directive are ignored, resulting in normal execution of all code.

  safe Query or set the safe option. When enabled, all code is executed in safe mode, disabling and ignoring any code within registered tags.

  singlescript Query or set the singlescript option. When enabled, ADP pages are converted from independent text-script blocks into a single script, which text blocks replaced with a call to ns_adp_append with the given text. Functionally the output is the same however an error anywhere on the page will result in the entire ADP page returning instead of skipping to the next block which is the normal behavior. In practice, singlescript is useful in development while in production leaving it disabled provides a more defensive execution environment where minor errors in one ADP do not inhibit execution of the overall page.

  stream Query or set the streaming option. When enabled, partial adp-outputs are returned to the user as soon as possible via chunked encoding.

  stricterror Query or set the stricterror option. When enabled, the result is similar to that of singlescript in that an error in a particular block will return the entire page instead of continuing to the next text or script block.

  trace Query or set the trace option which currently does nothing.

  trimspace Query or set the trimspace option. When enabled, any white space at the start of the output buffer is eliminated. White space can show up in the output as a result of ADP pages which do nothing but include other ADPs in a way to reuse code with the unfortunate side effect of the training newline at the end of a <% ns_adp_include myfile.adp %> ending up in the output stream.

## See Also

ns_adp, ns_adp_abort, ns_adp_break, ns_adp_close, ns_adp_ctl, ns_adp_dump, ns_adp_flush, ns_adp_mimetype, ns_adp_return, ns_adp_stream, ns_conn

## Keywords

ADP