| 1 |
|
|
1 |
|
|
| 2 |
|
// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
|
2 |
|
// Copyright (c) 2023 Vinnie Falco (vinnie.falco@gmail.com)
|
| 3 |
|
// Copyright (c) 2024 Mohammad Nejati
|
3 |
|
// Copyright (c) 2024 Mohammad Nejati
|
| 4 |
|
|
4 |
|
|
| 5 |
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
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)
|
6 |
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
| 7 |
|
|
7 |
|
|
| 8 |
|
// Official repository: https://github.com/cppalliance/buffers
|
8 |
|
// Official repository: https://github.com/cppalliance/buffers
|
| 9 |
|
|
9 |
|
|
| 10 |
|
|
10 |
|
|
| 11 |
|
#ifndef BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP
|
11 |
|
#ifndef BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP
|
| 12 |
|
#define BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP
|
12 |
|
#define BOOST_HTTP_DETAIL_ZLIB_FILTER_BASE_HPP
|
| 13 |
|
|
13 |
|
|
| 14 |
|
#include "src/detail/filter.hpp"
|
14 |
|
#include "src/detail/filter.hpp"
|
| 15 |
|
|
15 |
|
|
| 16 |
|
#include <boost/http/zlib/stream.hpp>
|
16 |
|
#include <boost/http/zlib/stream.hpp>
|
| 17 |
|
#include <boost/http/zlib/flush.hpp>
|
17 |
|
#include <boost/http/zlib/flush.hpp>
|
| 18 |
|
|
18 |
|
|
| 19 |
|
|
19 |
|
|
| 20 |
|
|
20 |
|
|
| 21 |
|
|
21 |
|
|
| 22 |
|
|
22 |
|
|
| 23 |
|
/** Base class for zlib filters
|
23 |
|
/** Base class for zlib filters
|
| 24 |
|
|
24 |
|
|
| 25 |
|
class zlib_filter_base : public filter
|
25 |
|
class zlib_filter_base : public filter
|
| 26 |
|
|
26 |
|
|
| 27 |
|
|
27 |
|
|
| 28 |
|
|
28 |
|
|
| 29 |
|
|
29 |
|
|
| 30 |
|
|
30 |
|
|
| 31 |
|
|
31 |
|
|
| 32 |
|
|
32 |
|
|
| 33 |
|
|
33 |
|
|
| 34 |
|
|
34 |
|
|
| 35 |
|
|
35 |
|
|
| 36 |
|
http::zlib::stream strm_;
|
36 |
|
http::zlib::stream strm_;
|
| 37 |
|
|
37 |
|
|
| 38 |
|
|
38 |
|
|
| 39 |
|
|
39 |
|
|
| 40 |
|
saturate_cast(std::size_t n) noexcept
|
40 |
|
saturate_cast(std::size_t n) noexcept
|
| 41 |
|
|
41 |
|
|
| 42 |
|
if(n >= std::numeric_limits<unsigned int>::max())
|
42 |
|
if(n >= std::numeric_limits<unsigned int>::max())
|
| 43 |
|
return std::numeric_limits<unsigned int>::max();
|
43 |
|
return std::numeric_limits<unsigned int>::max();
|
| 44 |
|
return static_cast<unsigned int>(n);
|
44 |
|
return static_cast<unsigned int>(n);
|
| 45 |
|
|
45 |
|
|
| 46 |
|
|
46 |
|
|
| 47 |
|
|
47 |
|
|
| 48 |
|
|
48 |
|
|
| 49 |
|
|
49 |
|
|
| 50 |
|
|
50 |
|
|
| 51 |
|
|
51 |
|
|
| 52 |
|
|
52 |
|
|