INTEGRAL DSL Reference Guide
Jump directly to:
::my.app.SetHeaders(headers, compression = DV_COMPRESS_CONFIG)
The SetHeaders function attaches user-supplied HTTP headers to the INTEGRAL output buffer. INTEGRAL Web Server delivers user-supplied HTTP headers, in addition to its own HTTP headers, when sending the output buffer to the web client.
Additionally, the function can be used to set the compression method that INTEGRAL Web Server utilizes to serve the output buffer to the web client.
Parameters
headers
A string representing user-supplied HTTP headers.
compression
An integer that stipulates the compression method. See SetCompression for details.
Return Value
The function returns DV_RET_OK on success and DV_RET_ERR on failure.
- const DV_RET_ERR = 0 — failure
- const DV_RET_OK = 1 — success
Notes
This function can be called multiple times during a web session. However, it makes sense to call SetHeaders only once. This is because each call to SetHeaders discards any existing user-supplied headers. This means that only the most recent user-supplied headers remain attached to the INTEGRAL output buffer.
Example 1
::my.app.SetHeaders("Location: http://www.integral.ws/\r\n");
Example 2
::my.app.SetHeaders("Content-Disposition: attachment; filename=\"integral-website.zip\"\r\n");
Example 3
::my.app.SetHeaders("Content-Language: fr\r\nContent-Disposition: attachment; filename=\"document.txt\"\r\n", DV_COMPRESS_GZIP);