@ciao-lang/ts-ciao-interface
Version:
Simple Ciao interface for node.
34 lines • 10.8 kB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="theme-color" content="#273f79"/><link rel="stylesheet" href="lpdoc.css" type="text/css"/><script type="text/javascript" src="lpdoc.js"></script><title>CGI programming — The Ciao System v1.22</title></head><body><div class="lpdoc-page fixleftbar"><a href="#" id="sidebar-toggle-button" class="lpdoc-navbutton"><span id="sidebar-button-arrow">☰</span></a><div id="sidebar" class="lpdoc-sidebar"><div style="height: 40px; margin-left: auto; margin-right: auto"><img src="ciao-logo_autofig.png" width=auto height=100%></div><div class="lpdoc-nav"><span class="lpdoc-on-right"><a class="lpdoc-navbutton" href="http_doc.html">↑</a><a class="lpdoc-navbutton" href="http_forms.html">←</a><a class="lpdoc-navbutton" href="http_messages.html">→</a><a class="lpdoc-navbutton" href="ciaosearch.html">🔍</a></span><span><a href="ciaofulltoc.html">TOC</a></span></div><hr></hr><ul class="lpdoc-itemize-sectpath"><li><a href="ciao.html">The Ciao System</a> »<br/> </li><li><a href="ExtraLibs.html">PART VIII - Additional libraries</a> »<br/> </li><li><a href="http_doc.html">HTTP client/server libraries</a> »<br/> </li><li><a href=""><strong>CGI programming</strong></a></li></ul><hr></hr><em>ON THIS PAGE</em><ul><li><a href="#Usage and interface">Usage and interface</a></li><li><a href="#Documentation on exports">Documentation on exports</a></li><li><a href="#Documentation on multifiles">Documentation on multifiles</a></li><li><a href="#Documentation on imports">Documentation on imports</a></li></ul></div><div class="lpdoc-main"><div id=""><h1>CGI programming</h1><a class="lpdoc-idx-anchor" href="ciaosearch.html#cgi"></a>
<strong>Author(s):</strong> <a class="lpdoc-idx-anchor" id="The Ciao Development Team" href="ciaosearch.html#The Ciao Development Team">The Ciao Development Team</a>.<p>
<p>This module implements the predicates for <a class="lpdoc-idx-anchor" id="0" href="ciaosearch.html#CGI">CGI</a> processes. It is based on translating the CGI environment to HTTP request terms (see <a class="lpdoc-idx-anchor" id="1" href="ciaosearch.html#http/http_server"><tt>http/http_server</tt></a>).<br/><div id="Usage and interface"><h2>Usage and interface</h2><div class="lpdoc-cartouche"><ul><li><strong>Library usage:</strong><br/><tt>:- use_module(library(http/cgi)).</tt><li><strong>Exports:</strong><br/><ul class="lpdoc-itemize-minus"><li><em>Predicates:</em><br/><a class="lpdoc-idx-anchor" id="2" href="#cgi_read_request/1"><tt>cgi_read_request/1</tt></a>, <a class="lpdoc-idx-anchor" id="3" href="#my_url/1"><tt>my_url/1</tt></a>, <a class="lpdoc-idx-anchor" id="4" href="#set_cookie/2"><tt>set_cookie/2</tt></a>, <a class="lpdoc-idx-anchor" id="5" href="#get_cookies/1"><tt>get_cookies/1</tt></a>, <a class="lpdoc-idx-anchor" id="6" href="#cgi_write_response/1"><tt>cgi_write_response/1</tt></a>.
<li><em>Multifiles:</em><br/><a class="lpdoc-idx-anchor" id="7" href="tokenize.html#define_flag/3"><tt>define_flag/3</tt></a>.
</ul></ul></div></div><div id="Documentation on exports"><h2>Documentation on exports</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="cgi_read_request/1" href="ciaosearch.html#cgi_read_request/1">cgi_read_request/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>cgi_read_request(Request)</tt>
</span><p>Obtain a HTTP request from the CGI environment variables (for headers) and input stream data (for contents). This request can be processed with other predicates in the <a class="lpdoc-idx-anchor" id="8" href="http_server.html"><tt>http_server</tt></a> libraries.</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="my_url/1" href="ciaosearch.html#my_url/1">my_url/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>my_url(URL)</tt>
</span><p>Unifies <span class="lpdoc-var">URL</span> with the Uniform Resource Locator (WWW address) of this cgi executable.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>Call and exit should be compatible with:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="9" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">URL</span> is a string (a list of character codes).
</span>
<li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="10" href="basic_props.html#string/1"><tt>basic_props:string/1</tt></a>)</span><span><span class="lpdoc-var">URL</span> is a string (a list of character codes).
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="set_cookie/2" href="ciaosearch.html#set_cookie/2">set_cookie/2</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>set_cookie(Name,Value)</tt>
</span><p>Sets a cookie of name <span class="lpdoc-var">Name</span> and value <span class="lpdoc-var">Value</span> (it must be called before <a class="lpdoc-idx-anchor" id="11" href="#cgi_write_response/1"><tt>cgi_write_response/1</tt></a>)<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="12" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Name</span> is an atom.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="13" href="basic_props.html#constant/1"><tt>basic_props:constant/1</tt></a>)</span><span><span class="lpdoc-var">Value</span> is an atomic term (an atom or a number).
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="get_cookies/1" href="ciaosearch.html#get_cookies/1">get_cookies/1</a></div><div class="lpdoc-deftext"><span class="lpdoc-usage-decl"><tt>get_cookies(Cookies)</tt>
</span><p>Unifies <span class="lpdoc-var">Cookies</span> with a dictionary of <em>attribute</em>=<em>value</em> pairs of the active cookies for this URL. If the flag <tt>raw_form_values</tt> is <tt>on</tt>, <em>value</em>s are always atoms even if they could be interpreted as numbers.<p><span class="lpdoc-usage-header">Usage:</span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties should hold at call time:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="14" href="term_typing.html#var/1"><tt>term_typing:var/1</tt></a>)</span><span><span class="lpdoc-var">Cookies</span> is a free variable.
</span>
<li><em>The following properties should hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="15" href="http_forms.html#value_dict/1"><tt>http_forms:value_dict/1</tt></a>)</span><span><span class="lpdoc-var">Cookies</span> is a dictionary of values. It is a list of pairs <em>atom</em>=<em>constant</em>.
</span>
</ul></div></div><p>
<div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="cgi_write_response/1" href="ciaosearch.html#cgi_write_response/1">cgi_write_response/1</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>cgi_write_response(Response)</tt>
</span><p>Writes the CGI response (similar to a HTTP response but sent through stdout)</p><ul class="lpdoc-itemize-minus"></ul></div></div><p>
</div><div id="Documentation on multifiles"><h2>Documentation on multifiles</h2><div><div class="lpdoc-defname"><span class="lpdoc-predtag">PREDICATE</span><a class="lpdoc-idx-anchor" id="define_flag/3" href="ciaosearch.html#define_flag/3">define_flag/3</a></div><div class="lpdoc-deftext"><p><span class="lpdoc-usage-header">Usage:</span><span class="lpdoc-usage-decl"><tt>define_flag(Flag,FlagValues,Default)</tt>
</span><p></p><ul class="lpdoc-itemize-minus"><li><em>The following properties hold upon exit:</em><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="16" href="basic_props.html#atm/1"><tt>basic_props:atm/1</tt></a>)</span><span><span class="lpdoc-var">Flag</span> is an atom.
</span><br/><span class="lpdoc-on-right"> (<a class="lpdoc-idx-anchor" id="17" href="basic_props.html#flag_values/1"><tt>basic_props:flag_values/1</tt></a>)</span><span>Define the valid flag values
</span>
</ul>
The predicate is <em>multifile</em>.<br/></div></div><p>
</div><div id="Documentation on imports"><h2>Documentation on imports</h2>This module has the following direct dependencies:<ul class="lpdoc-itemize-minus"><li><em>System library modules:</em><br/><a class="lpdoc-idx-anchor" id="18" href="strings.html"><tt>strings</tt></a>, <a class="lpdoc-idx-anchor" id="19" href="stream_utils.html"><tt>stream_utils</tt></a>, <a class="lpdoc-idx-anchor" id="20" href="lists.html"><tt>lists</tt></a>, <a class="lpdoc-idx-anchor" id="21" href="system.html"><tt>system</tt></a>, <a class="lpdoc-idx-anchor" id="22" href="http_grammar.html"><tt>http_grammar</tt></a>, <a class="lpdoc-idx-anchor" id="23" href="http_forms.html"><tt>http_forms</tt></a>, <a class="lpdoc-idx-anchor" id="24" href="ciaosearch.html#multipart_form_data"><tt>multipart_form_data</tt></a>, <a class="lpdoc-idx-anchor" id="25" href="http_messages.html"><tt>http_messages</tt></a>.
<li><em>Packages:</em><br/><a class="lpdoc-idx-anchor" id="26" href="ciaosearch.html#prelude"><tt>prelude</tt></a>, <a class="lpdoc-idx-anchor" id="27" href="ciaosearch.html#initial"><tt>initial</tt></a>, <a class="lpdoc-idx-anchor" id="28" href="condcomp_doc.html"><tt>condcomp</tt></a>, <a class="lpdoc-idx-anchor" id="29" href="assertions_doc.html"><tt>assertions</tt></a>, <a class="lpdoc-idx-anchor" id="30" href="ciaosearch.html#assertions/assertions_basic"><tt>assertions/assertions_basic</tt></a>, <a class="lpdoc-idx-anchor" id="31" href="isomodes_doc.html"><tt>isomodes</tt></a>, <a class="lpdoc-idx-anchor" id="32" href="dcg_doc.html"><tt>dcg</tt></a>, <a class="lpdoc-idx-anchor" id="33" href="ciaosearch.html#hiord"><tt>hiord</tt></a>, <a class="lpdoc-idx-anchor" id="34" href="doccomments_doc.html"><tt>doccomments</tt></a>, <a class="lpdoc-idx-anchor" id="35" href="ciaosearch.html#define_flag"><tt>define_flag</tt></a>.
</ul></div></div><div class="lpdoc-footer">Generated with LPdoc using Ciao</div></div><div class="lpdoc-clearer"></div></div></body></html>