tiny_httpd/0.5/tiny_httpd/Tiny_httpd/Request/index.html
2020-03-25 23:28:33 -04:00

2 lines
No EOL
6.8 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Request (tiny_httpd.Tiny_httpd.Request)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc %%VERSION%%"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">tiny_httpd</a> &#x00BB; <a href="../index.html">Tiny_httpd</a> &#x00BB; Request</nav><h1>Module <code>Tiny_httpd.Request</code></h1></header><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> <span>'body t</span></code><code> = </code><code>{</code><table class="record"><tr id="type-t.meth" class="anchored"><td class="def field"><a href="#type-t.meth" class="anchor"></a><code>meth : <a href="../Meth/index.html#type-t">Meth.t</a>;</code></td></tr><tr id="type-t.host" class="anchored"><td class="def field"><a href="#type-t.host" class="anchor"></a><code>host : string;</code></td></tr><tr id="type-t.headers" class="anchored"><td class="def field"><a href="#type-t.headers" class="anchor"></a><code>headers : <a href="../Headers/index.html#type-t">Headers.t</a>;</code></td></tr><tr id="type-t.path" class="anchored"><td class="def field"><a href="#type-t.path" class="anchor"></a><code>path : string;</code></td></tr><tr id="type-t.body" class="anchored"><td class="def field"><a href="#type-t.body" class="anchor"></a><code>body : <span class="type-var">'body</span>;</code></td></tr></table><code>}</code></dt><dd><p>A request with method, path, host, headers, and a body, sent by a client.</p><p>The body is polymorphic because the request goes through several transformations. First it has no body, as only the request and headers are read; then it has a stream body; then the body might be entirely read as a string via <a href="index.html#val-read_body_full"><code>read_body_full</code></a>.</p></dd></dl><dl><dt class="spec value" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span class="keyword">val</span> pp : Format.formatter <span>&#45;&gt;</span> <span>string <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> unit</code></dt><dd><p>Pretty print the request and its body</p></dd></dl><dl><dt class="spec value" id="val-pp_"><a href="#val-pp_" class="anchor"></a><code><span class="keyword">val</span> pp_ : Format.formatter <span>&#45;&gt;</span> <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> unit</code></dt><dd><p>Pretty print the request without its body</p></dd></dl><dl><dt class="spec value" id="val-headers"><a href="#val-headers" class="anchor"></a><code><span class="keyword">val</span> headers : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="../Headers/index.html#type-t">Headers.t</a></code></dt><dd><p>List of headers of the request, including <code>&quot;Host&quot;</code></p></dd></dl><dl><dt class="spec value" id="val-get_header"><a href="#val-get_header" class="anchor"></a><code><span class="keyword">val</span> get_header : <span>?&#8288;f:<span>(string <span>&#45;&gt;</span> string)</span></span> <span>&#45;&gt;</span> <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span>string option</span></code></dt><dt class="spec value" id="val-get_header_int"><a href="#val-get_header_int" class="anchor"></a><code><span class="keyword">val</span> get_header_int : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span>int option</span></code></dt><dt class="spec value" id="val-set_header"><a href="#val-set_header" class="anchor"></a><code><span class="keyword">val</span> set_header : <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> string <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="index.html#type-t">t</a></span></code></dt><dt class="spec value" id="val-host"><a href="#val-host" class="anchor"></a><code><span class="keyword">val</span> host : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> string</code></dt><dd><p>Host field of the request. It also appears in the headers.</p></dd></dl><dl><dt class="spec value" id="val-meth"><a href="#val-meth" class="anchor"></a><code><span class="keyword">val</span> meth : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <a href="../Meth/index.html#type-t">Meth.t</a></code></dt><dd><p>Method for the request.</p></dd></dl><dl><dt class="spec value" id="val-path"><a href="#val-path" class="anchor"></a><code><span class="keyword">val</span> path : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> string</code></dt><dd><p>Request path.</p></dd></dl><dl><dt class="spec value" id="val-query"><a href="#val-query" class="anchor"></a><code><span class="keyword">val</span> query : <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(string * string)</span> list</span></code></dt><dd><p>Decode the query part of the <a href="index.html#type-t.path"><code>path</code></a> field</p><dl><dt>since</dt><dd>0.4</dd></dl></dd></dl><dl><dt class="spec value" id="val-body"><a href="#val-body" class="anchor"></a><code><span class="keyword">val</span> body : <span><span class="type-var">'b</span> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span class="type-var">'b</span></code></dt><dd><p>Request body, possibly empty.</p></dd></dl><dl><dt class="spec value" id="val-limit_body_size"><a href="#val-limit_body_size" class="anchor"></a><code><span class="keyword">val</span> limit_body_size : <span>max_size:int</span> <span>&#45;&gt;</span> <span><a href="../index.html#type-byte_stream">byte_stream</a> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><a href="../index.html#type-byte_stream">byte_stream</a> <a href="index.html#type-t">t</a></span></code></dt><dd><p>Limit the body size to <code>max_size</code> bytes, or return a <code>413</code> error.</p><dl><dt>since</dt><dd>0.3</dd></dl></dd></dl><dl><dt class="spec value" id="val-read_body_full"><a href="#val-read_body_full" class="anchor"></a><code><span class="keyword">val</span> read_body_full : <span><a href="../index.html#type-byte_stream">byte_stream</a> <a href="index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span>string <a href="index.html#type-t">t</a></span></code></dt><dd><p>Read the whole body into a string. Potentially blocking.</p></dd></dl></div></body></html>