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 | 995 | source:: | |
18 | on_read( | ||
19 | bool, | ||
20 | boost::span<buffers::mutable_buffer const> bs) -> | ||
21 | results | ||
22 | { | ||
23 | 995 | results rv; | |
24 | 995 | auto it = bs.begin(); | |
25 | 995 | auto const end_ = bs.end(); | |
26 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 995 times.
|
995 | if(it == end_) |
27 | ✗ | return rv; | |
28 | do | ||
29 | { | ||
30 | 1968 | buffers::mutable_buffer b(*it++); | |
31 |
1/2✓ Branch 1 taken 1968 times.
✗ Branch 2 not taken.
|
1968 | auto rs = on_read(b); |
32 | 1968 | rv += rs; | |
33 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1964 times.
|
1968 | if(rs.ec.failed()) |
34 | 4 | return rv; | |
35 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 1941 times.
|
1964 | if(rs.finished) |
36 | 23 | break; | |
37 | // source must fill the entire buffer | ||
38 | // if it is not finished | ||
39 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 1941 times.
|
1941 | if(b.size() != rs.bytes) |
40 | ✗ | detail::throw_logic_error(); | |
41 | } | ||
42 |
2/2✓ Branch 0 taken 973 times.
✓ Branch 1 taken 968 times.
|
1941 | while(it != end_); |
43 | 991 | return rv; | |
44 | } | ||
45 | |||
46 | } // http_proto | ||
47 | } // boost | ||
48 |