GCC Code Coverage Report


Directory: libs/http_proto/
File: src/source.cpp
Date: 2025-10-27 13:02:04
Exec Total Coverage
Lines: 16 17 94.1%
Functions: 1 1 100.0%
Branches: 10 12 83.3%

Line Branch Exec Source
1 //
2 // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
3 // Copyright (c) 2025 Mohammad Nejati
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // Official repository: https://github.com/cppalliance/http_proto
9 //
10
11 #include <boost/http_proto/source.hpp>
12
13 namespace boost {
14 namespace http_proto {
15
16 auto
17 992 source::
18 on_read(
19 boost::span<buffers::mutable_buffer const> bs) ->
20 results
21 {
22 992 results rv;
23 992 auto it = bs.begin();
24 992 auto const end_ = bs.end();
25
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 991 times.
992 if(it == end_)
26 1 return rv;
27 do
28 {
29 1960 buffers::mutable_buffer b(*it++);
30
1/2
✓ Branch 1 taken 1960 times.
✗ Branch 2 not taken.
1960 auto rs = on_read(b);
31 1960 rv += rs;
32
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1956 times.
1960 if(rs.ec.failed())
33 4 return rv;
34
2/2
✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1933 times.
1956 if(rs.finished)
35 23 break;
36 // source must fill the entire buffer
37 // if it is not finished
38
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 1933 times.
1933 if(b.size() != rs.bytes)
39 detail::throw_logic_error();
40 }
41
2/2
✓ Branch 0 taken 969 times.
✓ Branch 1 taken 964 times.
1933 while(it != end_);
42 987 return rv;
43 }
44
45 } // http_proto
46 } // boost
47