Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) | ||
3 | // | ||
4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
6 | // | ||
7 | // Official repository: https://github.com/CPPAlliance/http_proto | ||
8 | // | ||
9 | |||
10 | #ifndef BOOST_HTTP_PROTO_REQUEST_PARSER_HPP | ||
11 | #define BOOST_HTTP_PROTO_REQUEST_PARSER_HPP | ||
12 | |||
13 | #include <boost/http_proto/detail/config.hpp> | ||
14 | #include <boost/http_proto/error.hpp> | ||
15 | #include <boost/http_proto/method.hpp> | ||
16 | #include <boost/http_proto/parser.hpp> | ||
17 | #include <boost/http_proto/request_view.hpp> | ||
18 | #include <boost/http_proto/string_view.hpp> | ||
19 | #include <cstddef> | ||
20 | #include <utility> | ||
21 | |||
22 | namespace boost { | ||
23 | namespace http_proto { | ||
24 | |||
25 | class BOOST_SYMBOL_VISIBLE | ||
26 | request_parser | ||
27 | : public parser | ||
28 | { | ||
29 | public: | ||
30 | /** Configuration settings for parsing requests | ||
31 | */ | ||
32 | struct config : config_base | ||
33 | { | ||
34 | /** Constructor | ||
35 | */ | ||
36 | 739 | config() noexcept | |
37 | 739 | { | |
38 | 739 | body_limit = 64 * 1024; | |
39 | 739 | } | |
40 | }; | ||
41 | |||
42 | /** Constructor | ||
43 | */ | ||
44 | BOOST_HTTP_PROTO_DECL | ||
45 | request_parser(); | ||
46 | |||
47 | /** Constructor | ||
48 | */ | ||
49 | template<class... Params> | ||
50 | explicit | ||
51 | 1476 | request_parser( | |
52 | std::size_t extra_buffer_size, | ||
53 | Params&&... params) | ||
54 | : parser( | ||
55 | detail::kind::request, | ||
56 |
1/2✓ Branch 2 taken 738 times.
✗ Branch 3 not taken.
|
1476 | config{}) |
57 | { | ||
58 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1476 | this->apply_params( |
59 | std::forward<Params>(params)...); | ||
60 |
1/2✓ Branch 1 taken 738 times.
✗ Branch 2 not taken.
|
1476 | construct(extra_buffer_size); |
61 | 1476 | } | |
62 | |||
63 | /** Prepare for the next message on the stream. | ||
64 | */ | ||
65 | void | ||
66 | 734 | start() | |
67 | { | ||
68 | 734 | start_impl(false); | |
69 | 734 | } | |
70 | |||
71 | /** Return the parsed request headers. | ||
72 | */ | ||
73 | BOOST_HTTP_PROTO_DECL | ||
74 | request_view | ||
75 | get() const noexcept; | ||
76 | }; | ||
77 | |||
78 | } // http_proto | ||
79 | } // boost | ||
80 | |||
81 | #endif | ||
82 |