summaryrefslogtreecommitdiffstats
path: root/docs/en/cowboy/2.8/manual/cowboy_stream
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-05-26 09:54:54 +0200
committerLoïc Hoguin <[email protected]>2020-05-26 09:54:54 +0200
commit849fab7227a2fd1ff5fa4d603ba89037e1c462b4 (patch)
treeb5d229ee98fd8b8db0bafb5b1a4a09c0dd0e40fc /docs/en/cowboy/2.8/manual/cowboy_stream
parent94e004a6582bfc46e6082bcbe62fad99d277978b (diff)
downloadninenines.eu-849fab7227a2fd1ff5fa4d603ba89037e1c462b4.tar.gz
ninenines.eu-849fab7227a2fd1ff5fa4d603ba89037e1c462b4.tar.bz2
ninenines.eu-849fab7227a2fd1ff5fa4d603ba89037e1c462b4.zip
Cowboy 2.8.0
Diffstat (limited to 'docs/en/cowboy/2.8/manual/cowboy_stream')
-rw-r--r--docs/en/cowboy/2.8/manual/cowboy_stream/index.html435
1 files changed, 435 insertions, 0 deletions
diff --git a/docs/en/cowboy/2.8/manual/cowboy_stream/index.html b/docs/en/cowboy/2.8/manual/cowboy_stream/index.html
new file mode 100644
index 00000000..cf14055b
--- /dev/null
+++ b/docs/en/cowboy/2.8/manual/cowboy_stream/index.html
@@ -0,0 +1,435 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta name="description" content="">
+ <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara">
+
+ <title>Nine Nines: cowboy_stream(3)</title>
+
+ <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' rel='stylesheet' type='text/css'>
+ <link href="/css/99s.css?r=7" rel="stylesheet">
+
+ <link rel="shortcut icon" href="/img/ico/favicon.ico">
+ <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/img/ico/apple-touch-icon-114.png">
+ <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/img/ico/apple-touch-icon-72.png">
+ <link rel="apple-touch-icon-precomposed" href="/img/ico/apple-touch-icon-57.png">
+
+
+</head>
+
+
+<body class="">
+ <header id="page-head">
+ <div id="topbar" class="container">
+ <div class="row">
+ <div class="span2">
+ <h1 id="logo"><a href="/" title="99s">99s</a></h1>
+ </div>
+ <div class="span10">
+
+ <div id="side-header">
+ <nav>
+ <ul>
+ <li><a title="Hear my thoughts" href="/articles">Articles</a></li>
+ <li><a title="Watch my talks" href="/talks">Talks</a></li>
+ <li class="active"><a title="Read the docs" href="/docs">Documentation</a></li>
+ <li><a title="Request my services" href="/services">Consulting & Training</a></li>
+ </ul>
+ </nav>
+ <ul id="social">
+ <li>
+ <a href="https://github.com/ninenines" title="Check my Github repositories"><img src="/img/ico_github.png" data-hover="/img/ico_github_alt.png" alt="Github"></a>
+ </li>
+ <li>
+ <a title="Contact me" href="mailto:[email protected]"><img src="/img/ico_mail.png" data-hover="/img/ico_mail_alt.png"></a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+</header>
+
+<div id="contents" class="two_col">
+<div class="container">
+<div class="row">
+<div id="docs" class="span9 maincol">
+
+<h1 class="lined-header"><span>cowboy_stream(3)</span></h1>
+
+<h2 id="_name">Name</h2>
+<p>cowboy_stream - Stream handlers</p>
+<h2 id="_description">Description</h2>
+<p>The module <code>cowboy_stream</code> defines a callback interface and a protocol for handling HTTP streams.</p>
+<p>An HTTP request and its associated response is called a stream. A connection may have many streams. In HTTP/1.1 they are executed sequentially, while in HTTP/2 they are executed concurrently.</p>
+<p>Cowboy calls the stream handler for nearly all events related to a stream. Exceptions vary depending on the protocol.</p>
+<p>Extra care must be taken when implementing stream handlers to ensure compatibility. While some modification of the events and commands is allowed, it is generally not a good idea to completely discard them.</p>
+<h2 id="_callbacks">Callbacks</h2>
+<p>Stream handlers must implement the following interface:</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><b><font color="#000000">init</font></b>(<font color="#009900">StreamID</font>, <font color="#009900">Req</font>, <font color="#009900">Opts</font>) <font color="#990000">-&gt;</font> {<font color="#009900">Commands</font>, <font color="#009900">State</font>}
+<b><font color="#000000">data</font></b>(<font color="#009900">StreamID</font>, <font color="#009900">IsFin</font>, <font color="#009900">Data</font>, <font color="#009900">State</font>) <font color="#990000">-&gt;</font> {<font color="#009900">Commands</font>, <font color="#009900">State</font>}
+<b><font color="#000000">info</font></b>(<font color="#009900">StreamID</font>, <font color="#009900">Info</font>, <font color="#009900">State</font>) <font color="#990000">-&gt;</font> {<font color="#009900">Commands</font>, <font color="#009900">State</font>}
+<b><font color="#000000">terminate</font></b>(<font color="#009900">StreamID</font>, <font color="#009900">Reason</font>, <font color="#009900">State</font>) <font color="#990000">-&gt;</font> <b><font color="#000000">any</font></b>()
+<b><font color="#000000">early_error</font></b>(<font color="#009900">StreamID</font>, <font color="#009900">Reason</font>, <font color="#009900">PartialReq</font>, <font color="#009900">Resp</font>, <font color="#009900">Opts</font>) <font color="#990000">-&gt;</font> <font color="#009900">Resp</font>
+
+<font color="#009900">StreamID</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_stream:streamid</font></b>()
+<font color="#009900">Req</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_req:req</font></b>()
+<font color="#009900">Opts</font> <font color="#990000">::</font> <b><font color="#000000">cowboy:opts</font></b>()
+<font color="#009900">Commands</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_stream:commands</font></b>()
+<font color="#009900">State</font> <font color="#990000">::</font> <b><font color="#000000">any</font></b>()
+<font color="#009900">IsFin</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_stream:fin</font></b>()
+<font color="#009900">Data</font> <font color="#990000">::</font> <b><font color="#000080">binary</font></b>()
+<font color="#009900">Info</font> <font color="#990000">::</font> <b><font color="#000000">any</font></b>()
+<font color="#009900">Reason</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_stream:reason</font></b>()
+<font color="#009900">PartialReq</font> <font color="#990000">-</font> <b><font color="#000000">cowboy_req:req</font></b>(), <font color="#FF6600">except</font> <font color="#FF6600">all</font> <font color="#FF6600">fields</font> <font color="#FF6600">are</font> <font color="#FF6600">optional</font>
+<font color="#009900">Resp</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_stream:resp_command</font></b>()</tt></pre>
+</div></div>
+<p>HTTP/1.1 will initialize a stream only when the request-line and all headers have been received. When errors occur before that point Cowboy will call the callback <code>early_error/5</code> with a partial request, the error reason and the response Cowboy intends to send. All other events go throuh the stream handler using the normal callbacks.</p>
+<p>HTTP/2 will initialize the stream when the <code>HEADERS</code> block has been fully received and decoded. Any protocol error occuring before that will not result in a response being sent and will therefore not go through the stream handler. In addition Cowboy may terminate streams without sending an HTTP response back.</p>
+<p>The stream is initialized by calling <code>init/3</code>. All streams that are initialized will eventually be terminated by calling <code>terminate/3</code>.</p>
+<p>When Cowboy receives data for the stream it will call <code>data/4</code>. The data given is the request body after any transfer decoding has been applied.</p>
+<p>When Cowboy receives a message addressed to a stream, or when Cowboy needs to inform the stream handler that an internal event has occurred, it will call <code>info/3</code>.</p>
+<h2 id="commands">Commands</h2>
+<p>Stream handlers can return a list of commands to be executed from the <code>init/3</code>, <code>data/4</code> and <code>info/3</code> callbacks. In addition, the <code>early_error/5</code> callback must return a response command.</p>
+<!-- @todo The logger option and the {log, Level, Format, Args}-->
+<!-- options need to be documented and tested.-->
+<p>The following commands are defined:</p>
+<h3 id="inform_command">inform</h3>
+<p>Send an informational response to the client.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">inform</font>, <b><font color="#000000">cowboy:http_status</font></b>(), <b><font color="#000000">cowboy:http_headers</font></b>()}</tt></pre>
+</div></div>
+<p>Any number of informational responses may be sent, but only until the final response is sent.</p>
+<h3 id="response_command">response</h3>
+<p>Send a response to the client.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">response</font>, <b><font color="#000000">cowboy:http_status</font></b>(), <b><font color="#000000">cowboy:http_headers</font></b>(),
+ <b><font color="#000000">cowboy_req:resp_body</font></b>()}</tt></pre>
+</div></div>
+<p>No more data can be sent after this command.</p>
+<p>Note that in Cowboy it is the <code>cowboy_req</code> module that sets the date and server headers. When using the command directly those headers will not be added.</p>
+<h3 id="headers_command">headers</h3>
+<p>Initiate a response to the client.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">headers</font>, <b><font color="#000000">cowboy:http_status</font></b>(), <b><font color="#000000">cowboy:http_headers</font></b>()}</tt></pre>
+</div></div>
+<p>This initiates a response to the client. The stream will end when a data command with the <code>fin</code> flag or a trailer command is returned.</p>
+<p>Note that in Cowboy it is the <code>cowboy_req</code> module that sets the date and server headers. When using the command directly those headers will not be added.</p>
+<h3 id="data_command">data</h3>
+<p>Send data to the client.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">data</font>, <b><font color="#000000">fin</font></b>(), <b><font color="#000000">cowboy_req:resp_body</font></b>()}</tt></pre>
+</div></div>
+<h3 id="trailers_command">trailers</h3>
+<p>Send response trailers to the client.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">trailers</font>, <b><font color="#000000">cowboy:http_headers</font></b>()}</tt></pre>
+</div></div>
+<h3 id="push_command">push</h3>
+<p>Push a resource to the client.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">push</font>, <font color="#009900">Method</font>, <font color="#009900">Scheme</font>, <font color="#009900">Host</font>, <b><font color="#000000">inet:port_number</font></b>(),
+ <font color="#009900">Path</font>, <font color="#009900">Qs</font>, <b><font color="#000000">cowboy:http_headers</font></b>()}
+
+<font color="#009900">Method</font> <font color="#990000">=</font> <font color="#009900">Scheme</font> <font color="#990000">=</font> <font color="#009900">Host</font> <font color="#990000">=</font> <font color="#009900">Path</font> <font color="#990000">=</font> <font color="#009900">Qs</font> <font color="#990000">=</font> <b><font color="#000080">binary</font></b>()</tt></pre>
+</div></div>
+<p>The command will be ignored if the protocol does not provide any server push mechanism.</p>
+<h3 id="_flow">flow</h3>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">flow</font>, <b><font color="#000000">pos_integer</font></b>()}</tt></pre>
+</div></div>
+<p>Request more data to be read from the request body. The exact behavior depends on the protocol.</p>
+<h3 id="_spawn">spawn</h3>
+<p>Inform Cowboy that a process was spawned and should be supervised.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<b><font color="#000080">spawn</font></b>, <b><font color="#000080">pid</font></b>(), <b><font color="#000000">timeout</font></b>()}</tt></pre>
+</div></div>
+<h3 id="_error_response">error_response</h3>
+<p>Send an error response if no response was sent previously.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">error_response</font>, <b><font color="#000000">cowboy:http_status</font></b>(), <b><font color="#000000">cowboy:http_headers</font></b>(), <b><font color="#000000">iodata</font></b>()}</tt></pre>
+</div></div>
+<h3 id="switch_protocol_command">switch_protocol</h3>
+<p>Switch to a different protocol.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">switch_protocol</font>, <b><font color="#000000">cowboy:http_headers</font></b>(), <b><font color="#000000">module</font></b>(), <b><font color="#000000">state</font></b>()}</tt></pre>
+</div></div>
+<p>Contains the headers that will be sent in the 101 response, along with the module implementing the protocol we are switching to and its initial state.</p>
+<p>Note that the 101 informational response will not be sent after a final response.</p>
+<h3 id="_stop">stop</h3>
+<p>Stop the stream.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><font color="#FF6600">stop</font></tt></pre>
+</div></div>
+<p>While no more data can be sent after the <code>fin</code> flag was set, the stream is still tracked by Cowboy until it is stopped by the handler.</p>
+<p>The behavior when stopping a stream for which no response has been sent will vary depending on the protocol. The stream will end successfully as far as the client is concerned.</p>
+<p>To indicate that an error occurred, either use <code>error_response</code> before stopping, or use <code>internal_error</code>.</p>
+<h3 id="_internal_error">internal_error</h3>
+<p>Stop the stream with an error.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">internal_error</font>, <font color="#009900">Reason</font>, <font color="#009900">HumanReadable</font>}
+
+<font color="#009900">Reason</font> <font color="#990000">=</font> <b><font color="#000000">any</font></b>()
+<font color="#009900">HumanReadable</font> <font color="#990000">=</font> <b><font color="#000080">atom</font></b>()</tt></pre>
+</div></div>
+<p>This command should be used when the stream cannot continue because of an internal error. An <code>error_response</code> command may be sent before that to advertise to the client why the stream is dropped.</p>
+<h3 id="_log">log</h3>
+<p>Log a message.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<b><font color="#000080">log</font></b>, <b><font color="#000000">logger:level</font></b>(), <b><font color="#000000">io:format</font></b>(), <b><font color="#000080">list</font></b>()}</tt></pre>
+</div></div>
+<p>This command can be used to log a message using the configured <code>logger</code> module.</p>
+<h3 id="_set_options">set_options</h3>
+<p>Set protocol options.</p>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>{<font color="#FF6600">set_options</font>, <b><font color="#000000">map</font></b>()}</tt></pre>
+</div></div>
+<p>This can also be used to override stream handler options. For example this is supported by <a href="../cowboy_compress_h">cowboy_compress_h(3)</a>.</p>
+<p>Not all options can be overriden. Please consult the relevant option&apos;s documentation for details.</p>
+<h2 id="_predefined_events">Predefined events</h2>
+<p>Cowboy will forward all messages sent to the stream to the <code>info/3</code> callback. To send a message to a stream, the function <a href="../cowboy_req.cast">cowboy_req:cast(3)</a> can be used.</p>
+<p>Cowboy will also forward the exit signals for the processes that the stream spawned.</p>
+<p>When Cowboy needs to send a response it will trigger an event that looks exactly like the corresponding command. This event must be returned to be processed by Cowboy (which is done automatically when using <a href="../cowboy_stream_h">cowboy_stream_h(3)</a>).</p>
+<p>Cowboy may trigger the following events on its own, regardless of the stream handlers configured: <a href="#inform_command">inform</a> (to send a 101 informational response when upgrading to HTTP/2 or Websocket), <a href="#response_command">response</a>, <a href="#headers_command">headers</a>, <a href="#data_command">data</a> and <a href="#switch_protocol_command">switch_protocol</a>.</p>
+<h2 id="_exports">Exports</h2>
+<p>The following function should be called by modules implementing stream handlers to execute the next stream handler in the list:</p>
+<ul><li><a href="../cowboy_stream.init">cowboy_stream:init(3)</a> - Initialize a stream
+</li>
+<li><a href="../cowboy_stream.data">cowboy_stream:data(3)</a> - Handle data for a stream
+</li>
+<li><a href="../cowboy_stream.info">cowboy_stream:info(3)</a> - Handle a message for a stream
+</li>
+<li><a href="../cowboy_stream.terminate">cowboy_stream:terminate(3)</a> - Terminate a stream
+</li>
+<li><a href="../cowboy_stream.early_error">cowboy_stream:early_error(3)</a> - Handle an early error for a stream
+</li>
+</ul>
+<h2 id="_types">Types</h2>
+<h3 id="_commands">commands()</h3>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><b><font color="#000000">commands</font></b>() <font color="#990000">::</font> [<font color="#009900">Command</font>]</tt></pre>
+</div></div>
+<p>See the <a href="#commands">list of commands</a> for details.</p>
+<h3 id="_fin">fin()</h3>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><b><font color="#000000">fin</font></b>() <font color="#990000">::</font> <font color="#FF6600">fin</font> | <font color="#FF6600">nofin</font></tt></pre>
+</div></div>
+<p>Used in commands and events to indicate that this is the end of the stream.</p>
+<h3 id="_partial_req">partial_req()</h3>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><b><font color="#000000">req</font></b>() <font color="#990000">::</font> #{
+ <font color="#0000FF">method</font> <font color="#990000">=&gt;</font> <b><font color="#000080">binary</font></b>(), <i><font color="#9A1900">%% case sensitive</font></i>
+ <font color="#0000FF">version</font> <font color="#990000">=&gt;</font> <b><font color="#000000">cowboy:http_version</font></b>() | <b><font color="#000080">atom</font></b>(),
+ <font color="#0000FF">scheme</font> <font color="#990000">=&gt;</font> <b><font color="#000080">binary</font></b>(), <i><font color="#9A1900">%% lowercase; case insensitive</font></i>
+ <font color="#0000FF">host</font> <font color="#990000">=&gt;</font> <b><font color="#000080">binary</font></b>(), <i><font color="#9A1900">%% lowercase; case insensitive</font></i>
+ <font color="#0000FF">port</font> <font color="#990000">=&gt;</font> <b><font color="#000000">inet:port_number</font></b>(),
+ <font color="#0000FF">path</font> <font color="#990000">=&gt;</font> <b><font color="#000080">binary</font></b>(), <i><font color="#9A1900">%% case sensitive</font></i>
+ <font color="#0000FF">qs</font> <font color="#990000">=&gt;</font> <b><font color="#000080">binary</font></b>(), <i><font color="#9A1900">%% case sensitive</font></i>
+ <font color="#0000FF">headers</font> <font color="#990000">=&gt;</font> <b><font color="#000000">cowboy:http_headers</font></b>(),
+ <font color="#0000FF">peer</font> <font color="#990000">=&gt;</font> {<b><font color="#000000">inet:ip_address</font></b>(), <b><font color="#000000">inet:port_number</font></b>()}
+}</tt></pre>
+</div></div>
+<p>Partial request information received when an early error is detected.</p>
+<h3 id="_reason">reason()</h3>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><b><font color="#000000">reason</font></b>() <font color="#990000">::</font> <b><font color="#000080">normal</font></b> | <font color="#FF6600">switch_protocol</font>
+ | {<font color="#FF6600">internal_error</font>, <font color="#FF6600">timeout</font> | {<font color="#FF6600">error</font> | <b><font color="#000080">exit</font></b> | <b><font color="#000080">throw</font></b>, <b><font color="#000000">any</font></b>()}, <font color="#009900">HumanReadable</font>}
+ | {<font color="#FF6600">socket_error</font>, <font color="#FF6600">closed</font> | <b><font color="#000080">atom</font></b>(), <font color="#009900">HumanReadable</font>}
+ | {<font color="#FF6600">stream_error</font>, <font color="#009900">Error</font>, <font color="#009900">HumanReadable</font>}
+ | {<font color="#FF6600">connection_error</font>, <font color="#009900">Error</font>, <font color="#009900">HumanReadable</font>}
+ | {<font color="#FF6600">stop</font>, <b><font color="#000000">cow_http2:frame</font></b>() | {<b><font color="#000080">exit</font></b>, <b><font color="#000000">any</font></b>()}, <font color="#009900">HumanReadable</font>}
+
+<font color="#009900">Error</font> <font color="#990000">=</font> <b><font color="#000080">atom</font></b>()
+<font color="#009900">HumanReadable</font> <font color="#990000">=</font> <b><font color="#000080">atom</font></b>()</tt></pre>
+</div></div>
+<p>Reason for the stream termination.</p>
+<h3 id="_resp_command">resp_command()</h3>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><b><font color="#000000">resp_command</font></b>() <font color="#990000">::</font> {<font color="#FF6600">response</font>, <b><font color="#000000">cowboy:http_status</font></b>(),
+ <b><font color="#000000">cowboy:http_headers</font></b>(), <b><font color="#000000">cowboy_req:resp_body</font></b>()}</tt></pre>
+</div></div>
+<p>See the <a href="#response_command">response command</a> for details.</p>
+<h3 id="_streamid">streamid()</h3>
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><b><font color="#000000">streamid</font></b>() <font color="#990000">::</font> <b><font color="#000000">any</font></b>()</tt></pre>
+</div></div>
+<p>The identifier for this stream.</p>
+<p>The identifier is unique over the connection process. It is possible to form a unique identifier node-wide and cluster-wide by wrapping it in a <code>{self(), StreamID}</code> tuple.</p>
+<h2 id="_changelog">Changelog</h2>
+<ul><li><strong>2.7</strong>: The <code>log</code> and <code>set_options</code> commands were introduced.
+</li>
+<li><strong>2.6</strong>: The <code>data</code> command can now contain a sendfile tuple.
+</li>
+<li><strong>2.6</strong>: The <code>{stop, {exit, any()}, HumanReadable}</code> terminate reason was added.
+</li>
+<li><strong>2.2</strong>: The <code>trailers</code> command was introduced.
+</li>
+<li><strong>2.0</strong>: Module introduced.
+</li>
+</ul>
+<h2 id="_see_also">See also</h2>
+<p><a href="..">cowboy(7)</a>, <a href="../cowboy_http">cowboy_http(3)</a>, <a href="../cowboy_http2">cowboy_http2(3)</a>, <a href="../cowboy_req.cast">cowboy_req:cast(3)</a></p>
+
+
+
+
+
+
+</div>
+
+<div class="span3 sidecol">
+
+
+<h3>
+ Cowboy
+ 2.8
+ Function Reference
+
+</h3>
+
+<ul>
+
+ <li><a href="/docs/en/cowboy/2.8/guide">User Guide</a></li>
+
+
+ <li><a href="/docs/en/cowboy/2.8/manual">Function Reference</a></li>
+
+
+</ul>
+
+<h4 id="docs-nav">Navigation</h4>
+
+<h4>Version select</h4>
+<ul>
+
+
+
+ <li><a href="/docs/en/cowboy/2.8/manual">2.8</a></li>
+
+ <li><a href="/docs/en/cowboy/2.7/manual">2.7</a></li>
+
+ <li><a href="/docs/en/cowboy/2.6/manual">2.6</a></li>
+
+ <li><a href="/docs/en/cowboy/2.5/manual">2.5</a></li>
+
+ <li><a href="/docs/en/cowboy/2.4/manual">2.4</a></li>
+
+ <li><a href="/docs/en/cowboy/2.3/manual">2.3</a></li>
+
+</ul>
+
+<h3 id="_like_my_work__donate">Like my work? Donate!</h3>
+<p>Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:</p>
+<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="display:inline">
+<input type="hidden" name="cmd" value="_donations">
+<input type="hidden" name="business" value="[email protected]">
+<input type="hidden" name="lc" value="FR">
+<input type="hidden" name="item_name" value="Loic Hoguin">
+<input type="hidden" name="item_number" value="99s">
+<input type="hidden" name="currency_code" value="EUR">
+<input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted">
+<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
+<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
+</form><p>Recurring payment options are also available via <a href="https://github.com/sponsors/essen">GitHub Sponsors</a>. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.</p>
+
+
+
+</div>
+</div>
+</div>
+</div>
+
+ <footer>
+ <div class="container">
+ <div class="row">
+ <div class="span6">
+ <p id="scroll-top"><a href="#">↑ Scroll to top</a></p>
+ <nav>
+ <ul>
+ <li><a href="mailto:[email protected]" title="Contact us">Contact us</a></li><li><a href="https://github.com/ninenines/ninenines.github.io" title="Github repository">Contribute to this site</a></li>
+ </ul>
+ </nav>
+ </div>
+ <div class="span6 credits">
+ <p><img src="/img/footer_logo.png"></p>
+ <p>Copyright &copy; Loïc Hoguin 2012-2018</p>
+ </div>
+ </div>
+ </div>
+ </footer>
+
+
+ <script src="/js/custom.js"></script>
+ </body>
+</html>
+
+