grpc 1.53.0 → 1.53.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +4 -2
- data/include/grpc/impl/grpc_types.h +11 -2
- data/src/core/ext/filters/client_channel/http_proxy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +12 -8
- data/src/core/ext/transport/chttp2/transport/bin_encoder.h +5 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +33 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +118 -222
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +295 -113
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +466 -273
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +7 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +14 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +9 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +6 -0
- data/src/core/lib/backoff/random_early_detection.cc +31 -0
- data/src/core/lib/backoff/random_early_detection.h +59 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +1 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +29 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +3 -0
- data/src/core/lib/iomgr/endpoint_pair.h +2 -2
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +1 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +39 -14
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +12 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +21 -0
- data/src/core/lib/surface/validate_metadata.cc +43 -42
- data/src/core/lib/surface/validate_metadata.h +9 -0
- data/src/core/lib/transport/metadata_batch.cc +4 -4
- data/src/core/lib/transport/metadata_batch.h +153 -15
- data/src/core/lib/transport/parsed_metadata.h +19 -9
- data/src/ruby/lib/grpc/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c237088f6035b2dc6f188374ab0531f3f3b8307f61fdc5b8a57518bc02b222c
|
4
|
+
data.tar.gz: fb1aec781fd0bf129d3740eeed7fa432b0412f29ba4ec2da79b197bb903cb1bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b62ef23a0f40e77c274ceeb11b929e6fa61cf9b7ac381524ee5be37b5c64e45b8ddb4a7188442fc0387c7296fd67b77b775af93aea877f5ccb78ed9aa0a16573
|
7
|
+
data.tar.gz: 45fc670b35416ca8a2a1f133e512576a4cdd4d72ddc97506aa2dcc7aa650a90865a6acfba41bb3cded70a126702fa5736a0ffb8dea7e1ccb83df5a6a7633f0b5
|
data/Makefile
CHANGED
@@ -411,8 +411,8 @@ Q = @
|
|
411
411
|
endif
|
412
412
|
|
413
413
|
CORE_VERSION = 30.1.0
|
414
|
-
CPP_VERSION = 1.53.
|
415
|
-
CSHARP_VERSION = 2.53.
|
414
|
+
CPP_VERSION = 1.53.2
|
415
|
+
CSHARP_VERSION = 2.53.2
|
416
416
|
|
417
417
|
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
|
418
418
|
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
|
@@ -1403,6 +1403,7 @@ LIBGRPC_SRC = \
|
|
1403
1403
|
src/core/lib/address_utils/parse_address.cc \
|
1404
1404
|
src/core/lib/address_utils/sockaddr_utils.cc \
|
1405
1405
|
src/core/lib/backoff/backoff.cc \
|
1406
|
+
src/core/lib/backoff/random_early_detection.cc \
|
1406
1407
|
src/core/lib/channel/channel_args.cc \
|
1407
1408
|
src/core/lib/channel/channel_args_preconditioning.cc \
|
1408
1409
|
src/core/lib/channel/channel_stack.cc \
|
@@ -1943,6 +1944,7 @@ LIBGRPC_UNSECURE_SRC = \
|
|
1943
1944
|
src/core/lib/address_utils/parse_address.cc \
|
1944
1945
|
src/core/lib/address_utils/sockaddr_utils.cc \
|
1945
1946
|
src/core/lib/backoff/backoff.cc \
|
1947
|
+
src/core/lib/backoff/random_early_detection.cc \
|
1946
1948
|
src/core/lib/channel/channel_args.cc \
|
1947
1949
|
src/core/lib/channel/channel_args_preconditioning.cc \
|
1948
1950
|
src/core/lib/channel/channel_stack.cc \
|
@@ -293,9 +293,18 @@ typedef struct {
|
|
293
293
|
* protector.
|
294
294
|
*/
|
295
295
|
#define GRPC_ARG_TSI_MAX_FRAME_SIZE "grpc.tsi.max_frame_size"
|
296
|
-
/** Maximum metadata size, in bytes. Note this limit applies to the
|
297
|
-
|
296
|
+
/** Maximum metadata size (soft limit), in bytes. Note this limit applies to the
|
297
|
+
max sum of all metadata key-value entries in a batch of headers. Some random
|
298
|
+
sample of requests between this limit and
|
299
|
+
`GRPC_ARG_ABSOLUTE_MAX_METADATA_SIZE` will be rejected. Defaults to maximum
|
300
|
+
of 8 KB and `GRPC_ARG_ABSOLUTE_MAX_METADATA_SIZE` * 0.8 (if set).
|
301
|
+
*/
|
298
302
|
#define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size"
|
303
|
+
/** Maximum metadata size (hard limit), in bytes. Note this limit applies to the
|
304
|
+
max sum of all metadata key-value entries in a batch of headers. All requests
|
305
|
+
exceeding this limit will be rejected. Defaults to maximum of 16 KB and
|
306
|
+
`GRPC_ARG_MAX_METADATA_SIZE` * 1.25 (if set). */
|
307
|
+
#define GRPC_ARG_ABSOLUTE_MAX_METADATA_SIZE "grpc.absolute_max_metadata_size"
|
299
308
|
/** If non-zero, allow the use of SO_REUSEPORT if it's available (default 1) */
|
300
309
|
#define GRPC_ARG_ALLOW_REUSEPORT "grpc.so_reuseport"
|
301
310
|
/** If non-zero, a pointer to a buffer pool (a pointer of type
|
@@ -76,7 +76,7 @@ absl::optional<std::string> GetHttpProxyServer(
|
|
76
76
|
if (!uri_str.has_value()) uri_str = GetEnv("https_proxy");
|
77
77
|
if (!uri_str.has_value()) uri_str = GetEnv("http_proxy");
|
78
78
|
if (!uri_str.has_value()) return absl::nullopt;
|
79
|
-
// an
|
79
|
+
// an empty value means "don't use proxy"
|
80
80
|
if (uri_str->empty()) return absl::nullopt;
|
81
81
|
uri = URI::Parse(*uri_str);
|
82
82
|
if (!uri.ok() || uri->authority().empty()) {
|
@@ -116,7 +116,7 @@ constexpr absl::string_view kRls = "rls_experimental";
|
|
116
116
|
const char kGrpc[] = "grpc";
|
117
117
|
const char* kRlsRequestPath = "/grpc.lookup.v1.RouteLookupService/RouteLookup";
|
118
118
|
const char* kFakeTargetFieldValue = "fake_target_field_value";
|
119
|
-
const char* kRlsHeaderKey = "
|
119
|
+
const char* kRlsHeaderKey = "x-google-rls-data";
|
120
120
|
|
121
121
|
const Duration kDefaultLookupServiceTimeout = Duration::Seconds(10);
|
122
122
|
const Duration kMaxMaxAge = Duration::Minutes(5);
|
@@ -149,7 +149,8 @@ static void enc_flush_some(huff_out* out) {
|
|
149
149
|
}
|
150
150
|
}
|
151
151
|
|
152
|
-
static void enc_add2(huff_out* out, uint8_t a, uint8_t b) {
|
152
|
+
static void enc_add2(huff_out* out, uint8_t a, uint8_t b, uint32_t* wire_size) {
|
153
|
+
*wire_size += 2;
|
153
154
|
b64_huff_sym sa = huff_alphabet[a];
|
154
155
|
b64_huff_sym sb = huff_alphabet[b];
|
155
156
|
out->temp = (out->temp << (sa.length + sb.length)) |
|
@@ -159,7 +160,8 @@ static void enc_add2(huff_out* out, uint8_t a, uint8_t b) {
|
|
159
160
|
enc_flush_some(out);
|
160
161
|
}
|
161
162
|
|
162
|
-
static void enc_add1(huff_out* out, uint8_t a) {
|
163
|
+
static void enc_add1(huff_out* out, uint8_t a, uint32_t* wire_size) {
|
164
|
+
*wire_size += 1;
|
163
165
|
b64_huff_sym sa = huff_alphabet[a];
|
164
166
|
out->temp = (out->temp << sa.length) | sa.bits;
|
165
167
|
out->temp_length += sa.length;
|
@@ -167,7 +169,7 @@ static void enc_add1(huff_out* out, uint8_t a) {
|
|
167
169
|
}
|
168
170
|
|
169
171
|
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(
|
170
|
-
const grpc_slice& input) {
|
172
|
+
const grpc_slice& input, uint32_t* wire_size) {
|
171
173
|
size_t input_length = GRPC_SLICE_LENGTH(input);
|
172
174
|
size_t input_triplets = input_length / 3;
|
173
175
|
size_t tail_case = input_length % 3;
|
@@ -183,16 +185,17 @@ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(
|
|
183
185
|
out.temp = 0;
|
184
186
|
out.temp_length = 0;
|
185
187
|
out.out = start_out;
|
188
|
+
*wire_size = 0;
|
186
189
|
|
187
190
|
// encode full triplets
|
188
191
|
for (i = 0; i < input_triplets; i++) {
|
189
192
|
const uint8_t low_to_high = static_cast<uint8_t>((in[0] & 0x3) << 4);
|
190
193
|
const uint8_t high_to_low = in[1] >> 4;
|
191
|
-
enc_add2(&out, in[0] >> 2, low_to_high | high_to_low);
|
194
|
+
enc_add2(&out, in[0] >> 2, low_to_high | high_to_low, wire_size);
|
192
195
|
|
193
196
|
const uint8_t a = static_cast<uint8_t>((in[1] & 0xf) << 2);
|
194
197
|
const uint8_t b = (in[2] >> 6);
|
195
|
-
enc_add2(&out, a | b, in[2] & 0x3f);
|
198
|
+
enc_add2(&out, a | b, in[2] & 0x3f, wire_size);
|
196
199
|
in += 3;
|
197
200
|
}
|
198
201
|
|
@@ -201,14 +204,15 @@ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(
|
|
201
204
|
case 0:
|
202
205
|
break;
|
203
206
|
case 1:
|
204
|
-
enc_add2(&out, in[0] >> 2, static_cast<uint8_t>((in[0] & 0x3) << 4)
|
207
|
+
enc_add2(&out, in[0] >> 2, static_cast<uint8_t>((in[0] & 0x3) << 4),
|
208
|
+
wire_size);
|
205
209
|
in += 1;
|
206
210
|
break;
|
207
211
|
case 2: {
|
208
212
|
const uint8_t low_to_high = static_cast<uint8_t>((in[0] & 0x3) << 4);
|
209
213
|
const uint8_t high_to_low = in[1] >> 4;
|
210
|
-
enc_add2(&out, in[0] >> 2, low_to_high | high_to_low);
|
211
|
-
enc_add1(&out, static_cast<uint8_t>((in[1] & 0xf) << 2));
|
214
|
+
enc_add2(&out, in[0] >> 2, low_to_high | high_to_low, wire_size);
|
215
|
+
enc_add1(&out, static_cast<uint8_t>((in[1] & 0xf) << 2), wire_size);
|
212
216
|
in += 2;
|
213
217
|
break;
|
214
218
|
}
|
@@ -21,6 +21,8 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include <stdint.h>
|
25
|
+
|
24
26
|
#include <grpc/slice.h>
|
25
27
|
|
26
28
|
// base64 encode a slice. Returns a new slice, does not take ownership of the
|
@@ -36,7 +38,9 @@ grpc_slice grpc_chttp2_huffman_compress(const grpc_slice& input);
|
|
36
38
|
// grpc_slice y = grpc_chttp2_huffman_compress(x);
|
37
39
|
// grpc_core::CSliceUnref( x);
|
38
40
|
// return y;
|
41
|
+
// *wire_size is the length of the base64 encoded string prior to huffman
|
42
|
+
// compression (as is needed for hpack table math)
|
39
43
|
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(
|
40
|
-
const grpc_slice& input);
|
44
|
+
const grpc_slice& input, uint32_t* wire_size);
|
41
45
|
|
42
46
|
#endif // GRPC_SRC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H
|
@@ -96,7 +96,8 @@
|
|
96
96
|
#define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024)
|
97
97
|
#define MAX_WINDOW 0x7fffffffu
|
98
98
|
#define MAX_WRITE_BUFFER_SIZE (64 * 1024 * 1024)
|
99
|
-
#define DEFAULT_MAX_HEADER_LIST_SIZE (
|
99
|
+
#define DEFAULT_MAX_HEADER_LIST_SIZE (16 * 1024)
|
100
|
+
#define DEFAULT_MAX_HEADER_LIST_SIZE_SOFT_LIMIT (8 * 1024)
|
100
101
|
|
101
102
|
#define DEFAULT_CLIENT_KEEPALIVE_TIME_MS INT_MAX
|
102
103
|
#define DEFAULT_CLIENT_KEEPALIVE_TIMEOUT_MS 20000 // 20 seconds
|
@@ -348,6 +349,21 @@ static void read_channel_args(grpc_chttp2_transport* t,
|
|
348
349
|
.GetObjectRef<grpc_core::channelz::SocketNode::Security>());
|
349
350
|
}
|
350
351
|
|
352
|
+
const int soft_limit =
|
353
|
+
channel_args.GetInt(GRPC_ARG_MAX_METADATA_SIZE).value_or(-1);
|
354
|
+
if (soft_limit < 0) {
|
355
|
+
// Set soft limit to 0.8 * hard limit if this is larger than
|
356
|
+
// `DEFAULT_MAX_HEADER_LIST_SIZE_SOFT_LIMIT` and
|
357
|
+
// `GRPC_ARG_MAX_METADATA_SIZE` is not set.
|
358
|
+
t->max_header_list_size_soft_limit = std::max(
|
359
|
+
DEFAULT_MAX_HEADER_LIST_SIZE_SOFT_LIMIT,
|
360
|
+
static_cast<int>(
|
361
|
+
0.8 * channel_args.GetInt(GRPC_ARG_ABSOLUTE_MAX_METADATA_SIZE)
|
362
|
+
.value_or(-1)));
|
363
|
+
} else {
|
364
|
+
t->max_header_list_size_soft_limit = soft_limit;
|
365
|
+
}
|
366
|
+
|
351
367
|
static const struct {
|
352
368
|
absl::string_view channel_arg_name;
|
353
369
|
grpc_chttp2_setting_id setting_id;
|
@@ -367,7 +383,7 @@ static void read_channel_args(grpc_chttp2_transport* t,
|
|
367
383
|
0,
|
368
384
|
INT32_MAX,
|
369
385
|
{true, true}},
|
370
|
-
{
|
386
|
+
{GRPC_ARG_ABSOLUTE_MAX_METADATA_SIZE,
|
371
387
|
GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
|
372
388
|
-1,
|
373
389
|
0,
|
@@ -400,6 +416,21 @@ static void read_channel_args(grpc_chttp2_transport* t,
|
|
400
416
|
if (value >= 0) {
|
401
417
|
queue_setting_update(t, setting.setting_id,
|
402
418
|
grpc_core::Clamp(value, setting.min, setting.max));
|
419
|
+
} else if (setting.setting_id ==
|
420
|
+
GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE) {
|
421
|
+
// Set value to 1.25 * soft limit if this is larger than
|
422
|
+
// `DEFAULT_MAX_HEADER_LIST_SIZE` and
|
423
|
+
// `GRPC_ARG_ABSOLUTE_MAX_METADATA_SIZE` is not set.
|
424
|
+
const int soft_limit = channel_args.GetInt(GRPC_ARG_MAX_METADATA_SIZE)
|
425
|
+
.value_or(setting.default_value);
|
426
|
+
const int value = (soft_limit < (INT_MAX / 1.25))
|
427
|
+
? static_cast<int>(soft_limit * 1.25)
|
428
|
+
: soft_limit;
|
429
|
+
if (value > DEFAULT_MAX_HEADER_LIST_SIZE) {
|
430
|
+
queue_setting_update(
|
431
|
+
t, setting.setting_id,
|
432
|
+
grpc_core::Clamp(value, setting.min, setting.max));
|
433
|
+
}
|
403
434
|
}
|
404
435
|
} else if (channel_args.Contains(setting.channel_arg_name)) {
|
405
436
|
gpr_log(GPR_DEBUG, "%s is not available on %s",
|