Repository navigation
Expand file tree
/
Copy pathprotocol_limits.hpp
More file actions
92 lines (78 loc) · 2.94 KB
/
Copy pathprotocol_limits.hpp
File metadata and controls
92 lines (78 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* Copyright (C) 2026 Sebastiano Merlino; SPDX-License-Identifier: LGPL-2.1-or-later */
#ifndef SRC_HTTPSERVER_SERVER_PROTOCOL_LIMITS_HPP_
#define SRC_HTTPSERVER_SERVER_PROTOCOL_LIMITS_HPP_
#include <cstddef>
#include <cstdint>
#include <optional>
#include <httpserver/server/budgets.hpp>
namespace httpserver::server {
struct header_capacity_options {
std::optional<std::size_t> max_compressed_bytes;
std::optional<std::size_t> max_expanded_bytes;
std::optional<std::size_t> max_fields;
};
struct http2_capacity_options {
std::optional<std::size_t> max_concurrent_requests;
header_capacity_options headers;
std::optional<std::size_t> decoder_table_bytes;
std::optional<std::size_t> encoder_table_bytes;
};
struct http3_capacity_options {
std::optional<std::size_t> max_concurrent_requests;
header_capacity_options headers;
std::optional<std::size_t> decoder_table_bytes;
std::optional<std::size_t> encoder_table_bytes;
std::optional<std::size_t> max_blocked_headers;
std::optional<std::size_t> max_retained_header_bytes;
};
struct quic_capacity_options {
std::optional<std::size_t> max_stream_records;
};
struct effective_header_limits {
std::size_t max_compressed_bytes = 0;
std::size_t max_expanded_bytes = 0;
std::size_t max_fields = 0;
};
struct http2_initial_advertisement {
std::uint32_t max_concurrent_requests = 0;
std::uint32_t decoder_table_bytes = 0;
std::optional<std::uint32_t> max_header_list_bytes;
};
struct effective_http2_limits {
std::size_t max_concurrent_requests = 0;
effective_header_limits headers;
std::size_t decoder_table_bytes = 0;
std::size_t encoder_table_bytes = 0;
// RFC initial allowance before the peer acknowledges local SETTINGS.
std::size_t pre_ack_decoder_table_bytes = 4096;
http2_initial_advertisement initial_advertisement;
};
struct http3_initial_advertisement {
std::uint64_t decoder_table_bytes = 0;
std::uint64_t max_blocked_headers = 0;
std::optional<std::uint64_t> max_field_section_bytes;
};
struct effective_http3_limits {
std::size_t max_concurrent_requests = 0;
effective_header_limits headers;
std::size_t decoder_table_bytes = 0;
std::size_t encoder_table_bytes = 0;
std::size_t max_blocked_headers = 0;
std::size_t max_retained_header_bytes = 0;
http3_initial_advertisement initial_advertisement;
};
struct effective_quic_limits {
std::size_t max_stream_records = 0;
std::uint64_t initial_max_bidirectional_streams = 0;
std::uint64_t initial_max_unidirectional_streams = 8;
std::size_t advertised_max_udp_payload_bytes = 1200;
std::size_t native_send_datagram_bytes = 1200;
};
struct effective_protocol_limits {
budget_limits budgets;
std::optional<effective_http2_limits> http2;
std::optional<effective_http3_limits> http3;
std::optional<effective_quic_limits> quic;
};
} // namespace httpserver::server
#endif // SRC_HTTPSERVER_SERVER_PROTOCOL_LIMITS_HPP_