kb:kb_articles:kb1018

INETAPI Routines (Web)

The INETAPI routines set the HTML header values returned by an OECGI3 request.  They can be used from inside either INET or O4W routines (so long as RUN_OECGI_REQUEST is defined as the OpenInsight "handler" for the connection).

INETAPI_SETCONTENTTYPE(<contenttype>)

Sets the MIME type for the returned HTML. <contenttype> is the desired content type for the returned HTML.  Examples include "text/html", "text/plain", or "image/jpeg"

INETAPI_SETNOCACHE(<cacheflag>)

Enables or disables the cacheing header in the returned HTML.  If <cacheflag> is "1", then any "no-cache" directives are removed from the header; if <cacheflag> is set to "0", then the returned document is set to "no cache" 

INETAPI_SETSTATUS(<statuscode>)

Sets the HTTP return status for the document.  Examples include "200" (ok), "204" (No content), and "301" (Moved permanently)

INETAPI_SETREDIRECT(<location>, <request>, <bAddPath>, <excluded>)

Adds information to the returned header instructing the client to redirect the request to a different URL.  Pass in the destination url as the <location> parameter.  Optionally provide the original (incoming) request from the client – this may be used to determine if the redirect should use the normal (http) or secure (https) protocol, and (when the <bAddPath> parameter is set to "1") to rebuild the incoming search string.   If the <bAddPath> parameter is set to "1", then the original (incoming) search string is appended to the destination url, with any parameters passed in the <exluded> list removed from the resulting url.

INETAPI_SETCOOKIE(<name>, <value>, <expdate>, <exptime>, <path>, <domain>, <httponly>, <secureflag>)

Sets the cookie named <name> to the value specified in <value>.  Note that the optional expdate and exptime (the expiration date and time for the cookie) should be passed in internal format.  The optional <path> parameter specifies the path from which the cookie should be returned (the default is "/", meaning any path under the cookie’s domain).  If desired, the <domain> can be set to the valid domain of this cookie (for example, ".example.com" will allow the cookie to be examined by all subdomains of example.com, including www.example.com, example.com, ftp.example.com, etc.).  Set the optional <httponly> parameter to "1" to instruct the browser that the cookie should only be available to the host, and not non-HTTP APIs (such as javascript).  Optionally set the <secure> parameter to "1" to instruct the browser this cookie should only be sent over secure (https://) protocol connections.

  • kb/kb_articles/kb1018.txt
  • Last modified: 2024/01/30 13:36
  • by 127.0.0.1