Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / beast / doc / html / beast / ref / boost__beast__http__parser / on_chunk_header.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>http::parser::on_chunk_header</title>
5 <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../../index.html" title="Chapter&#160;1.&#160;Boost.Beast">
8 <link rel="up" href="../boost__beast__http__parser.html" title="http::parser">
9 <link rel="prev" href="on_chunk_body.html" title="http::parser::on_chunk_body">
10 <link rel="next" href="operator_eq_.html" title="http::parser::operator=">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="on_chunk_body.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__http__parser.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator_eq_.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h5 class="title">
27 <a name="beast.ref.boost__beast__http__parser.on_chunk_header"></a><a class="link" href="on_chunk_header.html" title="http::parser::on_chunk_header">http::parser::on_chunk_header</a>
28 </h5></div></div></div>
29 <p>
30           <a class="indexterm" name="idm45873493460032"></a>
31 Set a callback to be invoked on each chunk header.
32         </p>
33 <h6>
34 <a name="beast.ref.boost__beast__http__parser.on_chunk_header.h0"></a>
35           <span class="phrase"><a name="beast.ref.boost__beast__http__parser.on_chunk_header.synopsis"></a></span><a class="link" href="on_chunk_header.html#beast.ref.boost__beast__http__parser.on_chunk_header.synopsis">Synopsis</a>
36         </h6>
37 <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span>
38     <span class="keyword">class</span> <span class="identifier">Callback</span><span class="special">&gt;</span>
39 <span class="keyword">void</span>
40 <span class="identifier">on_chunk_header</span><span class="special">(</span>
41     <span class="identifier">Callback</span><span class="special">&amp;</span> <span class="identifier">cb</span><span class="special">);</span>
42 </pre>
43 <h6>
44 <a name="beast.ref.boost__beast__http__parser.on_chunk_header.h1"></a>
45           <span class="phrase"><a name="beast.ref.boost__beast__http__parser.on_chunk_header.description"></a></span><a class="link" href="on_chunk_header.html#beast.ref.boost__beast__http__parser.on_chunk_header.description">Description</a>
46         </h6>
47 <p>
48           The callback will be invoked once for every chunk in the message payload,
49           as well as once for the last chunk. The invocation happens after the chunk
50           header is available but before any body octets have been parsed. The extensions
51           are provided in raw, validated form, use <a class="link" href="../boost__beast__http__basic_chunk_extensions/parse.html" title="http::basic_chunk_extensions::parse"><code class="computeroutput"><span class="identifier">http</span><span class="special">::</span><span class="identifier">basic_chunk_extensions</span><span class="special">::</span><span class="identifier">parse</span></code></a> to parse the extensions
52           into a structured container for easier access. The implementation type-erases
53           the callback without requiring a dynamic allocation. For this reason, the
54           callback object is passed by a non-constant reference.
55         </p>
56 <h6>
57 <a name="beast.ref.boost__beast__http__parser.on_chunk_header.h2"></a>
58           <span class="phrase"><a name="beast.ref.boost__beast__http__parser.on_chunk_header.example"></a></span><a class="link" href="on_chunk_header.html#beast.ref.boost__beast__http__parser.on_chunk_header.example">Example</a>
59         </h6>
60 <pre class="programlisting"><span class="keyword">auto</span> <span class="identifier">callback</span> <span class="special">=</span>
61     <span class="special">[](</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">size</span><span class="special">,</span> <span class="identifier">string_view</span> <span class="identifier">extensions</span><span class="special">,</span> <span class="identifier">error_code</span><span class="special">&amp;</span> <span class="identifier">ec</span><span class="special">)</span>
62     <span class="special">{</span>
63         <span class="comment">//...</span>
64     <span class="special">};</span>
65 <span class="identifier">parser</span><span class="special">.</span><span class="identifier">on_chunk_header</span><span class="special">(</span><span class="identifier">callback</span><span class="special">);</span>
66 </pre>
67 <h6>
68 <a name="beast.ref.boost__beast__http__parser.on_chunk_header.h3"></a>
69           <span class="phrase"><a name="beast.ref.boost__beast__http__parser.on_chunk_header.parameters"></a></span><a class="link" href="on_chunk_header.html#beast.ref.boost__beast__http__parser.on_chunk_header.parameters">Parameters</a>
70         </h6>
71 <div class="informaltable"><table class="table">
72 <colgroup>
73 <col>
74 <col>
75 </colgroup>
76 <thead><tr>
77 <th>
78                   <p>
79                     Name
80                   </p>
81                 </th>
82 <th>
83                   <p>
84                     Description
85                   </p>
86                 </th>
87 </tr></thead>
88 <tbody><tr>
89 <td>
90                   <p>
91                     <code class="computeroutput"><span class="identifier">cb</span></code>
92                   </p>
93                 </td>
94 <td>
95                   <p>
96                     The function to set, which must be invocable with this equivalent
97                     signature:
98                   </p>
99 <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">void</span>
100 <span class="identifier">on_chunk_header</span><span class="special">(</span>
101     <span class="identifier">std</span><span class="special">::</span><span class="identifier">uint64_t</span> <span class="identifier">size</span><span class="special">,</span>         <span class="comment">// Size of the chunk, zero for the last chunk</span>
102     <span class="identifier">string_view</span> <span class="identifier">extensions</span><span class="special">,</span>     <span class="comment">// The chunk-extensions in raw form</span>
103     <span class="identifier">error_code</span><span class="special">&amp;</span> <span class="identifier">ec</span><span class="special">);</span>            <span class="comment">// May be set by the callback to indicate an error</span>
104 </pre>
105                 </td>
106 </tr></tbody>
107 </table></div>
108 </div>
109 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
110 <td align="left"></td>
111 <td align="right"><div class="copyright-footer">Copyright &#169; 2016-2019 Vinnie
112       Falco<p>
113         Distributed under the Boost Software License, Version 1.0. (See accompanying
114         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
115       </p>
116 </div></td>
117 </tr></table>
118 <hr>
119 <div class="spirit-nav">
120 <a accesskey="p" href="on_chunk_body.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__http__parser.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator_eq_.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
121 </div>
122 </body>
123 </html>