GCC Code Coverage Report


Directory: libs/http_proto/
File: libs/http_proto/src/rfc/upgrade_rule.cpp
Date: 2024-03-18 23:12:48
Exec Total Coverage
Lines: 14 15 93.3%
Functions: 1 1 100.0%
Branches: 7 8 87.5%

Line Branch Exec Source
1 //
2 // Copyright (c) 2021 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 #include <boost/http_proto/rfc/upgrade_rule.hpp>
11 #include <boost/http_proto/rfc/token_rule.hpp>
12 #include <boost/url/grammar/error.hpp>
13 #include <boost/url/grammar/parse.hpp>
14
15 namespace boost {
16 namespace http_proto {
17
18 auto
19 41 upgrade_protocol_rule_t::
20 parse(
21 char const*& it,
22 char const* end) const noexcept ->
23 system::result<value_type>
24 {
25 41 value_type t;
26 // token
27 {
28 auto rv = grammar::parse(
29 41 it, end, token_rule);
30
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 38 times.
41 if(! rv)
31 3 return rv.error();
32 38 t.name = *rv;
33 }
34 // [ "/" token ]
35
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 30 times.
38 if( it == end ||
36
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
8 *it != '/')
37 31 return t;
38 7 ++it;
39 auto rv = grammar::parse(
40 7 it, end, token_rule);
41
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
7 if(! rv)
42 return rv.error();
43 7 t.version = *rv;
44 7 return t;
45 }
46
47 } // http_proto
48 } // boost
49