This commit is contained in:
c-cube 2024-04-02 18:38:30 +00:00
parent 41b8b9cb93
commit 03fb94100d
2 changed files with 4 additions and 6 deletions

View file

@ -1,7 +1,5 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>UPGRADE_HANDLER (tiny_httpd.Tiny_httpd_core.Server.UPGRADE_HANDLER)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../../index.html">tiny_httpd</a> &#x00BB; <a href="../../index.html">Tiny_httpd_core</a> &#x00BB; <a href="../index.html">Server</a> &#x00BB; UPGRADE_HANDLER</nav><header class="odoc-preamble"><h1>Module type <code><span>Server.UPGRADE_HANDLER</span></code></h1><p>Handler that upgrades to another protocol.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> NEXT_RELEASE</li></ul></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-handshake_state"><a href="#type-handshake_state" class="anchor"></a><code><span><span class="keyword">type</span> handshake_state</span></code></div><div class="spec-doc"><p>Some specific state returned after handshake</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-name"><a href="#val-name" class="anchor"></a><code><span><span class="keyword">val</span> name : string</span></code></div><div class="spec-doc"><p>Name in the &quot;upgrade&quot; header</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-handshake"><a href="#val-handshake" class="anchor"></a><code><span><span class="keyword">val</span> handshake : <span><span>unit <a href="../../Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<a href="../../Headers/index.html#type-t">Headers.t</a> * <a href="#type-handshake_state">handshake_state</a>, string)</span> <a href="../../../../ocaml/Stdlib/index.html#type-result">result</a></span></span></code></div><div class="spec-doc"><p>Perform the handshake and upgrade the connection. The returned code is <code>101</code> alongside these headers. In case the handshake fails, this only returns <code>Error log_msg</code>. The connection is closed without further ado.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-handle_connection"><a href="#val-handle_connection" class="anchor"></a><code><span><span class="keyword">val</span> handle_connection :
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>UPGRADE_HANDLER (tiny_httpd.Tiny_httpd_core.Server.UPGRADE_HANDLER)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../../../index.html">tiny_httpd</a> &#x00BB; <a href="../../index.html">Tiny_httpd_core</a> &#x00BB; <a href="../index.html">Server</a> &#x00BB; UPGRADE_HANDLER</nav><header class="odoc-preamble"><h1>Module type <code><span>Server.UPGRADE_HANDLER</span></code></h1><p>Handler that upgrades to another protocol.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> NEXT_RELEASE</li></ul></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-handshake_state"><a href="#type-handshake_state" class="anchor"></a><code><span><span class="keyword">type</span> handshake_state</span></code></div><div class="spec-doc"><p>Some specific state returned after handshake</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-name"><a href="#val-name" class="anchor"></a><code><span><span class="keyword">val</span> name : string</span></code></div><div class="spec-doc"><p>Name in the &quot;upgrade&quot; header</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-handshake"><a href="#val-handshake" class="anchor"></a><code><span><span class="keyword">val</span> handshake :
<span><a href="../../../../ocaml/Unix/index.html#type-sockaddr">Unix.sockaddr</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="#type-handshake_state">handshake_state</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../IO/Input/class-type-t/index.html">IO.Input.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../IO/Output/class-type-t/index.html">IO.Output.t</a> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p>Take control of the connection and take it from ther.e</p></div></div></div></body></html>
<span><span>unit <a href="../../Request/index.html#type-t">Request.t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<a href="../../Headers/index.html#type-t">Headers.t</a> * <a href="#type-handshake_state">handshake_state</a>, string)</span> <a href="../../../../ocaml/Stdlib/index.html#type-result">result</a></span></span></code></div><div class="spec-doc"><p>Perform the handshake and upgrade the connection. This returns either <code>Ok (resp_headers, state)</code> in case of success, in which case the server sends a <code>101</code> response with <code>resp_headers</code>; or it returns <code>Error log_msg</code> if the the handshake fails, in which case the connection is closed without further ado and <code>log_msg</code> is logged locally (but not returned to the client).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-handle_connection"><a href="#val-handle_connection" class="anchor"></a><code><span><span class="keyword">val</span> handle_connection : <span><a href="#type-handshake_state">handshake_state</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../IO/Input/class-type-t/index.html">IO.Input.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../../IO/Output/class-type-t/index.html">IO.Output.t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div><div class="spec-doc"><p>Take control of the connection and take it from ther.e</p></div></div></div></body></html>

View file

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Tiny_httpd_ws (tiny_httpd.Tiny_httpd_ws)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta name="generator" content="odoc 2.4.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../index.html">tiny_httpd</a> &#x00BB; Tiny_httpd_ws</nav><header class="odoc-preamble"><h1>Module <code><span>Tiny_httpd_ws</span></code></h1><p>Websockets for Tiny_httpd.</p><p>This sub-library (<code>tiny_httpd.ws</code>) exports a small implementation for a websocket server. It has no additional dependencies.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-handler"><a href="#type-handler" class="anchor"></a><code><span><span class="keyword">type</span> handler</span><span> =
<span><a href="../../ocaml/Unix/index.html#type-sockaddr">Unix.sockaddr</a> <span class="arrow">&#45;&gt;</span></span>
<span><span>unit <a href="../Tiny_httpd_core/Request/index.html#type-t">Tiny_httpd_core.Request.t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Tiny_httpd_core/IO/Input/class-type-t/index.html">Tiny_httpd_core.IO.Input.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Tiny_httpd_core/IO/Output/class-type-t/index.html">Tiny_httpd_core.IO.Output.t</a> <span class="arrow">&#45;&gt;</span></span>
unit</span></code></div><div class="spec-doc"><p>Websocket handler</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-upgrade"><a href="#val-upgrade" class="anchor"></a><code><span><span class="keyword">val</span> upgrade :