mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Add flag to HTTPRequest() for addl response data * Add ability to change status and headers in www scripts * Add tests for new webserver features * Update docs and core-changes
72 lines
3.4 KiB
XML
72 lines
3.4 KiB
XML
<?xml version='1.0' encoding="iso-8859-1"?>
|
|
<?xml-stylesheet type="text/xsl" href="escript.xslt" ?>
|
|
<!DOCTYPE ESCRIPT SYSTEM "escript.dtd">
|
|
<ESCRIPT>
|
|
<fileheader fname="HTTP.em">
|
|
<filedesc>Functions to send and receive data over an HTTP connection using POL's internal webserver. Scripts in /scripts/www are considered at the top level directory. I.e. http://192.168.0.5:8088/online.ecl </filedesc>
|
|
<filedesc>Scripts stored in packages can be retrieved by accessing /pkg/packagename/script.ecl I.e. http://127.0.0.1:8088/pkg/guild/guilds.ecl </filedesc>
|
|
<datemodified>02/06/2023</datemodified>
|
|
</fileheader>
|
|
|
|
<function name="WriteStatus">
|
|
<prototype>WriteStatus( code, reason := "" )</prototype>
|
|
<parameter name="code" value="Integer" />
|
|
<parameter name="reason" value="String" />
|
|
<explain>Writes the status code provided. If no reason provided, one will be calculated from the code (if possible). This can only used once before WriteHeader(), WriteHtml(), and WriteHtmlRaw().</explain>
|
|
<return>1 on success</return>
|
|
<error>"Socket is disconnected"</error>
|
|
<error>"Cannot send status after WriteStatus, WriteHeader, WriteHtml, or WriteHtmlRaw"</error>
|
|
<error>"Invalid parameter type"</error>
|
|
</function>
|
|
|
|
<function name="WriteHeader">
|
|
<prototype>WriteHeader( name, value )</prototype>
|
|
<parameter name="name" value="String" />
|
|
<parameter name="value" value="String" />
|
|
<explain>Writes the header provided. This function can be used to change the response's Content-Type from the default "text/html". This can only used before WriteHtml() and WriteHtmlRaw().</explain>
|
|
<return>1 on success</return>
|
|
<error>"Socket is disconnected"</error>
|
|
<error>"Cannot send headers after WriteHtml or WriteHtmlRaw"</error>
|
|
<error>"Invalid parameter type"</error>
|
|
</function>
|
|
|
|
<function name="WriteHtml">
|
|
<prototype>WriteHtml( html )</prototype>
|
|
<parameter name="html" value="String" />
|
|
<explain>Writes a line of HTML to the "virtual webpage" that will be sent to the connecting browser and appends a new-line.</explain>
|
|
<return>1 always</return>
|
|
<error>"Socket is disconnected"</error>
|
|
<error>"Invalid parameter type"</error>
|
|
</function>
|
|
|
|
<function name="WriteHtmlRaw">
|
|
<prototype>WriteHtmlRaw( html )</prototype>
|
|
<parameter name="html" value="String" />
|
|
<explain>Writes a line of HTML to the "virtual webpage" that will be sent to the connecting browser, does NOT append a new-line.</explain>
|
|
<return>1 always</return>
|
|
<error>"Socket is disconnected"</error>
|
|
<error>"Invalid parameter type"</error>
|
|
</function>
|
|
|
|
<function name="QueryParam">
|
|
<prototype>QueryParam( param )</prototype>
|
|
<parameter name="param" value="String" />
|
|
<explain>Query's the accessed URL for any embedded parameters. (see your favorite HTML docs for parameter embedding! :) )</explain>
|
|
<explain>Example: http://pol.server.com:8080/querytest.ecl?par=wibble&name=
|
|
<code>
|
|
QueryParam( "par" ) ---> "wibble"
|
|
QueryParam( "name" ) --> ""
|
|
QueryParam( "heat" ) --> 0 [integer]
|
|
</code></explain>
|
|
<return>String value of the embedded param, or 0 if not found.</return>
|
|
<error>"Invalid parameter type"</error>
|
|
</function>
|
|
|
|
<function name="QueryIP">
|
|
<prototype>QueryIP()</prototype>
|
|
<explain>returns the IP address of the connecting browser</explain>
|
|
<return>String IP address, i.e. "192.168.0.5"</return>
|
|
</function>
|
|
|
|
|
|
</ESCRIPT>
|