| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com) | ||
| 3 | // Copyright (c) 2024 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 "src/detail/filter.hpp" | ||
| 12 | |||
| 13 | #include <boost/buffers/front.hpp> | ||
| 14 | |||
| 15 | namespace boost { | ||
| 16 | namespace http_proto { | ||
| 17 | namespace detail { | ||
| 18 | |||
| 19 | auto | ||
| 20 | 61059 | filter:: | |
| 21 | process( | ||
| 22 | buffers::slice_of< | ||
| 23 | boost::span<const buffers::mutable_buffer>> out, | ||
| 24 | buffers::const_buffer_pair in, | ||
| 25 | bool more) -> results | ||
| 26 | { | ||
| 27 | 61059 | results rv; | |
| 28 | 61059 | bool p_more = true; | |
| 29 | for(;;) | ||
| 30 | { | ||
| 31 |
7/8✓ Branch 0 taken 190 times.
✓ Branch 1 taken 61294 times.
✓ Branch 2 taken 190 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 178 times.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 178 times.
✓ Branch 9 taken 61306 times.
|
61484 | if(!more && p_more && in[1].size() == 0) |
| 32 | { | ||
| 33 |
1/2✗ Branch 2 not taken.
✓ Branch 3 taken 178 times.
|
178 | if(buffers::size(out) < min_out_buffer()) |
| 34 | { | ||
| 35 | ✗ | rv.out_short = true; | |
| 36 | 61059 | return rv; | |
| 37 | } | ||
| 38 | 178 | p_more = false; | |
| 39 | } | ||
| 40 | |||
| 41 | 61484 | auto ob = buffers::front(out); | |
| 42 | 61484 | auto ib = buffers::front(in); | |
| 43 | 61484 | auto rs = do_process(ob, ib, p_more); | |
| 44 | |||
| 45 | 61484 | rv.in_bytes += rs.in_bytes; | |
| 46 | 61484 | rv.out_bytes += rs.out_bytes; | |
| 47 | |||
| 48 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 61484 times.
|
61484 | if(rs.ec.failed()) |
| 49 | { | ||
| 50 | ✗ | rv.ec = rs.ec; | |
| 51 | ✗ | return rv; | |
| 52 | } | ||
| 53 | |||
| 54 |
2/2✓ Branch 0 taken 172 times.
✓ Branch 1 taken 61312 times.
|
61484 | if(rs.finished) |
| 55 | { | ||
| 56 | 172 | rv.finished = true; | |
| 57 | 172 | return rv; | |
| 58 | } | ||
| 59 | |||
| 60 |
1/2✓ Branch 1 taken 61312 times.
✗ Branch 2 not taken.
|
61312 | buffers::remove_prefix(out, rs.out_bytes); |
| 61 | 61312 | buffers::remove_prefix(in, rs.in_bytes); | |
| 62 | |||
| 63 |
2/2✓ Branch 1 taken 6712 times.
✓ Branch 2 taken 54600 times.
|
61312 | if(buffers::size(out) == 0) |
| 64 | 6712 | return rv; | |
| 65 | |||
| 66 |
5/6✓ Branch 1 taken 54175 times.
✓ Branch 2 taken 425 times.
✓ Branch 4 taken 54175 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 54175 times.
✓ Branch 7 taken 425 times.
|
54600 | if(buffers::size(in) == 0 && rs.out_bytes < ob.size()) |
| 67 | 54175 | return rv; | |
| 68 | 425 | } | |
| 69 | } | ||
| 70 | |||
| 71 | } // detail | ||
| 72 | } // http_proto | ||
| 73 | } // boost | ||
| 74 |