GCC Code Coverage Report


Directory: libs/http_proto/
File: src/source.cpp
Date: 2025-06-18 09:40:27
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 2719 source::
18 on_read(
19 buffers::mutable_buffer_span bs) ->
20 results
21 {
22 2719 results rv;
23 2719 auto it = bs.begin();
24 2719 auto const end_ = bs.end();
25
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2718 times.
2719 if(it == end_)
26 1 return rv;
27 do
28 {
29 5406 buffers::mutable_buffer b(*it++);
30
1/2
✓ Branch 1 taken 5406 times.
✗ Branch 2 not taken.
5406 auto rs = on_read(b);
31 5406 rv += rs;
32
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 5402 times.
5406 if(rs.ec.failed())
33 4 return rv;
34
2/2
✓ Branch 0 taken 31 times.
✓ Branch 1 taken 5371 times.
5402 if(rs.finished)
35 31 break;
36 // Source must fill the entire buffer
37 // unless it has finished
38
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 5371 times.
5371 if(b.size() != rs.bytes)
39 detail::throw_logic_error();
40 }
41
2/2
✓ Branch 0 taken 2688 times.
✓ Branch 1 taken 2683 times.
5371 while(it != end_);
42 2714 return rv;
43 }
44
45 } // http_proto
46 } // boost
47