1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>http::request_parser</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 1. Boost.Beast"> 8<link rel="up" href="../ref.html" title="This Page Intentionally Left Blank 2/2"> 9<link rel="prev" href="boost__beast__http__response.html" title="http::response"> 10<link rel="next" href="boost__beast__http__response_parser.html" title="http::response_parser"> 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="boost__beast__http__response.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.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="boost__beast__http__response_parser.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h4 class="title"> 27<a name="beast.ref.boost__beast__http__request_parser"></a><a class="link" href="boost__beast__http__request_parser.html" title="http::request_parser">http::request_parser</a> 28</h4></div></div></div> 29<p> 30 <a class="indexterm" name="idm46057508263584"></a> 31 </p> 32<p> 33 An HTTP/1 parser for producing a request message. 34 </p> 35<h5> 36<a name="beast.ref.boost__beast__http__request_parser.h0"></a> 37 <span class="phrase"><a name="beast.ref.boost__beast__http__request_parser.synopsis"></a></span><a class="link" href="boost__beast__http__request_parser.html#beast.ref.boost__beast__http__request_parser.synopsis">Synopsis</a> 38 </h5> 39<p> 40 Defined in header <code class="literal"><<a href="../../../../../../boost/beast/http/parser.hpp" target="_top">boost/beast/http/parser.hpp</a>></code> 41 </p> 42<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> 43 <span class="keyword">class</span> <a class="link" href="../concepts/Body.html" title="Body"><span class="emphasis"><em>Body</em></span></a><span class="special">,</span> 44 <span class="keyword">class</span> <a href="https://en.cppreference.com/w/cpp/named_req/Allocator" target="_top"><span class="emphasis"><em>Allocator</em></span></a> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">allocator</span><span class="special"><</span><span class="keyword">char</span><span class="special">>></span> 45<span class="keyword">using</span> <span class="identifier">request_parser</span> <span class="special">=</span> <span class="identifier">parser</span><span class="special"><</span> <span class="keyword">true</span><span class="special">,</span> <span class="identifier">Body</span><span class="special">,</span> <span class="identifier">Allocator</span> <span class="special">>;</span> 46</pre> 47<h5> 48<a name="beast.ref.boost__beast__http__request_parser.h1"></a> 49 <span class="phrase"><a name="beast.ref.boost__beast__http__request_parser.types"></a></span><a class="link" href="boost__beast__http__request_parser.html#beast.ref.boost__beast__http__request_parser.types">Types</a> 50 </h5> 51<div class="informaltable"><table class="table"> 52<colgroup> 53<col> 54<col> 55</colgroup> 56<thead><tr> 57<th> 58 <p> 59 Name 60 </p> 61 </th> 62<th> 63 <p> 64 Description 65 </p> 66 </th> 67</tr></thead> 68<tbody> 69<tr> 70<td> 71 <p> 72 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/is_request.html" title="http::parser::is_request">is_request</a></strong></span> 73 </p> 74 </td> 75<td> 76 <p> 77 <code class="computeroutput"><span class="keyword">true</span></code> if this parser 78 parses requests, <code class="computeroutput"><span class="keyword">false</span></code> 79 for responses. 80 </p> 81 </td> 82</tr> 83<tr> 84<td> 85 <p> 86 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/value_type.html" title="http::parser::value_type">value_type</a></strong></span> 87 </p> 88 </td> 89<td> 90 <p> 91 The type of message returned by the parser. 92 </p> 93 </td> 94</tr> 95</tbody> 96</table></div> 97<h5> 98<a name="beast.ref.boost__beast__http__request_parser.h2"></a> 99 <span class="phrase"><a name="beast.ref.boost__beast__http__request_parser.member_functions"></a></span><a class="link" href="boost__beast__http__request_parser.html#beast.ref.boost__beast__http__request_parser.member_functions">Member 100 Functions</a> 101 </h5> 102<div class="informaltable"><table class="table"> 103<colgroup> 104<col> 105<col> 106</colgroup> 107<thead><tr> 108<th> 109 <p> 110 Name 111 </p> 112 </th> 113<th> 114 <p> 115 Description 116 </p> 117 </th> 118</tr></thead> 119<tbody> 120<tr> 121<td> 122 <p> 123 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/body_limit.html" title="http::parser::body_limit">body_limit</a></strong></span> 124 </p> 125 </td> 126<td> 127 <p> 128 Set the limit on the payload body. 129 </p> 130 </td> 131</tr> 132<tr> 133<td> 134 <p> 135 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/chunked.html" title="http::parser::chunked">chunked</a></strong></span> 136 </p> 137 </td> 138<td> 139 <p> 140 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 141 last value for Transfer-Encoding is "chunked". 142 </p> 143 </td> 144</tr> 145<tr> 146<td> 147 <p> 148 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/content_length.html" title="http::parser::content_length">content_length</a></strong></span> 149 </p> 150 </td> 151<td> 152 <p> 153 Returns the optional value of Content-Length if known. 154 </p> 155 </td> 156</tr> 157<tr> 158<td> 159 <p> 160 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/content_length_remaining.html" title="http::parser::content_length_remaining">content_length_remaining</a></strong></span> 161 </p> 162 </td> 163<td> 164 <p> 165 Returns the remaining content length if known. 166 </p> 167 </td> 168</tr> 169<tr> 170<td> 171 <p> 172 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/eager.html" title="http::parser::eager">eager</a></strong></span> 173 </p> 174 </td> 175<td> 176 <p> 177 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 178 eager parse option is set. 179 </p> 180 <p> 181 Set the eager parse option. 182 </p> 183 </td> 184</tr> 185<tr> 186<td> 187 <p> 188 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/get.html" title="http::parser::get">get</a></strong></span> 189 </p> 190 </td> 191<td> 192 <p> 193 Returns the parsed message. 194 </p> 195 </td> 196</tr> 197<tr> 198<td> 199 <p> 200 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/got_some.html" title="http::parser::got_some">got_some</a></strong></span> 201 </p> 202 </td> 203<td> 204 <p> 205 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 206 parser has received at least one byte of input. 207 </p> 208 </td> 209</tr> 210<tr> 211<td> 212 <p> 213 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/header_limit.html" title="http::parser::header_limit">header_limit</a></strong></span> 214 </p> 215 </td> 216<td> 217 <p> 218 Set a limit on the total size of the header. 219 </p> 220 </td> 221</tr> 222<tr> 223<td> 224 <p> 225 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/is_done.html" title="http::parser::is_done">is_done</a></strong></span> 226 </p> 227 </td> 228<td> 229 <p> 230 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 231 message is complete. 232 </p> 233 </td> 234</tr> 235<tr> 236<td> 237 <p> 238 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/is_header_done.html" title="http::parser::is_header_done">is_header_done</a></strong></span> 239 </p> 240 </td> 241<td> 242 <p> 243 Returns <code class="computeroutput"><span class="keyword">true</span></code> if a 244 the parser has produced the full header. 245 </p> 246 </td> 247</tr> 248<tr> 249<td> 250 <p> 251 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/keep_alive.html" title="http::parser::keep_alive">keep_alive</a></strong></span> 252 </p> 253 </td> 254<td> 255 <p> 256 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 257 message has keep-alive connection semantics. 258 </p> 259 </td> 260</tr> 261<tr> 262<td> 263 <p> 264 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/need_eof.html" title="http::parser::need_eof">need_eof</a></strong></span> 265 </p> 266 </td> 267<td> 268 <p> 269 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 270 message semantics require an end of file. 271 </p> 272 </td> 273</tr> 274<tr> 275<td> 276 <p> 277 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/on_chunk_body.html" title="http::parser::on_chunk_body">on_chunk_body</a></strong></span> 278 </p> 279 </td> 280<td> 281 <p> 282 Set a callback to be invoked on chunk body data. 283 </p> 284 </td> 285</tr> 286<tr> 287<td> 288 <p> 289 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/on_chunk_header.html" title="http::parser::on_chunk_header">on_chunk_header</a></strong></span> 290 </p> 291 </td> 292<td> 293 <p> 294 Set a callback to be invoked on each chunk header. 295 </p> 296 </td> 297</tr> 298<tr> 299<td> 300 <p> 301 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/operator_eq_.html" title="http::parser::operator=">operator=</a></strong></span> 302 </p> 303 </td> 304<td> 305 <p> 306 Assignment (disallowed) 307 </p> 308 </td> 309</tr> 310<tr> 311<td> 312 <p> 313 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/parser.html" title="http::parser::parser">parser</a></strong></span> 314 </p> 315 </td> 316<td> 317 <p> 318 Constructor (disallowed) 319 </p> 320 <p> 321 Constructor. 322 </p> 323 <p> 324 Construct a parser from another parser, changing the Body type. 325 </p> 326 </td> 327</tr> 328<tr> 329<td> 330 <p> 331 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/put.html" title="http::parser::put">put</a></strong></span> 332 </p> 333 </td> 334<td> 335 <p> 336 Write a buffer sequence to the parser. 337 </p> 338 </td> 339</tr> 340<tr> 341<td> 342 <p> 343 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/put_eof.html" title="http::parser::put_eof">put_eof</a></strong></span> 344 </p> 345 </td> 346<td> 347 <p> 348 Inform the parser that the end of stream was reached. 349 </p> 350 </td> 351</tr> 352<tr> 353<td> 354 <p> 355 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/release.html" title="http::parser::release">release</a></strong></span> 356 </p> 357 </td> 358<td> 359 <p> 360 Returns ownership of the parsed message. 361 </p> 362 </td> 363</tr> 364<tr> 365<td> 366 <p> 367 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/skip.html" title="http::parser::skip">skip</a></strong></span> 368 </p> 369 </td> 370<td> 371 <p> 372 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 373 skip parse option is set. 374 </p> 375 <p> 376 Set the skip parse option. 377 </p> 378 </td> 379</tr> 380<tr> 381<td> 382 <p> 383 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/upgrade.html" title="http::parser::upgrade">upgrade</a></strong></span> 384 </p> 385 </td> 386<td> 387 <p> 388 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the 389 message is an upgrade message. 390 </p> 391 </td> 392</tr> 393<tr> 394<td> 395 <p> 396 <span class="bold"><strong><a class="link" href="boost__beast__http__parser/_parser.html" title="http::parser::~parser">~parser</a></strong></span> 397 </p> 398 </td> 399<td> 400 <p> 401 Destructor. 402 </p> 403 </td> 404</tr> 405</tbody> 406</table></div> 407<p> 408 This class uses the basic HTTP/1 wire format parser to convert a series of 409 octets into a <a class="link" href="boost__beast__http__message.html" title="http::message"><code class="computeroutput"><span class="identifier">message</span></code></a> using the <a class="link" href="boost__beast__http__basic_fields.html" title="http::basic_fields"><code class="computeroutput"><span class="identifier">basic_fields</span></code></a> container to represent 410 the fields. 411 </p> 412<h5> 413<a name="beast.ref.boost__beast__http__request_parser.h3"></a> 414 <span class="phrase"><a name="beast.ref.boost__beast__http__request_parser.template_parameters"></a></span><a class="link" href="boost__beast__http__request_parser.html#beast.ref.boost__beast__http__request_parser.template_parameters">Template 415 Parameters</a> 416 </h5> 417<div class="informaltable"><table class="table"> 418<colgroup> 419<col> 420<col> 421</colgroup> 422<thead><tr> 423<th> 424 <p> 425 Type 426 </p> 427 </th> 428<th> 429 <p> 430 Description 431 </p> 432 </th> 433</tr></thead> 434<tbody> 435<tr> 436<td> 437 <p> 438 <code class="computeroutput"><span class="identifier">isRequest</span></code> 439 </p> 440 </td> 441<td> 442 <p> 443 Indicates whether a request or response will be parsed. 444 </p> 445 </td> 446</tr> 447<tr> 448<td> 449 <p> 450 <code class="computeroutput"><span class="identifier">Body</span></code> 451 </p> 452 </td> 453<td> 454 <p> 455 The type used to represent the body. This must meet the requirements 456 of <span class="emphasis"><em>Body</em></span>. 457 </p> 458 </td> 459</tr> 460<tr> 461<td> 462 <p> 463 <code class="computeroutput"><span class="identifier">Allocator</span></code> 464 </p> 465 </td> 466<td> 467 <p> 468 The type of allocator used with the <a class="link" href="boost__beast__http__basic_fields.html" title="http::basic_fields"><code class="computeroutput"><span class="identifier">basic_fields</span></code></a> container. 469 </p> 470 </td> 471</tr> 472</tbody> 473</table></div> 474<h5> 475<a name="beast.ref.boost__beast__http__request_parser.h4"></a> 476 <span class="phrase"><a name="beast.ref.boost__beast__http__request_parser.remarks"></a></span><a class="link" href="boost__beast__http__request_parser.html#beast.ref.boost__beast__http__request_parser.remarks">Remarks</a> 477 </h5> 478<p> 479 A new instance of the parser is required for each message. 480 </p> 481<h5> 482<a name="beast.ref.boost__beast__http__request_parser.h5"></a> 483 <span class="phrase"><a name="beast.ref.boost__beast__http__request_parser.description"></a></span><a class="link" href="boost__beast__http__request_parser.html#beast.ref.boost__beast__http__request_parser.description">Description</a> 484 </h5> 485</div> 486<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 487<td align="left"></td> 488<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie 489 Falco<p> 490 Distributed under the Boost Software License, Version 1.0. (See accompanying 491 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>) 492 </p> 493</div></td> 494</tr></table> 495<hr> 496<div class="spirit-nav"> 497<a accesskey="p" href="boost__beast__http__response.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../ref.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="boost__beast__http__response_parser.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 498</div> 499</body> 500</html> 501