GCC Code Coverage Report


Directory: libs/http_proto/include/boost/http_proto/
File: boost/http_proto/response_parser.hpp
Date: 2023-03-02 17:13:10
Exec Total Coverage
Lines: 7 7 100.0%
Functions: 2 2 100.0%
Branches: 0 0 -%

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_RESPONSE_PARSER_HPP
11 #define BOOST_HTTP_PROTO_RESPONSE_PARSER_HPP
12
13 #include <boost/http_proto/detail/config.hpp>
14 #include <boost/http_proto/error.hpp>
15 #include <boost/http_proto/parser.hpp>
16 #include <boost/http_proto/response_view.hpp>
17 #include <boost/http_proto/status.hpp>
18 #include <cstddef>
19
20 namespace boost {
21 namespace http_proto {
22
23 class BOOST_SYMBOL_VISIBLE
24 response_parser
25 : public parser
26 {
27 public:
28 /** Configuration settings for parsing requests
29 */
30 struct config : config_base
31 {
32 /** Constructor
33 */
34 1 config() noexcept
35 1 {
36 1 body_limit = 1024 * 1024;
37 1 }
38 };
39
40 /** Constructor
41 */
42 BOOST_HTTP_PROTO_DECL
43 explicit
44 response_parser(context& ctx);
45
46 /** Prepare for the next message on the stream.
47 */
48 void
49 8162 start()
50 {
51 8162 start_impl(false);
52 8162 }
53
54 /** Prepare for the next message on the stream.
55
56 This informs the parser not to read a
57 payload for the next message, regardless
58 of the presence or absence of certain
59 fields such as Content-Length or a chunked
60 Transfer-Encoding. Depending on the request,
61 some responses do not carry a body. For
62 example, a 200 response to a CONNECT
63 request from a tunneling proxy, or a
64 response to a HEAD request. In these
65 cases, callers may use this function
66 inform the parser that no body is
67 expected. The parser will consider the
68 message complete after the header has
69 been received.
70
71 @par Preconditions
72
73 This function must called before any calls to parse
74 the current message.
75
76 @see
77 https://datatracker.ietf.org/doc/html/rfc7230#section-3.3
78 */
79 void
80 start_head_response()
81 {
82 start_impl(true);
83 }
84
85 /** Return the parsed response headers.
86 */
87 BOOST_HTTP_PROTO_DECL
88 response_view
89 get() const;
90 };
91
92 } // http_proto
93 } // boost
94
95 #endif
96