summaryrefslogtreecommitdiffstats
path: root/docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-06-13 09:54:12 +0200
committerLoïc Hoguin <[email protected]>2018-06-13 09:54:12 +0200
commit92b54aacc0de5446dd5497c39897b0bbff72e626 (patch)
treec3a98cfec636d1271f5804e5c19b35b208bba00d /docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html
parent8b5c3dc972b99f174750123c9e4abc96259c34a9 (diff)
downloadninenines.eu-92b54aacc0de5446dd5497c39897b0bbff72e626.tar.gz
ninenines.eu-92b54aacc0de5446dd5497c39897b0bbff72e626.tar.bz2
ninenines.eu-92b54aacc0de5446dd5497c39897b0bbff72e626.zip
Rebuild using Asciideck
Diffstat (limited to 'docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html')
-rw-r--r--docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html165
1 files changed, 47 insertions, 118 deletions
diff --git a/docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html b/docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html
index 830c6c10..4330cee2 100644
--- a/docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html
+++ b/docs/en/cowboy/2.2/manual/cowboy_req.read_body/index.html
@@ -62,143 +62,72 @@
<h1 class="lined-header"><span>cowboy_req:read_body(3)</span></h1>
-<div class="sect1">
<h2 id="_name">Name</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>cowboy_req:read_body - Read the request body</p></div>
-</div>
-</div>
-<div class="sect1">
+<p>cowboy_req:read_body - Read the request body</p>
<h2 id="_description">Description</h2>
-<div class="sectionbody">
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight
+<div class="listingblock"><div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #000000">read_body</span></span>(<span style="color: #009900">Req</span> <span style="color: #990000">::</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:req</span></span>())
- <span style="color: #990000">-&gt;</span> <span style="font-weight: bold"><span style="color: #000000">read_body</span></span>(<span style="color: #009900">Req</span>, #{})
-
-<span style="font-weight: bold"><span style="color: #000000">read_body</span></span>(<span style="color: #009900">Req</span> <span style="color: #990000">::</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:req</span></span>(), <span style="color: #009900">Opts</span>)
- <span style="color: #990000">-&gt;</span> {<span style="color: #FF6600">ok</span>, <span style="color: #009900">Data</span> <span style="color: #990000">::</span> <span style="font-weight: bold"><span style="color: #000080">binary</span></span>(), <span style="color: #009900">Req</span>}
- | {<span style="color: #FF6600">more</span>, <span style="color: #009900">Data</span> <span style="color: #990000">::</span> <span style="font-weight: bold"><span style="color: #000080">binary</span></span>(), <span style="color: #009900">Req</span>}
-
-<span style="color: #009900">Opts</span> <span style="color: #990000">::</span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:read_body_opts</span></span>()</tt></pre></div></div>
-<div class="paragraph"><p>Read the request body.</p></div>
-<div class="paragraph"><p>This function reads a chunk of the request body. A <code>more</code> tuple
-is returned when more data remains to be read. Call the function
-repeatedly until an <code>ok</code> tuple is returned to read the entire body.</p></div>
-<div class="paragraph"><p>An <code>ok</code> tuple with empty data is returned when the request has no body,
-or when calling this function again after the body has already
-been read. It is therefore safe to call this function directly.
-Note that the body can only be read once.</p></div>
-<div class="paragraph"><p>This function reads the request body from the connection process.
-The connection process is responsible for reading from the socket.
-The exact behavior varies depending on the protocol.</p></div>
-<div class="paragraph"><p>The options therefore are only related to the communication
-between the request process and the connection process.</p></div>
-<div class="paragraph"><p>Cowboy will automatically handle protocol details including
-the expect header, chunked transfer-encoding and others.</p></div>
-<div class="paragraph"><p>Once the body has been read fully, Cowboy sets the content-length
-header if it was not previously provided.</p></div>
-</div>
-</div>
-<div class="sect1">
+<pre><tt><b><font color="#000000">read_body</font></b>(<font color="#009900">Req</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_req:req</font></b>())
+ <font color="#990000">-&gt;</font> <b><font color="#000000">read_body</font></b>(<font color="#009900">Req</font>, #{})
+
+<b><font color="#000000">read_body</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">-&gt;</font> {<font color="#FF6600">ok</font>, <font color="#009900">Data</font> <font color="#990000">::</font> <b><font color="#000080">binary</font></b>(), <font color="#009900">Req</font>}
+ | {<font color="#FF6600">more</font>, <font color="#009900">Data</font> <font color="#990000">::</font> <b><font color="#000080">binary</font></b>(), <font color="#009900">Req</font>}
+
+<font color="#009900">Opts</font> <font color="#990000">::</font> <b><font color="#000000">cowboy_req:read_body_opts</font></b>()</tt></pre>
+</div></div>
+<p>Read the request body.</p>
+<p>This function reads a chunk of the request body. A <code>more</code> tuple is returned when more data remains to be read. Call the function repeatedly until an <code>ok</code> tuple is returned to read the entire body.</p>
+<p>An <code>ok</code> tuple with empty data is returned when the request has no body, or when calling this function again after the body has already been read. It is therefore safe to call this function directly. Note that the body can only be read once.</p>
+<p>This function reads the request body from the connection process. The connection process is responsible for reading from the socket. The exact behavior varies depending on the protocol.</p>
+<p>The options therefore are only related to the communication between the request process and the connection process.</p>
+<p>Cowboy will automatically handle protocol details including the expect header, chunked transfer-encoding and others.</p>
+<p>Once the body has been read fully, Cowboy sets the content-length header if it was not previously provided.</p>
<h2 id="_arguments">Arguments</h2>
-<div class="sectionbody">
-<div class="dlist"><dl>
-<dt class="hdlist1">
-Req
-</dt>
-<dd>
-<p>
-The Req object.
-</p>
+<dl><dt>Req</dt>
+<dd><p>The Req object.</p>
</dd>
-<dt class="hdlist1">
-Opts
-</dt>
-<dd>
-<p>
-A map of body reading options.
-</p>
-<div class="paragraph"><p>The <code>length</code> option can be used to request smaller or bigger
-chunks of data to be sent. It is a best effort approach, Cowboy
-may send more data than configured on occasions. It defaults
-to 8MB.</p></div>
-<div class="paragraph"><p>The <code>period</code> indicates how long the connection process will wait
-before it provides us with the data it received. It defaults
-to 15 seconds.</p></div>
-<div class="paragraph"><p>The connection process sends data to the request process when
-either the <code>length</code> of data or the <code>period</code> of time is reached.</p></div>
-<div class="paragraph"><p>The <code>timeout</code> option is a safeguard in case the connection
-process becomes unresponsive. The function will crash if no
-message was received in that interval. The timeout should be
-larger than the period. It defaults to the period + 1 second.</p></div>
+<dt>Opts</dt>
+<dd><p>A map of body reading options.</p>
+<p>The <code>length</code> option can be used to request smaller or bigger chunks of data to be sent. It is a best effort approach, Cowboy may send more data than configured on occasions. It defaults to 8MB.</p>
+<p>The <code>period</code> indicates how long the connection process will wait before it provides us with the data it received. It defaults to 15 seconds.</p>
+<p>The connection process sends data to the request process when either the <code>length</code> of data or the <code>period</code> of time is reached.</p>
+<p>The <code>timeout</code> option is a safeguard in case the connection process becomes unresponsive. The function will crash if no message was received in that interval. The timeout should be larger than the period. It defaults to the period<br/> 1 second.</p>
</dd>
-</dl></div>
-</div>
-</div>
-<div class="sect1">
+</dl>
<h2 id="_return_value">Return value</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>A <code>more</code> tuple is returned when there are more data to be read.</p></div>
-<div class="paragraph"><p>An <code>ok</code> tuple is returned when there are no more data to be read,
-either because this is the last chunk of data, the body has already
-been read, or there was no body to begin with.</p></div>
-<div class="paragraph"><p>The data is always returned as a binary.</p></div>
-<div class="paragraph"><p>The Req object returned in the tuple must be used for that point
-onward. It contains a more up to date representation of the request.
-For example it may have an added content-length header once the
-body has been read.</p></div>
-</div>
-</div>
-<div class="sect1">
+<p>A <code>more</code> tuple is returned when there are more data to be read.</p>
+<p>An <code>ok</code> tuple is returned when there are no more data to be read, either because this is the last chunk of data, the body has already been read, or there was no body to begin with.</p>
+<p>The data is always returned as a binary.</p>
+<p>The Req object returned in the tuple must be used for that point onward. It contains a more up to date representation of the request. For example it may have an added content-length header once the body has been read.</p>
<h2 id="_changelog">Changelog</h2>
-<div class="sectionbody">
-<div class="ulist"><ul>
-<li>
-<p>
-<strong>2.0</strong>: Function introduced. Replaces <code>body/1,2</code>.
-</p>
+<ul><li><strong>2.0</strong>: Function introduced. Replaces <code>body/1,2</code>.
</li>
-</ul></div>
-</div>
-</div>
-<div class="sect1">
+</ul>
<h2 id="_examples">Examples</h2>
-<div class="sectionbody">
-<div class="listingblock">
-<div class="title">Read the entire body</div>
-<div class="content"><!-- Generator: GNU source-highlight
+<div class="listingblock"><div class="title">Read the entire body</div>
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #000000">read_body</span></span>(<span style="color: #009900">Req0</span>, <span style="color: #009900">Acc</span>) <span style="color: #990000">-&gt;</span>
- <span style="font-weight: bold"><span style="color: #0000FF">case</span></span> <span style="font-weight: bold"><span style="color: #000000">cowboy_req:read_body</span></span>(<span style="color: #009900">Req0</span>) <span style="font-weight: bold"><span style="color: #0000FF">of</span></span>
- {<span style="color: #FF6600">ok</span>, <span style="color: #009900">Data</span>, <span style="color: #009900">Req</span>} <span style="color: #990000">-&gt;</span> {<span style="color: #FF6600">ok</span>, <span style="color: #990000">&lt;&lt;</span> <span style="color: #009900">Acc</span><span style="color: #990000">/</span><span style="font-weight: bold"><span style="color: #000080">binary</span></span>, <span style="color: #009900">Data</span><span style="color: #990000">/</span><span style="font-weight: bold"><span style="color: #000080">binary</span></span> <span style="color: #990000">&gt;&gt;</span>, <span style="color: #009900">Req</span>};
- {<span style="color: #FF6600">more</span>, <span style="color: #009900">Data</span>, <span style="color: #009900">Req</span>} <span style="color: #990000">-&gt;</span> <span style="font-weight: bold"><span style="color: #000000">read_body</span></span>(<span style="color: #009900">Req</span>, <span style="color: #990000">&lt;&lt;</span> <span style="color: #009900">Acc</span><span style="color: #990000">/</span><span style="font-weight: bold"><span style="color: #000080">binary</span></span>, <span style="color: #009900">Data</span><span style="color: #990000">/</span><span style="font-weight: bold"><span style="color: #000080">binary</span></span> <span style="color: #990000">&gt;&gt;</span>)
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span><span style="color: #990000">.</span></tt></pre></div></div>
-<div class="listingblock">
-<div class="title">Read the body in small chunks</div>
-<div class="content"><!-- Generator: GNU source-highlight
+<pre><tt><b><font color="#000000">read_body</font></b>(<font color="#009900">Req0</font>, <font color="#009900">Acc</font>) <font color="#990000">-&gt;</font>
+ <b><font color="#0000FF">case</font></b> <b><font color="#000000">cowboy_req:read_body</font></b>(<font color="#009900">Req0</font>) <b><font color="#0000FF">of</font></b>
+ {<font color="#FF6600">ok</font>, <font color="#009900">Data</font>, <font color="#009900">Req</font>} <font color="#990000">-&gt;</font> {<font color="#FF6600">ok</font>, <font color="#990000">&lt;&lt;</font> <font color="#009900">Acc</font><font color="#990000">/</font><b><font color="#000080">binary</font></b>, <font color="#009900">Data</font><font color="#990000">/</font><b><font color="#000080">binary</font></b> <font color="#990000">&gt;&gt;</font>, <font color="#009900">Req</font>};
+ {<font color="#FF6600">more</font>, <font color="#009900">Data</font>, <font color="#009900">Req</font>} <font color="#990000">-&gt;</font> <b><font color="#000000">read_body</font></b>(<font color="#009900">Req</font>, <font color="#990000">&lt;&lt;</font> <font color="#009900">Acc</font><font color="#990000">/</font><b><font color="#000080">binary</font></b>, <font color="#009900">Data</font><font color="#990000">/</font><b><font color="#000080">binary</font></b> <font color="#990000">&gt;&gt;</font>)
+ <b><font color="#0000FF">end</font></b><font color="#990000">.</font></tt></pre>
+</div></div>
+<div class="listingblock"><div class="title">Read the body in small chunks</div>
+<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #000000">cowboy_req:read_body</span></span>(<span style="color: #009900">Req</span>, #{<span style="font-weight: bold"><span style="color: #000080">length</span></span> <span style="color: #990000">=&gt;</span> <span style="color: #993399">64000</span>})<span style="color: #990000">.</span></tt></pre></div></div>
-</div>
-</div>
-<div class="sect1">
+<pre><tt><b><font color="#000000">cowboy_req:read_body</font></b>(<font color="#009900">Req</font>, #{<b><font color="#000080">length</font></b> <font color="#990000">=&gt;</font> <font color="#993399">64000</font>})<font color="#990000">.</font></tt></pre>
+</div></div>
<h2 id="_see_also">See also</h2>
-<div class="sectionbody">
-<div class="paragraph"><p><a href="../cowboy_req">cowboy_req(3)</a>,
-<a href="../cowboy_req.has_body">cowboy_req:has_body(3)</a>,
-<a href="../cowboy_req.body_length">cowboy_req:body_length(3)</a>,
-<a href="../cowboy_req.read_urlencoded_body">cowboy_req:read_urlencoded_body(3)</a>,
-<a href="../cowboy_req.read_part">cowboy_req:read_part(3)</a>,
-<a href="../cowboy_req.read_part_body">cowboy_req:read_part_body(3)</a></p></div>
-</div>
-</div>
+<p><a href="../cowboy_req">cowboy_req(3)</a>, <a href="../cowboy_req.has_body">cowboy_req:has_body(3)</a>, <a href="../cowboy_req.body_length">cowboy_req:body_length(3)</a>, <a href="../cowboy_req.read_urlencoded_body">cowboy_req:read_urlencoded_body(3)</a>, <a href="../cowboy_req.read_part">cowboy_req:read_part(3)</a>, <a href="../cowboy_req.read_part_body">cowboy_req:read_part_body(3)</a></p>
+