grpc 1.82.0 → 1.83.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +8 -5
- data/etc/roots.pem +10400 -3855
- data/include/grpc/grpc_audit_logging.h +2 -2
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +23 -0
- data/src/core/call/call_filters.h +19 -3
- data/src/core/call/call_spine.h +4 -4
- data/src/core/call/client_call.cc +1 -1
- data/src/core/call/metadata.cc +7 -2
- data/src/core/call/server_call.cc +13 -3
- data/src/core/call/server_call.h +5 -3
- data/src/core/client_channel/backup_poller.cc +2 -17
- data/src/core/client_channel/client_channel.cc +17 -14
- data/src/core/client_channel/client_channel.h +3 -1
- data/src/core/client_channel/client_channel_filter.cc +11 -13
- data/src/core/client_channel/client_channel_service_config.cc +5 -13
- data/src/core/client_channel/direct_channel.cc +5 -1
- data/src/core/client_channel/direct_channel.h +3 -1
- data/src/core/config/experiment_env_var.cc +30 -0
- data/src/core/config/experiment_env_var.h +26 -0
- data/src/core/credentials/call/regional_access_boundary_fetcher.cc +6 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +14 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.cc +172 -0
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +103 -0
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +10 -3
- data/src/core/credentials/transport/tls/tls_security_connector.cc +14 -2
- data/src/core/credentials/transport/xds/xds_credentials.cc +4 -12
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +19 -13
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +11 -9
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame.cc +58 -1
- data/src/core/ext/transport/chttp2/transport/frame.h +13 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -4
- data/src/core/ext/transport/chttp2/transport/frame_security.cc +10 -1
- data/src/core/ext/transport/chttp2/transport/frame_security.h +2 -1
- data/src/core/ext/transport/chttp2/transport/goaway.cc +11 -1
- data/src/core/ext/transport/chttp2/transport/goaway.h +17 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -0
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +117 -276
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +44 -17
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +382 -496
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +75 -77
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +30 -11
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +24 -9
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +26 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +4 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +4 -10
- data/src/core/ext/transport/chttp2/transport/read_context.h +62 -20
- data/src/core/ext/transport/chttp2/transport/security_frame.h +1 -0
- data/src/core/ext/transport/chttp2/transport/stream.h +271 -120
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +77 -61
- data/src/core/handshaker/security/secure_endpoint.cc +0 -13
- data/src/core/lib/channel/promise_based_filter.cc +77 -3
- data/src/core/lib/channel/promise_based_filter.h +238 -184
- data/src/core/lib/event_engine/extensions/receive_coalescing_extension.h +0 -4
- data/src/core/lib/event_engine/extensions/tcp_trace.h +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -12
- data/src/core/lib/event_engine/shim.cc +2 -16
- data/src/core/lib/event_engine/shim.h +0 -4
- data/src/core/lib/experiments/experiments.cc +51 -102
- data/src/core/lib/experiments/experiments.h +37 -59
- data/src/core/lib/iomgr/error.cc +3 -73
- data/src/core/lib/iomgr/error.h +8 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +2 -6
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -6
- data/src/core/lib/iomgr/tcp_posix.cc +2 -6
- data/src/core/lib/security/authorization/audit_logging.cc +2 -2
- data/src/core/lib/security/authorization/audit_logging.h +3 -3
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +11 -13
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -1
- data/src/core/lib/security/authorization/matchers.cc +20 -20
- data/src/core/lib/security/authorization/matchers.h +15 -16
- data/src/core/lib/security/authorization/rbac_policy.h +1 -1
- data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
- data/src/core/lib/security/authorization/stdout_logger.h +6 -5
- data/src/core/lib/surface/call.cc +0 -8
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/channel.cc +21 -2
- data/src/core/lib/surface/channel.h +14 -6
- data/src/core/lib/surface/filter_stack_call.cc +10 -29
- data/src/core/lib/surface/legacy_channel.cc +7 -7
- data/src/core/lib/surface/legacy_channel.h +3 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +13 -13
- data/src/core/lib/transport/bdp_estimator.h +9 -5
- data/src/core/lib/transport/error_utils.cc +26 -138
- data/src/core/lib/transport/promise_endpoint.h +2 -4
- data/src/core/load_balancing/grpclb/grpclb.cc +2 -1
- data/src/core/load_balancing/pick_first/pick_first.cc +33 -2
- data/src/core/load_balancing/pick_first/pick_first.h +6 -0
- data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -10
- data/src/core/load_balancing/rls/rls.cc +2 -1
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +2 -7
- data/src/core/load_balancing/xds/cds.cc +80 -56
- data/src/core/load_balancing/xds/cds.h +21 -0
- data/src/core/mitigation_engine/mitigation.h +53 -0
- data/src/core/mitigation_engine/mitigation_provider.h +62 -0
- data/src/core/resolver/dns/dns_resolver_plugin.cc +1 -6
- data/src/core/resolver/xds/xds_resolver.cc +14 -11
- data/src/core/server/server.h +1 -4
- data/src/core/server/server_config_selector.h +5 -4
- data/src/core/server/server_config_selector_filter.cc +67 -80
- data/src/core/server/xds_server_config_fetcher.cc +681 -692
- data/src/core/server/xds_server_config_fetcher_legacy.cc +15 -12
- data/src/core/telemetry/call_tracer.cc +49 -2
- data/src/core/telemetry/call_tracer.h +1 -0
- data/src/core/telemetry/tcp_tracer.h +38 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +343 -0
- data/src/core/tsi/ssl_telemetry_utils.h +74 -0
- data/src/core/tsi/ssl_transport_security.cc +577 -301
- data/src/core/tsi/ssl_transport_security.h +22 -6
- data/src/core/tsi/ssl_transport_security_utils.cc +2 -0
- data/src/core/tsi/transport_security.h +7 -0
- data/src/core/util/http_client/httpcli.cc +1 -4
- data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
- data/src/core/util/status_helper.cc +71 -192
- data/src/core/util/status_helper.h +16 -21
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +2 -11
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -7
- data/src/core/xds/grpc/xds_cluster_parser.cc +5 -16
- data/src/core/xds/grpc/xds_common_types.cc +94 -38
- data/src/core/xds/grpc/xds_common_types.h +33 -18
- data/src/core/xds/grpc/xds_common_types_parser.cc +168 -100
- data/src/core/xds/grpc/xds_common_types_parser.h +18 -1
- data/src/core/xds/grpc/xds_endpoint_parser.cc +6 -17
- data/src/core/xds/grpc/xds_http_filter_registry.cc +2 -10
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +3 -12
- data/src/core/xds/grpc/xds_metadata_parser.cc +0 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +7 -11
- data/src/core/xds/grpc/xds_routing.cc +113 -82
- data/src/core/xds/grpc/xds_routing.h +70 -20
- data/src/core/xds/grpc/xds_server_grpc.cc +22 -13
- data/src/core/xds/grpc/xds_server_grpc.h +16 -2
- data/src/core/xds/grpc/xds_server_grpc_interface.h +10 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +123 -18
- data/src/core/xds/grpc/xds_transport_grpc.h +28 -4
- data/src/core/xds/xds_client/lrs_client.cc +3 -7
- data/src/core/xds/xds_client/xds_bootstrap.cc +4 -16
- data/src/core/xds/xds_client/xds_client.cc +2 -15
- data/src/core/xds/xds_client/xds_transport.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +1 -1
- metadata +9 -1
|
@@ -25,13 +25,19 @@
|
|
|
25
25
|
#include <grpc/support/port_platform.h>
|
|
26
26
|
#include <openssl/x509.h>
|
|
27
27
|
|
|
28
|
+
#include <cstdint>
|
|
28
29
|
#include <memory>
|
|
29
30
|
#include <string>
|
|
31
|
+
#include <variant>
|
|
32
|
+
#include <vector>
|
|
30
33
|
|
|
34
|
+
#include "src/core/credentials/transport/tls/grpc_tls_certificate_selector.h"
|
|
31
35
|
#include "src/core/credentials/transport/tls/spiffe_utils.h"
|
|
36
|
+
#include "src/core/telemetry/metrics.h"
|
|
32
37
|
#include "src/core/tsi/ssl/key_logging/ssl_key_logging.h"
|
|
33
38
|
#include "src/core/tsi/ssl_transport_security_utils.h"
|
|
34
39
|
#include "src/core/tsi/transport_security_interface.h"
|
|
40
|
+
#include "src/core/util/ref_counted_ptr.h"
|
|
35
41
|
#include "absl/strings/string_view.h"
|
|
36
42
|
|
|
37
43
|
// Value for the TSI_CERTIFICATE_TYPE_PEER_PROPERTY property for X509 certs.
|
|
@@ -52,6 +58,8 @@
|
|
|
52
58
|
#define TSI_X509_IP_PEER_PROPERTY "x509_ip"
|
|
53
59
|
#define TSI_X509_VERIFIED_ROOT_CERT_SUBECT_PEER_PROPERTY \
|
|
54
60
|
"x509_verified_root_cert_subject"
|
|
61
|
+
#define TSI_SSL_NEGOTIATED_KEY_EXCHANGE_GROUP \
|
|
62
|
+
"ssl_negotiated_key_exchange_group"
|
|
55
63
|
|
|
56
64
|
namespace tsi {
|
|
57
65
|
using RootCertInfo = std::variant<std::string, grpc_core::SpiffeBundleMap>;
|
|
@@ -254,6 +262,7 @@ tsi_result tsi_ssl_client_handshaker_factory_create_handshaker(
|
|
|
254
262
|
const char* server_name_indication, size_t network_bio_buf_size,
|
|
255
263
|
size_t ssl_bio_buf_size,
|
|
256
264
|
std::optional<std::string> alpn_preferred_protocol_list,
|
|
265
|
+
grpc_core::RefCountedPtr<grpc_core::CollectionScope> collection_scope,
|
|
257
266
|
tsi_handshaker** handshaker);
|
|
258
267
|
|
|
259
268
|
// Increments reference count of the client handshaker factory.
|
|
@@ -273,6 +282,10 @@ void tsi_ssl_client_handshaker_factory_unref(
|
|
|
273
282
|
typedef struct tsi_ssl_server_handshaker_factory
|
|
274
283
|
tsi_ssl_server_handshaker_factory;
|
|
275
284
|
|
|
285
|
+
typedef std::variant<std::vector<tsi_ssl_pem_key_cert_pair>,
|
|
286
|
+
std::shared_ptr<grpc_core::CertificateSelector>>
|
|
287
|
+
tsi_ssl_key_cert_pairs;
|
|
288
|
+
|
|
276
289
|
// TO BE DEPRECATED.
|
|
277
290
|
// Creates a server handshaker factory.
|
|
278
291
|
// - pem_key_cert_pairs is an array private key / certificate chains of the
|
|
@@ -295,7 +308,7 @@ typedef struct tsi_ssl_server_handshaker_factory
|
|
|
295
308
|
// - This method returns TSI_OK on success or TSI_INVALID_PARAMETER in the case
|
|
296
309
|
// where a parameter is invalid.
|
|
297
310
|
tsi_result tsi_create_ssl_server_handshaker_factory(
|
|
298
|
-
|
|
311
|
+
tsi_ssl_key_cert_pairs pem_key_cert_pairs,
|
|
299
312
|
const char* pem_client_root_certs, int force_client_auth,
|
|
300
313
|
const char* cipher_suites, const char** alpn_protocols,
|
|
301
314
|
uint16_t num_alpn_protocols, tsi_ssl_server_handshaker_factory** factory);
|
|
@@ -308,16 +321,17 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
|
|
|
308
321
|
// authenticate with an SSL cert. Note that this option is ignored if
|
|
309
322
|
// pem_client_root_certs is NULL or pem_client_roots_certs_size is 0
|
|
310
323
|
tsi_result tsi_create_ssl_server_handshaker_factory_ex(
|
|
311
|
-
|
|
312
|
-
const char* pem_client_root_certs,
|
|
324
|
+
tsi_ssl_key_cert_pairs pem_key_cert, const char* pem_client_root_certs,
|
|
313
325
|
tsi_client_certificate_request_type client_certificate_request,
|
|
314
326
|
const char* cipher_suites, const char** alpn_protocols,
|
|
315
327
|
uint16_t num_alpn_protocols, tsi_ssl_server_handshaker_factory** factory);
|
|
316
328
|
|
|
317
329
|
struct tsi_ssl_server_handshaker_options {
|
|
318
330
|
// pem_key_cert_pairs is an array private key / certificate chains of the
|
|
319
|
-
// server.
|
|
320
|
-
|
|
331
|
+
// server, or a certificate selector. The array of key / certificate chains is
|
|
332
|
+
// to support SNI. The certificate selector will be in charge of this. So they
|
|
333
|
+
// are mutually exclusive.
|
|
334
|
+
tsi_ssl_key_cert_pairs pem_key_cert_pairs;
|
|
321
335
|
// client_certificate_request, if set to non-zero will force the client to
|
|
322
336
|
// authenticate with an SSL cert. Note that this option is ignored if
|
|
323
337
|
// root_cert_info is NULL
|
|
@@ -416,7 +430,9 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
|
|
|
416
430
|
// where a parameter is invalid.
|
|
417
431
|
tsi_result tsi_ssl_server_handshaker_factory_create_handshaker(
|
|
418
432
|
tsi_ssl_server_handshaker_factory* factory, size_t network_bio_buf_size,
|
|
419
|
-
size_t ssl_bio_buf_size,
|
|
433
|
+
size_t ssl_bio_buf_size,
|
|
434
|
+
grpc_core::RefCountedPtr<grpc_core::CollectionScope> collection_scope,
|
|
435
|
+
tsi_handshaker** handshaker);
|
|
420
436
|
|
|
421
437
|
// Decrements reference count of the handshaker factory. Handshaker factory will
|
|
422
438
|
// be destroyed once no references exist.
|
|
@@ -456,6 +456,8 @@ absl::StatusOr<absl::string_view> ConvertKeyExchangeGroupToString(
|
|
|
456
456
|
switch (group) {
|
|
457
457
|
case GRPC_TLS_GROUP_SECP256R1:
|
|
458
458
|
return "P-256";
|
|
459
|
+
case GRPC_TLS_GROUP_SECP384R1:
|
|
460
|
+
return "P-384";
|
|
459
461
|
case GRPC_TLS_GROUP_X25519:
|
|
460
462
|
return "X25519";
|
|
461
463
|
case GRPC_TLS_GROUP_X25519_MLKEM768:
|
|
@@ -83,6 +83,13 @@ struct tsi_handshaker_vtable {
|
|
|
83
83
|
void (*shutdown)(tsi_handshaker* self);
|
|
84
84
|
};
|
|
85
85
|
struct tsi_handshaker {
|
|
86
|
+
tsi_handshaker() = default;
|
|
87
|
+
explicit tsi_handshaker(const tsi_handshaker_vtable* vtable)
|
|
88
|
+
: vtable(vtable),
|
|
89
|
+
frame_protector_created(false),
|
|
90
|
+
handshaker_result_created(false),
|
|
91
|
+
handshake_shutdown(false) {}
|
|
92
|
+
|
|
86
93
|
const tsi_handshaker_vtable* vtable;
|
|
87
94
|
bool frame_protector_created;
|
|
88
95
|
bool handshaker_result_created;
|
|
@@ -176,10 +176,7 @@ HttpRequest::HttpRequest(
|
|
|
176
176
|
pollent_(pollent),
|
|
177
177
|
pollset_set_(grpc_pollset_set_create()),
|
|
178
178
|
test_only_generate_response_(std::move(test_only_generate_response)),
|
|
179
|
-
use_event_engine_dns_resolver_(
|
|
180
|
-
IsEventEngineDnsNonClientChannelEnabled() &&
|
|
181
|
-
!grpc_event_engine::experimental::
|
|
182
|
-
EventEngineExperimentDisabledForPython()),
|
|
179
|
+
use_event_engine_dns_resolver_(IsEventEngineDnsNonClientChannelEnabled()),
|
|
183
180
|
resolver_(!use_event_engine_dns_resolver_ ? GetDNSResolver() : nullptr),
|
|
184
181
|
ee_resolver_(
|
|
185
182
|
use_event_engine_dns_resolver_
|
|
@@ -94,7 +94,8 @@ class grpc_httpcli_ssl_channel_security_connector final
|
|
|
94
94
|
tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
|
|
95
95
|
handshaker_factory_, secure_peer_name_, /*network_bio_buf_size=*/0,
|
|
96
96
|
/*ssl_bio_buf_size=*/0,
|
|
97
|
-
args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS),
|
|
97
|
+
args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS),
|
|
98
|
+
/*collection_scope=*/nullptr, &handshaker);
|
|
98
99
|
if (result != TSI_OK) {
|
|
99
100
|
LOG(ERROR) << "Handshaker creation failed with error "
|
|
100
101
|
<< tsi_result_to_string(result);
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
#include "src/core/lib/slice/percent_encoding.h"
|
|
30
30
|
#include "src/core/lib/slice/slice.h"
|
|
31
31
|
#include "src/core/lib/transport/status_conversion.h"
|
|
32
|
-
#include "src/core/util/time.h"
|
|
33
32
|
#include "upb/base/string_view.h"
|
|
34
33
|
#include "upb/mem/arena.hpp"
|
|
35
34
|
#include "absl/log/check.h"
|
|
@@ -47,16 +46,9 @@ namespace {
|
|
|
47
46
|
|
|
48
47
|
#define TYPE_URL_PREFIX "type.googleapis.com/grpc.status."
|
|
49
48
|
#define TYPE_INT_TAG "int."
|
|
50
|
-
#define TYPE_STR_TAG "str."
|
|
51
|
-
#define TYPE_TIME_TAG "time."
|
|
52
|
-
#define TYPE_CHILDREN_TAG "children"
|
|
53
49
|
#define TYPE_URL(name) (TYPE_URL_PREFIX name)
|
|
54
50
|
const absl::string_view kTypeUrlPrefix = TYPE_URL_PREFIX;
|
|
55
51
|
const absl::string_view kTypeIntTag = TYPE_INT_TAG;
|
|
56
|
-
const absl::string_view kTypeStrTag = TYPE_STR_TAG;
|
|
57
|
-
const absl::string_view kTypeTimeTag = TYPE_TIME_TAG;
|
|
58
|
-
const absl::string_view kTypeChildrenTag = TYPE_CHILDREN_TAG;
|
|
59
|
-
const absl::string_view kChildrenPropertyUrl = TYPE_URL(TYPE_CHILDREN_TAG);
|
|
60
52
|
|
|
61
53
|
const char* GetStatusIntPropertyUrl(StatusIntProperty key) {
|
|
62
54
|
switch (key) {
|
|
@@ -74,47 +66,6 @@ const char* GetStatusIntPropertyUrl(StatusIntProperty key) {
|
|
|
74
66
|
GPR_UNREACHABLE_CODE(return "unknown");
|
|
75
67
|
}
|
|
76
68
|
|
|
77
|
-
const char* GetStatusStrPropertyUrl(StatusStrProperty key) {
|
|
78
|
-
switch (key) {
|
|
79
|
-
case StatusStrProperty::kGrpcMessage:
|
|
80
|
-
return TYPE_URL(TYPE_STR_TAG "grpc_message");
|
|
81
|
-
}
|
|
82
|
-
GPR_UNREACHABLE_CODE(return "unknown");
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
void EncodeUInt32ToBytes(uint32_t v, char* buf) {
|
|
86
|
-
buf[0] = v & 0xFF;
|
|
87
|
-
buf[1] = (v >> 8) & 0xFF;
|
|
88
|
-
buf[2] = (v >> 16) & 0xFF;
|
|
89
|
-
buf[3] = (v >> 24) & 0xFF;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
uint32_t DecodeUInt32FromBytes(const char* buf) {
|
|
93
|
-
const unsigned char* ubuf = reinterpret_cast<const unsigned char*>(buf);
|
|
94
|
-
return ubuf[0] | (static_cast<uint32_t>(ubuf[1]) << 8) |
|
|
95
|
-
(static_cast<uint32_t>(ubuf[2]) << 16) |
|
|
96
|
-
(static_cast<uint32_t>(ubuf[3]) << 24);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
std::vector<absl::Status> ParseChildren(absl::Cord children) {
|
|
100
|
-
std::vector<absl::Status> result;
|
|
101
|
-
upb::Arena arena;
|
|
102
|
-
// Cord is flattened to iterate the buffer easily at the cost of memory copy.
|
|
103
|
-
// TODO(veblush): Optimize this once CordReader is introduced.
|
|
104
|
-
absl::string_view buf = children.Flatten();
|
|
105
|
-
size_t cur = 0;
|
|
106
|
-
while (buf.size() - cur >= sizeof(uint32_t)) {
|
|
107
|
-
size_t msg_size = DecodeUInt32FromBytes(buf.data() + cur);
|
|
108
|
-
cur += sizeof(uint32_t);
|
|
109
|
-
CHECK(buf.size() - cur >= msg_size);
|
|
110
|
-
google_rpc_Status* msg =
|
|
111
|
-
google_rpc_Status_parse(buf.data() + cur, msg_size, arena.ptr());
|
|
112
|
-
cur += msg_size;
|
|
113
|
-
result.push_back(internal::StatusFromProto(msg));
|
|
114
|
-
}
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
69
|
} // namespace
|
|
119
70
|
|
|
120
71
|
absl::Status StatusCreate(absl::StatusCode code, absl::string_view msg,
|
|
@@ -144,7 +95,7 @@ absl::Status ReplaceStatusCode(const absl::Status& status,
|
|
|
144
95
|
} // namespace
|
|
145
96
|
|
|
146
97
|
void StatusSetInt(absl::Status* status, StatusIntProperty key, intptr_t value) {
|
|
147
|
-
if (
|
|
98
|
+
if (key == StatusIntProperty::kRpcStatus) {
|
|
148
99
|
// When setting the RPC status, just replace the top-level status code.
|
|
149
100
|
*status = ReplaceStatusCode(*status, static_cast<absl::StatusCode>(value));
|
|
150
101
|
return;
|
|
@@ -155,7 +106,7 @@ void StatusSetInt(absl::Status* status, StatusIntProperty key, intptr_t value) {
|
|
|
155
106
|
|
|
156
107
|
std::optional<intptr_t> StatusGetInt(const absl::Status& status,
|
|
157
108
|
StatusIntProperty key) {
|
|
158
|
-
if (
|
|
109
|
+
if (key == StatusIntProperty::kRpcStatus) {
|
|
159
110
|
return static_cast<intptr_t>(status.code());
|
|
160
111
|
}
|
|
161
112
|
auto p = status.GetPayload(GetStatusIntPropertyUrl(key));
|
|
@@ -175,100 +126,37 @@ std::optional<intptr_t> StatusGetInt(const absl::Status& status,
|
|
|
175
126
|
return {};
|
|
176
127
|
}
|
|
177
128
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
129
|
+
void StatusAddChild(absl::Status* status, absl::Status child) {
|
|
130
|
+
// If the child is OK, there's nothing to do.
|
|
131
|
+
if (child.ok()) return;
|
|
132
|
+
// If the parent is OK, replace it with the child.
|
|
133
|
+
if (status->ok()) {
|
|
134
|
+
*status = std::move(child);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
// Parent and child are both non-OK, so we need to merge.
|
|
138
|
+
absl::Status new_status(
|
|
139
|
+
// Prefer any other code over UNKNOWN.
|
|
140
|
+
status->code() == absl::StatusCode::kUnknown ? child.code()
|
|
141
|
+
: status->code(),
|
|
142
|
+
absl::StrCat(status->message(), " (", child.message(), ")"));
|
|
143
|
+
// TODO(roth): Remove this once we eliminate all status attributes.
|
|
144
|
+
status->ForEachPayload(
|
|
184
145
|
[&](absl::string_view type_url, const absl::Cord& payload) {
|
|
185
146
|
new_status.SetPayload(type_url, payload);
|
|
186
147
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
void StatusSetStr(absl::Status* status, StatusStrProperty key,
|
|
193
|
-
absl::string_view value) {
|
|
194
|
-
if (IsErrorFlattenEnabled() && key == StatusStrProperty::kGrpcMessage) {
|
|
195
|
-
if (!status->ok()) {
|
|
196
|
-
*status = ReplaceStatusMessage(
|
|
197
|
-
*status, status->message().empty()
|
|
198
|
-
? value
|
|
199
|
-
: absl::StrCat(value, " (", status->message(), ")"));
|
|
200
|
-
}
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
status->SetPayload(GetStatusStrPropertyUrl(key), absl::Cord(value));
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
std::optional<std::string> StatusGetStr(const absl::Status& status,
|
|
207
|
-
StatusStrProperty key) {
|
|
208
|
-
if (IsErrorFlattenEnabled() && key == StatusStrProperty::kGrpcMessage) {
|
|
209
|
-
return std::string(status.message());
|
|
210
|
-
}
|
|
211
|
-
auto p = status.GetPayload(GetStatusStrPropertyUrl(key));
|
|
212
|
-
if (p.has_value()) {
|
|
213
|
-
return std::string(*p);
|
|
214
|
-
}
|
|
215
|
-
return {};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
void StatusAddChild(absl::Status* status, absl::Status child) {
|
|
219
|
-
if (IsErrorFlattenEnabled()) {
|
|
220
|
-
// If the child is OK, there's nothing to do.
|
|
221
|
-
if (child.ok()) return;
|
|
222
|
-
// If the parent is OK, replace it with the child.
|
|
223
|
-
if (status->ok()) {
|
|
224
|
-
*status = std::move(child);
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
// Parent and child are both non-OK, so we need to merge.
|
|
228
|
-
absl::Status new_status(
|
|
229
|
-
// Prefer any other code over UNKNOWN.
|
|
230
|
-
status->code() == absl::StatusCode::kUnknown ? child.code()
|
|
231
|
-
: status->code(),
|
|
232
|
-
absl::StrCat(status->message(), " (", child.message(), ")"));
|
|
233
|
-
// TODO(roth): Remove this once we eliminate all status attributes.
|
|
234
|
-
status->ForEachPayload(
|
|
235
|
-
[&](absl::string_view type_url, const absl::Cord& payload) {
|
|
148
|
+
child.ForEachPayload(
|
|
149
|
+
[&](absl::string_view type_url, const absl::Cord& payload) {
|
|
150
|
+
// If the original error already has the attribute, don't overwrite
|
|
151
|
+
// it.
|
|
152
|
+
if (!new_status.GetPayload(type_url).has_value()) {
|
|
236
153
|
new_status.SetPayload(type_url, payload);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
// If the original error already has the attribute, don't overwrite
|
|
241
|
-
// it.
|
|
242
|
-
if (!new_status.GetPayload(type_url).has_value()) {
|
|
243
|
-
new_status.SetPayload(type_url, payload);
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
*status = std::move(new_status);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
upb::Arena arena;
|
|
250
|
-
// Serialize msg to buf
|
|
251
|
-
google_rpc_Status* msg = internal::StatusToProto(child, arena.ptr());
|
|
252
|
-
size_t buf_len = 0;
|
|
253
|
-
char* buf = google_rpc_Status_serialize(msg, arena.ptr(), &buf_len);
|
|
254
|
-
// Append (msg-length and msg) to children payload
|
|
255
|
-
auto old_children = status->GetPayload(kChildrenPropertyUrl);
|
|
256
|
-
absl::Cord children;
|
|
257
|
-
if (old_children.has_value()) {
|
|
258
|
-
children = *old_children;
|
|
259
|
-
}
|
|
260
|
-
char head_buf[sizeof(uint32_t)];
|
|
261
|
-
EncodeUInt32ToBytes(buf_len, head_buf);
|
|
262
|
-
children.Append(absl::string_view(head_buf, sizeof(uint32_t)));
|
|
263
|
-
children.Append(absl::string_view(buf, buf_len));
|
|
264
|
-
status->SetPayload(kChildrenPropertyUrl, std::move(children));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
*status = std::move(new_status);
|
|
265
157
|
}
|
|
266
158
|
|
|
267
|
-
std::vector<absl::Status> StatusGetChildren(absl::Status status) {
|
|
268
|
-
auto children = status.GetPayload(kChildrenPropertyUrl);
|
|
269
|
-
return children.has_value() ? ParseChildren(*children)
|
|
270
|
-
: std::vector<absl::Status>();
|
|
271
|
-
}
|
|
159
|
+
std::vector<absl::Status> StatusGetChildren(absl::Status status) { return {}; }
|
|
272
160
|
|
|
273
161
|
std::string StatusToString(const absl::Status& status) {
|
|
274
162
|
if (status.ok()) {
|
|
@@ -280,71 +168,62 @@ std::string StatusToString(const absl::Status& status) {
|
|
|
280
168
|
absl::StrAppend(&head, ":", status.message());
|
|
281
169
|
}
|
|
282
170
|
std::vector<std::string> kvs;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
kvs.push_back(absl::StrCat(type_url, ":", payload_view));
|
|
303
|
-
} else if (absl::StartsWith(type_url, kTypeStrTag)) {
|
|
304
|
-
type_url.remove_prefix(kTypeStrTag.size());
|
|
305
|
-
kvs.push_back(absl::StrCat(type_url, ":\"",
|
|
306
|
-
absl::CHexEscape(payload_view), "\""));
|
|
307
|
-
} else if (absl::StartsWith(type_url, kTypeTimeTag)) {
|
|
308
|
-
type_url.remove_prefix(kTypeTimeTag.size());
|
|
309
|
-
absl::Time t;
|
|
310
|
-
if (absl::ParseTime(absl::RFC3339_full, payload_view, &t, nullptr)) {
|
|
311
|
-
kvs.push_back(
|
|
312
|
-
absl::StrCat(type_url, ":\"", absl::FormatTime(t), "\""));
|
|
171
|
+
status.ForEachPayload(
|
|
172
|
+
[&](absl::string_view type_url, const absl::Cord& payload) {
|
|
173
|
+
if (absl::StartsWith(type_url, kTypeUrlPrefix)) {
|
|
174
|
+
type_url.remove_prefix(kTypeUrlPrefix.size());
|
|
175
|
+
absl::string_view payload_view;
|
|
176
|
+
std::string payload_storage;
|
|
177
|
+
if (payload.TryFlat().has_value()) {
|
|
178
|
+
payload_view = payload.TryFlat().value();
|
|
179
|
+
} else {
|
|
180
|
+
payload_storage = std::string(payload);
|
|
181
|
+
payload_view = payload_storage;
|
|
182
|
+
}
|
|
183
|
+
if (absl::StartsWith(type_url, kTypeIntTag)) {
|
|
184
|
+
type_url.remove_prefix(kTypeIntTag.size());
|
|
185
|
+
kvs.push_back(absl::StrCat(type_url, ":", payload_view));
|
|
186
|
+
} else {
|
|
187
|
+
kvs.push_back(absl::StrCat(type_url, ":\"",
|
|
188
|
+
absl::CHexEscape(payload_view), "\""));
|
|
189
|
+
}
|
|
313
190
|
} else {
|
|
314
|
-
|
|
315
|
-
|
|
191
|
+
auto payload_view = payload.TryFlat();
|
|
192
|
+
std::string payload_str = absl::CHexEscape(
|
|
193
|
+
payload_view.has_value() ? *payload_view : std::string(payload));
|
|
194
|
+
kvs.push_back(absl::StrCat(type_url, ":\"", payload_str, "\""));
|
|
316
195
|
}
|
|
317
|
-
}
|
|
318
|
-
kvs.push_back(absl::StrCat(type_url, ":\"",
|
|
319
|
-
absl::CHexEscape(payload_view), "\""));
|
|
320
|
-
}
|
|
321
|
-
} else {
|
|
322
|
-
auto payload_view = payload.TryFlat();
|
|
323
|
-
std::string payload_str = absl::CHexEscape(
|
|
324
|
-
payload_view.has_value() ? *payload_view : std::string(payload));
|
|
325
|
-
kvs.push_back(absl::StrCat(type_url, ":\"", payload_str, "\""));
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
if (children.has_value()) {
|
|
329
|
-
std::vector<absl::Status> children_status = ParseChildren(*children);
|
|
330
|
-
std::vector<std::string> children_text;
|
|
331
|
-
children_text.reserve(children_status.size());
|
|
332
|
-
for (const absl::Status& child_status : children_status) {
|
|
333
|
-
children_text.push_back(StatusToString(child_status));
|
|
334
|
-
}
|
|
335
|
-
kvs.push_back(
|
|
336
|
-
absl::StrCat("children:[", absl::StrJoin(children_text, ", "), "]"));
|
|
337
|
-
}
|
|
196
|
+
});
|
|
338
197
|
return kvs.empty() ? head
|
|
339
198
|
: absl::StrCat(head, " {", absl::StrJoin(kvs, ", "), "}");
|
|
340
199
|
}
|
|
341
200
|
|
|
201
|
+
namespace {
|
|
202
|
+
|
|
203
|
+
absl::Status ReplaceStatusMessage(const absl::Status& status,
|
|
204
|
+
absl::string_view message) {
|
|
205
|
+
absl::Status new_status(status.code(), message);
|
|
206
|
+
status.ForEachPayload(
|
|
207
|
+
[&](absl::string_view type_url, const absl::Cord& payload) {
|
|
208
|
+
new_status.SetPayload(type_url, payload);
|
|
209
|
+
});
|
|
210
|
+
return new_status;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
} // namespace
|
|
214
|
+
|
|
342
215
|
absl::Status AddMessagePrefix(absl::string_view prefix,
|
|
343
216
|
const absl::Status& status) {
|
|
344
217
|
return ReplaceStatusMessage(status,
|
|
345
218
|
absl::StrCat(prefix, ": ", status.message()));
|
|
346
219
|
}
|
|
347
220
|
|
|
221
|
+
absl::Status AddMessageDetail(absl::string_view detail,
|
|
222
|
+
const absl::Status& status) {
|
|
223
|
+
return ReplaceStatusMessage(
|
|
224
|
+
status, absl::StrCat(status.message(), " (", detail, ")"));
|
|
225
|
+
}
|
|
226
|
+
|
|
348
227
|
namespace internal {
|
|
349
228
|
|
|
350
229
|
google_rpc_Status* StatusToProto(const absl::Status& status, upb_Arena* arena) {
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
#ifndef GRPC_SRC_CORE_UTIL_STATUS_HELPER_H
|
|
20
20
|
#define GRPC_SRC_CORE_UTIL_STATUS_HELPER_H
|
|
21
21
|
|
|
22
|
-
#include <grpc/support/port_platform.h>
|
|
23
22
|
#include <stdint.h>
|
|
24
23
|
|
|
25
24
|
#include <optional>
|
|
@@ -29,7 +28,6 @@
|
|
|
29
28
|
#include "src/core/util/debug_location.h"
|
|
30
29
|
#include "absl/status/status.h"
|
|
31
30
|
#include "absl/strings/string_view.h"
|
|
32
|
-
#include "absl/time/time.h"
|
|
33
31
|
|
|
34
32
|
extern "C" {
|
|
35
33
|
struct google_rpc_Status;
|
|
@@ -44,6 +42,22 @@ struct upb_Arena;
|
|
|
44
42
|
|
|
45
43
|
namespace grpc_core {
|
|
46
44
|
|
|
45
|
+
/// Adds prefix to the message of status.
|
|
46
|
+
absl::Status AddMessagePrefix(absl::string_view prefix,
|
|
47
|
+
const absl::Status& status);
|
|
48
|
+
|
|
49
|
+
/// Adds detail to the message of status in parens.
|
|
50
|
+
absl::Status AddMessageDetail(absl::string_view detail,
|
|
51
|
+
const absl::Status& status);
|
|
52
|
+
|
|
53
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
54
|
+
//
|
|
55
|
+
// ALL APIs BELOW ARE DEPRECATED!
|
|
56
|
+
//
|
|
57
|
+
// Callers should instead use absl::Status APIs directly.
|
|
58
|
+
//
|
|
59
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
60
|
+
|
|
47
61
|
/// This enum should have the same value of grpc_error_ints
|
|
48
62
|
enum class StatusIntProperty {
|
|
49
63
|
/// stream identifier: for errors that are associated with an individual
|
|
@@ -65,13 +79,6 @@ enum class StatusIntProperty {
|
|
|
65
79
|
kLbPolicyDrop,
|
|
66
80
|
};
|
|
67
81
|
|
|
68
|
-
/// This enum should have the same value of grpc_error_strs
|
|
69
|
-
// TODO(roth): Remove this after error_flatten experiment is removed.
|
|
70
|
-
enum class StatusStrProperty {
|
|
71
|
-
/// peer that we were trying to communicate when this error occurred
|
|
72
|
-
kGrpcMessage,
|
|
73
|
-
};
|
|
74
|
-
|
|
75
82
|
/// Creates a status with given additional information
|
|
76
83
|
absl::Status StatusCreate(absl::StatusCode code, absl::string_view msg,
|
|
77
84
|
const DebugLocation& location,
|
|
@@ -85,14 +92,6 @@ GRPC_MUST_USE_RESULT
|
|
|
85
92
|
std::optional<intptr_t> StatusGetInt(const absl::Status& status,
|
|
86
93
|
StatusIntProperty key);
|
|
87
94
|
|
|
88
|
-
/// Sets the str property to the status
|
|
89
|
-
void StatusSetStr(absl::Status* status, StatusStrProperty key,
|
|
90
|
-
absl::string_view value);
|
|
91
|
-
|
|
92
|
-
/// Gets the str property from the status
|
|
93
|
-
GRPC_MUST_USE_RESULT std::optional<std::string> StatusGetStr(
|
|
94
|
-
const absl::Status& status, StatusStrProperty key);
|
|
95
|
-
|
|
96
95
|
/// Adds a child status to status
|
|
97
96
|
void StatusAddChild(absl::Status* status, absl::Status child);
|
|
98
97
|
|
|
@@ -107,10 +106,6 @@ GRPC_MUST_USE_RESULT std::vector<absl::Status> StatusGetChildren(
|
|
|
107
106
|
/// CANCELLATION:SampleMessage {errno:'2021', line:'54', children:[ABORTED]}
|
|
108
107
|
GRPC_MUST_USE_RESULT std::string StatusToString(const absl::Status& status);
|
|
109
108
|
|
|
110
|
-
/// Adds prefix to the message of status.
|
|
111
|
-
absl::Status AddMessagePrefix(absl::string_view prefix,
|
|
112
|
-
const absl::Status& status);
|
|
113
|
-
|
|
114
109
|
namespace internal {
|
|
115
110
|
|
|
116
111
|
/// Builds a upb message, google_rpc_Status from a status
|
|
@@ -26,10 +26,9 @@
|
|
|
26
26
|
#include <vector>
|
|
27
27
|
|
|
28
28
|
#include "src/core/config/core_configuration.h"
|
|
29
|
+
#include "src/core/config/experiment_env_var.h"
|
|
29
30
|
#include "src/core/credentials/transport/tls/grpc_tls_certificate_provider.h"
|
|
30
31
|
#include "src/core/util/down_cast.h"
|
|
31
|
-
#include "src/core/util/env.h"
|
|
32
|
-
#include "src/core/util/string.h"
|
|
33
32
|
#include "absl/log/log.h"
|
|
34
33
|
|
|
35
34
|
namespace grpc_core {
|
|
@@ -38,14 +37,6 @@ namespace {
|
|
|
38
37
|
|
|
39
38
|
constexpr absl::string_view kFileWatcherPlugin = "file_watcher";
|
|
40
39
|
|
|
41
|
-
bool SpiffeBundleMapEnabled() {
|
|
42
|
-
auto value = GetEnv("GRPC_EXPERIMENTAL_XDS_MTLS_SPIFFE");
|
|
43
|
-
if (!value.has_value()) return false;
|
|
44
|
-
bool parsed_value;
|
|
45
|
-
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
|
|
46
|
-
return parse_succeeded && parsed_value;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
40
|
} // namespace
|
|
50
41
|
|
|
51
42
|
//
|
|
@@ -115,7 +106,7 @@ void FileWatcherCertificateProviderFactory::Config::JsonPostLoad(
|
|
|
115
106
|
"fields \"certificate_file\" and \"private_key_file\" must be both set "
|
|
116
107
|
"or both unset");
|
|
117
108
|
}
|
|
118
|
-
if (
|
|
109
|
+
if (IsExperimentEnvVarEnabled("GRPC_EXPERIMENTAL_XDS_MTLS_SPIFFE")) {
|
|
119
110
|
if (json.object().find("certificate_file") == json.object().end() &&
|
|
120
111
|
json.object().find("ca_certificate_file") == json.object().end() &&
|
|
121
112
|
json.object().find("spiffe_bundle_map_file") == json.object().end()) {
|
|
@@ -24,14 +24,13 @@
|
|
|
24
24
|
#include <utility>
|
|
25
25
|
#include <vector>
|
|
26
26
|
|
|
27
|
+
#include "src/core/config/experiment_env_var.h"
|
|
27
28
|
#include "src/core/util/down_cast.h"
|
|
28
|
-
#include "src/core/util/env.h"
|
|
29
29
|
#include "src/core/util/json/json.h"
|
|
30
30
|
#include "src/core/util/json/json_object_loader.h"
|
|
31
31
|
#include "src/core/util/json/json_reader.h"
|
|
32
32
|
#include "src/core/util/json/json_writer.h"
|
|
33
33
|
#include "src/core/util/ref_counted_ptr.h"
|
|
34
|
-
#include "src/core/util/string.h"
|
|
35
34
|
#include "absl/status/status.h"
|
|
36
35
|
#include "absl/status/statusor.h"
|
|
37
36
|
#include "absl/strings/match.h"
|
|
@@ -42,11 +41,7 @@ namespace grpc_core {
|
|
|
42
41
|
|
|
43
42
|
// TODO(roth): Remove this once the feature passes interop tests.
|
|
44
43
|
bool XdsExtProcOnClientEnabled() {
|
|
45
|
-
|
|
46
|
-
if (!value.has_value()) return false;
|
|
47
|
-
bool parsed_value;
|
|
48
|
-
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
|
|
49
|
-
return parse_succeeded && parsed_value;
|
|
44
|
+
return IsExperimentEnvVarEnabled("GRPC_EXPERIMENTAL_XDS_EXT_PROC_ON_CLIENT");
|
|
50
45
|
}
|
|
51
46
|
|
|
52
47
|
//
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
#include "google/protobuf/struct.upb.h"
|
|
41
41
|
#include "google/protobuf/wrappers.upb.h"
|
|
42
42
|
#include "src/core/config/core_configuration.h"
|
|
43
|
+
#include "src/core/config/experiment_env_var.h"
|
|
43
44
|
#include "src/core/lib/debug/trace.h"
|
|
44
45
|
#include "src/core/load_balancing/lb_policy_registry.h"
|
|
45
46
|
#include "src/core/util/down_cast.h"
|
|
46
|
-
#include "src/core/util/env.h"
|
|
47
47
|
#include "src/core/util/grpc_check.h"
|
|
48
48
|
#include "src/core/util/host_port.h"
|
|
49
49
|
#include "src/core/util/time.h"
|
|
@@ -68,24 +68,11 @@ namespace grpc_core {
|
|
|
68
68
|
|
|
69
69
|
// TODO(roth): Remove this once the feature passes interop tests.
|
|
70
70
|
bool XdsHttpConnectEnabled() {
|
|
71
|
-
|
|
72
|
-
if (!value.has_value()) return false;
|
|
73
|
-
bool parsed_value;
|
|
74
|
-
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
|
|
75
|
-
return parse_succeeded && parsed_value;
|
|
71
|
+
return IsExperimentEnvVarEnabled("GRPC_EXPERIMENTAL_XDS_HTTP_CONNECT");
|
|
76
72
|
}
|
|
77
73
|
|
|
78
74
|
namespace {
|
|
79
75
|
|
|
80
|
-
// TODO(mlumish): Remove this after the 1.81 release.
|
|
81
|
-
bool XdsSniEnabled() {
|
|
82
|
-
auto value = GetEnv("GRPC_EXPERIMENTAL_XDS_SNI");
|
|
83
|
-
if (!value.has_value()) return true;
|
|
84
|
-
bool parsed_value;
|
|
85
|
-
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
|
|
86
|
-
return parse_succeeded && parsed_value;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
76
|
constexpr absl::string_view kUpstreamTlsContextType =
|
|
90
77
|
"envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext";
|
|
91
78
|
|
|
@@ -111,7 +98,9 @@ XdsClusterResource::UpstreamTlsContext UpstreamTlsContextParse(
|
|
|
111
98
|
errors->AddError("can't decode UpstreamTlsContext");
|
|
112
99
|
return {};
|
|
113
100
|
}
|
|
114
|
-
|
|
101
|
+
// TODO(mlumish): Remove this conditional after the 1.81 release.
|
|
102
|
+
if (IsExperimentEnvVarEnabled("GRPC_EXPERIMENTAL_XDS_SNI",
|
|
103
|
+
/*default_value=*/true)) {
|
|
115
104
|
upstream_tls_context.sni = UpbStringToStdString(
|
|
116
105
|
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_sni(
|
|
117
106
|
upstream_tls_context_proto));
|