mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2026-01-24 02:16:40 -05:00
2 lines
No EOL
6.8 KiB
HTML
2 lines
No EOL
6.8 KiB
HTML
<!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> » <a href="../index.html">Tiny_httpd</a> » 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>-></span> <span>string <a href="index.html#type-t">t</a></span> <span>-></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>-></span> <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>-></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>-></span> <a href="../Headers/index.html#type-t">Headers.t</a></code></dt><dd><p>List of headers of the request, including <code>"Host"</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>?⁠f:<span>(string <span>-></span> string)</span></span> <span>-></span> <span><span class="type-var">_</span> <a href="index.html#type-t">t</a></span> <span>-></span> string <span>-></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>-></span> string <span>-></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>-></span> string <span>-></span> string <span>-></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>-></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>-></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>-></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>-></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>-></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>-></span> <span><a href="../index.html#type-byte_stream">byte_stream</a> <a href="index.html#type-t">t</a></span> <span>-></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>-></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> |