GCC Code Coverage Report


Directory: libs/http_proto/
File: boost/http_proto/response_parser.hpp
Date: 2024-02-07 16:12:48
Exec Total Coverage
Lines: 4 4 100.0%
Functions: 1 1 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 9 config() noexcept
35 9 {
36 9 body_limit = 1024 * 1024;
37 9 }
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 This informs the parser not to read a
49 payload for the next message, regardless
50 of the presence or absence of certain
51 fields such as Content-Length or a chunked
52 Transfer-Encoding. Depending on the request,
53 some responses do not carry a body. For
54 example, a 200 response to a CONNECT
55 request from a tunneling proxy, or a
56 response to a HEAD request. In these
57 cases, callers may use this function
58 inform the parser that no body is
59 expected. The parser will consider the
60 message complete after the header has
61 been received.
62
63 @par Preconditions
64
65 This function must called before any calls to parse
66 the current message.
67
68 @see
69 https://datatracker.ietf.org/doc/html/rfc7230#section-3.3
70 */
71 void
72 start_head_response()
73 {
74 start_impl(true);
75 }
76
77 /** Return the parsed response headers.
78 */
79 BOOST_HTTP_PROTO_DECL
80 response_view
81 get() const;
82 };
83
84 } // http_proto
85 } // boost
86
87 #endif
88