grpc 1.30.2 → 1.31.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +560 -619
- data/include/grpc/grpc_security_constants.h +3 -0
- data/include/grpc/impl/codegen/grpc_types.h +7 -5
- data/include/grpc/impl/codegen/port_platform.h +0 -32
- data/src/core/ext/filters/client_channel/backend_metric.cc +12 -9
- data/src/core/ext/filters/client_channel/client_channel.cc +406 -265
- data/src/core/ext/filters/client_channel/config_selector.cc +62 -0
- data/src/core/ext/filters/client_channel/config_selector.h +93 -0
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -2
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -0
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +6 -5
- data/src/core/ext/filters/client_channel/http_proxy.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +39 -23
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +4 -6
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc +376 -68
- data/src/core/ext/filters/client_channel/lb_policy_registry.cc +4 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +5 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +6 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc +8 -6
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +9 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +7 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +33 -48
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -2
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +21 -18
- data/src/core/ext/filters/client_channel/resolver_registry.cc +13 -14
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +6 -7
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +33 -28
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +39 -20
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +142 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +1 -1
- data/src/core/ext/filters/client_channel/xds/xds_api.cc +327 -123
- data/src/core/ext/filters/client_channel/xds/xds_api.h +72 -7
- data/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +12 -23
- data/src/core/ext/filters/client_channel/xds/xds_client.cc +112 -33
- data/src/core/ext/filters/client_channel/xds/xds_client_stats.h +10 -10
- data/src/core/ext/filters/http/client/http_client_filter.cc +5 -5
- data/src/core/ext/filters/http/http_filters_plugin.cc +2 -1
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +74 -33
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.h +3 -1
- data/src/core/ext/filters/message_size/message_size_filter.cc +56 -80
- data/src/core/ext/filters/message_size/message_size_filter.h +6 -0
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +383 -347
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +6 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -13
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +19 -4
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +22 -27
- data/src/core/ext/transport/chttp2/transport/flow_control.h +14 -16
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +4 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +12 -13
- data/src/core/ext/transport/chttp2/transport/frame_settings.cc +6 -7
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +9 -12
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +25 -29
- data/src/core/ext/transport/chttp2/transport/hpack_table.cc +13 -17
- data/src/core/ext/transport/chttp2/transport/internal.h +13 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +33 -43
- data/src/core/ext/transport/chttp2/transport/writing.cc +9 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +35 -15
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +3 -4
- data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/auth/common.upb.h +80 -69
- data/src/core/ext/upb-generated/envoy/api/v2/auth/secret.upb.h +24 -23
- data/src/core/ext/upb-generated/envoy/api/v2/auth/tls.upb.h +66 -56
- data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/api/v2/cluster.upb.h +317 -311
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +42 -34
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +79 -61
- data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +55 -49
- data/src/core/ext/upb-generated/envoy/api/v2/core/backoff.upb.h +9 -8
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +163 -169
- data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +51 -45
- data/src/core/ext/upb-generated/envoy/api/v2/core/event_service_config.upb.h +4 -5
- data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +107 -100
- data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +137 -117
- data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +9 -9
- data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +105 -87
- data/src/core/ext/upb-generated/envoy/api/v2/core/socket_option.upb.h +12 -13
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +95 -101
- data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint.upb.h +49 -65
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint_components.upb.h +49 -42
- data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +70 -62
- data/src/core/ext/upb-generated/envoy/api/v2/lds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/listener.upb.h +81 -65
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/api/v2/listener/listener_components.upb.h +91 -80
- data/src/core/ext/upb-generated/envoy/api/v2/listener/udp_listener_config.upb.h +9 -10
- data/src/core/ext/upb-generated/envoy/api/v2/rds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/api/v2/route.upb.h +36 -31
- data/src/core/ext/upb-generated/envoy/api/v2/route/route.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/api/v2/route/route_components.upb.h +648 -696
- data/src/core/ext/upb-generated/envoy/api/v2/scoped_route.upb.h +16 -15
- data/src/core/ext/upb-generated/envoy/api/v2/srds.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/filter/accesslog/v2/accesslog.upb.h +95 -88
- data/src/core/ext/upb-generated/envoy/config/filter/network/http_connection_manager/v2/http_connection_manager.upb.h +234 -199
- data/src/core/ext/upb-generated/envoy/config/listener/v2/api_listener.upb.h +5 -5
- data/src/core/ext/upb-generated/envoy/config/trace/v2/http_tracer.upb.h +13 -13
- data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +1 -2
- data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +20 -18
- data/src/core/ext/upb-generated/envoy/type/http.upb.h +0 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/regex.upb.h +18 -17
- data/src/core/ext/upb-generated/envoy/type/matcher/string.upb.h +14 -14
- data/src/core/ext/upb-generated/envoy/type/metadata/v2/metadata.upb.h +23 -23
- data/src/core/ext/upb-generated/envoy/type/percent.upb.h +8 -9
- data/src/core/ext/upb-generated/envoy/type/range.upb.h +15 -16
- data/src/core/ext/upb-generated/envoy/type/semantic_version.upb.h +7 -8
- data/src/core/ext/upb-generated/envoy/type/tracing/v2/custom_tag.upb.h +36 -35
- data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +0 -1
- data/src/core/ext/upb-generated/google/api/http.upb.h +29 -28
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +3 -3
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +412 -386
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +1 -2
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +33 -54
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +5 -6
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +27 -28
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +8 -8
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +1 -1
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +32 -45
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +157 -178
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +14 -13
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +6 -7
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +59 -56
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +11 -12
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +0 -1
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +5 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +6 -6
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +41 -68
- data/src/core/ext/upb-generated/validate/validate.upb.h +536 -535
- data/src/core/lib/channel/channel_trace.cc +2 -6
- data/src/core/lib/channel/channelz.cc +5 -15
- data/src/core/lib/gpr/log_linux.cc +6 -8
- data/src/core/lib/gpr/log_posix.cc +6 -8
- data/src/core/lib/gpr/string.cc +10 -9
- data/src/core/lib/gpr/string.h +4 -2
- data/src/core/lib/gprpp/global_config_env.cc +8 -6
- data/src/core/lib/http/httpcli.cc +13 -10
- data/src/core/lib/http/httpcli_security_connector.cc +5 -5
- data/src/core/lib/iomgr/cfstream_handle.cc +1 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +10 -10
- data/src/core/lib/iomgr/error_cfstream.cc +9 -8
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -6
- data/src/core/lib/iomgr/ev_epollex_linux.cc +15 -21
- data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
- data/src/core/lib/iomgr/ev_posix.cc +2 -0
- data/src/core/lib/iomgr/iomgr.cc +10 -0
- data/src/core/lib/iomgr/iomgr.h +10 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.cc +14 -0
- data/src/core/lib/iomgr/port.h +1 -21
- data/src/core/lib/iomgr/resolve_address_custom.cc +13 -18
- data/src/core/lib/iomgr/resolve_address_windows.cc +8 -8
- data/src/core/lib/iomgr/resource_quota.cc +34 -31
- data/src/core/lib/iomgr/sockaddr_utils.cc +7 -5
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +95 -55
- data/src/core/lib/iomgr/socket_windows.cc +4 -5
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +9 -11
- data/src/core/lib/iomgr/tcp_client_custom.cc +6 -9
- data/src/core/lib/iomgr/tcp_client_posix.cc +27 -36
- data/src/core/lib/iomgr/tcp_client_windows.cc +9 -9
- data/src/core/lib/iomgr/tcp_custom.cc +1 -1
- data/src/core/lib/iomgr/tcp_custom.h +1 -1
- data/src/core/lib/iomgr/tcp_server.cc +3 -4
- data/src/core/lib/iomgr/tcp_server.h +7 -5
- data/src/core/lib/iomgr/tcp_server_custom.cc +6 -14
- data/src/core/lib/iomgr/tcp_server_posix.cc +34 -41
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -7
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +4 -9
- data/src/core/lib/iomgr/tcp_server_windows.cc +16 -16
- data/src/core/lib/iomgr/timer_generic.cc +13 -12
- data/src/core/lib/iomgr/udp_server.cc +24 -23
- data/src/core/lib/iomgr/udp_server.h +5 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +9 -14
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +5 -2
- data/src/core/lib/json/json_reader.cc +20 -21
- data/src/core/lib/security/credentials/credentials.h +5 -3
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +8 -6
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +12 -9
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +7 -4
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +19 -28
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -6
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +20 -0
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +10 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +10 -0
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +10 -10
- data/src/core/lib/security/security_connector/security_connector.cc +2 -0
- data/src/core/lib/security/security_connector/security_connector.h +1 -1
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +18 -11
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +5 -0
- data/src/core/lib/security/security_connector/ssl_utils.cc +44 -23
- data/src/core/lib/security/security_connector/ssl_utils.h +6 -2
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +27 -24
- data/src/core/lib/security/transport/client_auth_filter.cc +10 -9
- data/src/core/lib/security/util/json_util.cc +12 -13
- data/src/core/lib/slice/slice.cc +38 -1
- data/src/core/lib/slice/slice_internal.h +1 -0
- data/src/core/lib/surface/call.cc +40 -41
- data/src/core/lib/surface/completion_queue.cc +271 -14
- data/src/core/lib/surface/completion_queue.h +8 -0
- data/src/core/lib/surface/init.cc +2 -0
- data/src/core/lib/surface/server.cc +565 -632
- data/src/core/lib/surface/server.h +34 -12
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/transport.h +6 -0
- data/src/core/lib/uri/uri_parser.cc +8 -15
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +23 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -0
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +2 -0
- data/src/core/tsi/ssl_transport_security.cc +102 -11
- data/src/core/tsi/ssl_transport_security.h +14 -2
- data/src/core/tsi/transport_security_interface.h +5 -0
- data/src/ruby/ext/grpc/extconf.rb +5 -2
- data/src/ruby/ext/grpc/rb_call.c +3 -2
- data/src/ruby/ext/grpc/rb_call.h +4 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +54 -10
- data/src/ruby/lib/grpc/generic/interceptors.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/boringssl-with-bazel/err_data.c +89 -83
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn_pack.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_enum.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_int.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/f_string.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +12 -52
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +0 -22
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp_asn1.c +143 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/aes/mode_wrappers.c +17 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +11 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +13 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-x86_64.c +24 -23
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +20 -16
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/util.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +62 -0
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +29 -15
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +7 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +36 -5
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +0 -29
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +116 -363
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +7 -45
- data/third_party/boringssl-with-bazel/src/crypto/x509/a_strex.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/algorithm.c +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509.c +0 -67
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +13 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +10 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +41 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +28 -9
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +35 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +0 -154
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +28 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +5 -0
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +74 -35
- data/third_party/boringssl-with-bazel/src/include/openssl/aes.h +16 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +22 -22
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +69 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +33 -16
- data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +1 -10
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +789 -715
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +3 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +9 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +9 -0
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +17 -14
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -7
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +28 -0
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +4 -24
- data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +5 -5
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +45 -24
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +31 -21
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +12 -9
- data/third_party/upb/upb/decode.c +467 -504
- data/third_party/upb/upb/encode.c +163 -121
- data/third_party/upb/upb/msg.c +130 -64
- data/third_party/upb/upb/msg.h +418 -14
- data/third_party/upb/upb/port_def.inc +35 -6
- data/third_party/upb/upb/port_undef.inc +8 -1
- data/third_party/upb/upb/table.c +53 -75
- data/third_party/upb/upb/table.int.h +11 -43
- data/third_party/upb/upb/upb.c +148 -124
- data/third_party/upb/upb/upb.h +65 -147
- data/third_party/upb/upb/upb.hpp +86 -0
- metadata +40 -37
- data/third_party/upb/upb/generated_util.h +0 -105
@@ -20,9 +20,14 @@
|
|
20
20
|
#include <limits.h>
|
21
21
|
#include <string.h>
|
22
22
|
|
23
|
+
#include "absl/container/inlined_vector.h"
|
24
|
+
#include "absl/strings/match.h"
|
25
|
+
#include "absl/strings/numbers.h"
|
23
26
|
#include "absl/strings/str_cat.h"
|
27
|
+
#include "absl/strings/str_join.h"
|
24
28
|
#include "absl/strings/str_split.h"
|
25
29
|
#include "absl/strings/string_view.h"
|
30
|
+
#include "re2/re2.h"
|
26
31
|
|
27
32
|
#include <grpc/grpc.h>
|
28
33
|
|
@@ -30,6 +35,7 @@
|
|
30
35
|
#include "src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h"
|
31
36
|
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
|
32
37
|
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
|
38
|
+
#include "src/core/ext/filters/client_channel/xds/xds_api.h"
|
33
39
|
#include "src/core/lib/channel/channel_args.h"
|
34
40
|
#include "src/core/lib/gpr/string.h"
|
35
41
|
#include "src/core/lib/gprpp/orphanable.h"
|
@@ -50,12 +56,8 @@ constexpr char kXdsRouting[] = "xds_routing_experimental";
|
|
50
56
|
// Config for xds_routing LB policy.
|
51
57
|
class XdsRoutingLbConfig : public LoadBalancingPolicy::Config {
|
52
58
|
public:
|
53
|
-
struct Matcher {
|
54
|
-
std::string service;
|
55
|
-
std::string method;
|
56
|
-
};
|
57
59
|
struct Route {
|
58
|
-
|
60
|
+
XdsApi::RdsUpdate::RdsRoute::Matchers matchers;
|
59
61
|
std::string action;
|
60
62
|
};
|
61
63
|
using RouteTable = std::vector<Route>;
|
@@ -109,20 +111,24 @@ class XdsRoutingLb : public LoadBalancingPolicy {
|
|
109
111
|
class RoutePicker : public SubchannelPicker {
|
110
112
|
public:
|
111
113
|
struct Route {
|
112
|
-
|
114
|
+
const XdsApi::RdsUpdate::RdsRoute::Matchers* matchers;
|
113
115
|
RefCountedPtr<ChildPickerWrapper> picker;
|
114
116
|
};
|
115
117
|
|
116
118
|
// Maintains an ordered xds route table as provided by RDS response.
|
117
119
|
using RouteTable = std::vector<Route>;
|
118
120
|
|
119
|
-
|
120
|
-
|
121
|
+
RoutePicker(RouteTable route_table,
|
122
|
+
RefCountedPtr<XdsRoutingLbConfig> config)
|
123
|
+
: route_table_(std::move(route_table)), config_(std::move(config)) {}
|
121
124
|
|
122
125
|
PickResult Pick(PickArgs args) override;
|
123
126
|
|
124
127
|
private:
|
125
128
|
RouteTable route_table_;
|
129
|
+
// Take a reference to config so that we can use
|
130
|
+
// XdsApi::RdsUpdate::RdsRoute::Matchers from it.
|
131
|
+
RefCountedPtr<XdsRoutingLbConfig> config_;
|
126
132
|
};
|
127
133
|
|
128
134
|
// Each XdsRoutingChild holds a ref to its parent XdsRoutingLb.
|
@@ -214,26 +220,131 @@ class XdsRoutingLb : public LoadBalancingPolicy {
|
|
214
220
|
// XdsRoutingLb::RoutePicker
|
215
221
|
//
|
216
222
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
223
|
+
bool PathMatch(
|
224
|
+
const absl::string_view& path,
|
225
|
+
const XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher& path_matcher) {
|
226
|
+
switch (path_matcher.type) {
|
227
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
228
|
+
PREFIX:
|
229
|
+
return absl::StartsWith(path, path_matcher.string_matcher);
|
230
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
231
|
+
PATH:
|
232
|
+
return path == path_matcher.string_matcher;
|
233
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::PathMatcher::PathMatcherType::
|
234
|
+
REGEX:
|
235
|
+
return RE2::FullMatch(path.data(), *path_matcher.regex_matcher);
|
236
|
+
default:
|
237
|
+
return false;
|
238
|
+
}
|
239
|
+
}
|
240
|
+
|
241
|
+
absl::optional<absl::string_view> GetMetadataValue(
|
242
|
+
const std::string& key,
|
243
|
+
LoadBalancingPolicy::MetadataInterface* initial_metadata,
|
244
|
+
std::string* concatenated_value) {
|
245
|
+
// Find all values for the specified key.
|
246
|
+
GPR_DEBUG_ASSERT(initial_metadata != nullptr);
|
247
|
+
absl::InlinedVector<absl::string_view, 1> values;
|
248
|
+
for (const auto p : *initial_metadata) {
|
249
|
+
if (p.first == key) values.push_back(p.second);
|
250
|
+
}
|
251
|
+
// If none found, no match.
|
252
|
+
if (values.empty()) return absl::nullopt;
|
253
|
+
// If exactly one found, return it as-is.
|
254
|
+
if (values.size() == 1) return values.front();
|
255
|
+
// If more than one found, concatenate the values, using
|
256
|
+
// *concatenated_values as a temporary holding place for the
|
257
|
+
// concatenated string.
|
258
|
+
*concatenated_value = absl::StrJoin(values, ",");
|
259
|
+
return *concatenated_value;
|
260
|
+
}
|
261
|
+
|
262
|
+
bool HeaderMatchHelper(
|
263
|
+
const XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher& header_matcher,
|
264
|
+
LoadBalancingPolicy::MetadataInterface* initial_metadata) {
|
265
|
+
std::string concatenated_value;
|
266
|
+
absl::optional<absl::string_view> value;
|
267
|
+
// Note: If we ever allow binary headers here, we still need to
|
268
|
+
// special-case ignore "grpc-tags-bin" and "grpc-trace-bin", since
|
269
|
+
// they are not visible to the LB policy in grpc-go.
|
270
|
+
if (absl::EndsWith(header_matcher.name, "-bin") ||
|
271
|
+
header_matcher.name == "grpc-previous-rpc-attempts") {
|
272
|
+
value = absl::nullopt;
|
273
|
+
} else if (header_matcher.name == "content-type") {
|
274
|
+
value = "application/grpc";
|
275
|
+
} else {
|
276
|
+
value = GetMetadataValue(header_matcher.name, initial_metadata,
|
277
|
+
&concatenated_value);
|
278
|
+
}
|
279
|
+
if (!value.has_value()) {
|
280
|
+
if (header_matcher.type == XdsApi::RdsUpdate::RdsRoute::Matchers::
|
281
|
+
HeaderMatcher::HeaderMatcherType::PRESENT) {
|
282
|
+
return !header_matcher.present_match;
|
283
|
+
} else {
|
284
|
+
// For all other header matcher types, we need the header value to
|
285
|
+
// exist to consider matches.
|
286
|
+
return false;
|
226
287
|
}
|
227
288
|
}
|
228
|
-
|
229
|
-
|
289
|
+
switch (header_matcher.type) {
|
290
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
291
|
+
HeaderMatcherType::EXACT:
|
292
|
+
return value.value() == header_matcher.string_matcher;
|
293
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
294
|
+
HeaderMatcherType::REGEX:
|
295
|
+
return RE2::FullMatch(value.value().data(), *header_matcher.regex_match);
|
296
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
297
|
+
HeaderMatcherType::RANGE:
|
298
|
+
int64_t int_value;
|
299
|
+
if (!absl::SimpleAtoi(value.value(), &int_value)) {
|
300
|
+
return false;
|
301
|
+
}
|
302
|
+
return int_value >= header_matcher.range_start &&
|
303
|
+
int_value < header_matcher.range_end;
|
304
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
305
|
+
HeaderMatcherType::PREFIX:
|
306
|
+
return absl::StartsWith(value.value(), header_matcher.string_matcher);
|
307
|
+
case XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher::
|
308
|
+
HeaderMatcherType::SUFFIX:
|
309
|
+
return absl::EndsWith(value.value(), header_matcher.string_matcher);
|
310
|
+
default:
|
311
|
+
return false;
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
bool HeadersMatch(
|
316
|
+
const std::vector<XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher>&
|
317
|
+
header_matchers,
|
318
|
+
LoadBalancingPolicy::MetadataInterface* initial_metadata) {
|
319
|
+
for (const auto& header_matcher : header_matchers) {
|
320
|
+
bool match = HeaderMatchHelper(header_matcher, initial_metadata);
|
321
|
+
if (header_matcher.invert_match) match = !match;
|
322
|
+
if (!match) return false;
|
323
|
+
}
|
324
|
+
return true;
|
325
|
+
}
|
326
|
+
|
327
|
+
bool UnderFraction(const uint32_t fraction_per_million) {
|
328
|
+
// Generate a random number in [0, 1000000).
|
329
|
+
const uint32_t random_number = rand() % 1000000;
|
330
|
+
return random_number < fraction_per_million;
|
331
|
+
}
|
332
|
+
|
333
|
+
XdsRoutingLb::PickResult XdsRoutingLb::RoutePicker::Pick(PickArgs args) {
|
230
334
|
for (const Route& route : route_table_) {
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
335
|
+
// Path matching.
|
336
|
+
if (!PathMatch(args.path, route.matchers->path_matcher)) continue;
|
337
|
+
// Header Matching.
|
338
|
+
if (!HeadersMatch(route.matchers->header_matchers, args.initial_metadata)) {
|
339
|
+
continue;
|
340
|
+
}
|
341
|
+
// Match fraction check
|
342
|
+
if (route.matchers->fraction_per_million.has_value() &&
|
343
|
+
!UnderFraction(route.matchers->fraction_per_million.value())) {
|
344
|
+
continue;
|
236
345
|
}
|
346
|
+
// Found a match
|
347
|
+
return route.picker->Pick(args);
|
237
348
|
}
|
238
349
|
PickResult result;
|
239
350
|
result.type = PickResult::PICK_FAILED;
|
@@ -358,7 +469,7 @@ void XdsRoutingLb::UpdateStateLocked() {
|
|
358
469
|
RoutePicker::RouteTable route_table;
|
359
470
|
for (const auto& config_route : config_->route_table()) {
|
360
471
|
RoutePicker::Route route;
|
361
|
-
route.
|
472
|
+
route.matchers = &config_route.matchers;
|
362
473
|
route.picker = actions_[config_route.action]->picker_wrapper();
|
363
474
|
if (route.picker == nullptr) {
|
364
475
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_routing_lb_trace)) {
|
@@ -373,7 +484,7 @@ void XdsRoutingLb::UpdateStateLocked() {
|
|
373
484
|
}
|
374
485
|
route_table.push_back(std::move(route));
|
375
486
|
}
|
376
|
-
picker = absl::make_unique<RoutePicker>(std::move(route_table));
|
487
|
+
picker = absl::make_unique<RoutePicker>(std::move(route_table), config_);
|
377
488
|
break;
|
378
489
|
}
|
379
490
|
case GRPC_CHANNEL_CONNECTING:
|
@@ -683,12 +794,6 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
|
|
683
794
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("no valid routes configured");
|
684
795
|
error_list.push_back(error);
|
685
796
|
}
|
686
|
-
if (!route_table.back().matcher.service.empty() ||
|
687
|
-
!route_table.back().matcher.method.empty()) {
|
688
|
-
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
689
|
-
"default route must not contain service or method");
|
690
|
-
error_list.push_back(error);
|
691
|
-
}
|
692
797
|
if (!actions_to_be_used.empty()) {
|
693
798
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
694
799
|
"some actions were not referenced by any route"));
|
@@ -731,62 +836,265 @@ class XdsRoutingLbFactory : public LoadBalancingPolicyFactory {
|
|
731
836
|
return error_list;
|
732
837
|
}
|
733
838
|
|
734
|
-
static std::vector<grpc_error*>
|
735
|
-
const Json& json, XdsRoutingLbConfig::
|
839
|
+
static std::vector<grpc_error*> ParseRoute(
|
840
|
+
const Json& json, const XdsRoutingLbConfig::ActionMap& action_map,
|
841
|
+
XdsRoutingLbConfig::Route* route,
|
842
|
+
std::set<std::string /*action_name*/>* actions_to_be_used) {
|
736
843
|
std::vector<grpc_error*> error_list;
|
737
844
|
if (json.type() != Json::Type::OBJECT) {
|
738
845
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
739
846
|
"value should be of type object"));
|
740
847
|
return error_list;
|
741
848
|
}
|
742
|
-
// Parse
|
743
|
-
|
849
|
+
// Parse and ensure one and only one path matcher is set: prefix, path, or
|
850
|
+
// regex.
|
851
|
+
bool path_matcher_seen = false;
|
852
|
+
auto it = json.object_value().find("prefix");
|
744
853
|
if (it != json.object_value().end()) {
|
745
854
|
if (it->second.type() != Json::Type::STRING) {
|
746
855
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
747
|
-
"field:
|
856
|
+
"field:prefix error: should be string"));
|
748
857
|
} else {
|
749
|
-
|
858
|
+
path_matcher_seen = true;
|
859
|
+
route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
860
|
+
Matchers::PathMatcher::PathMatcherType::PREFIX;
|
861
|
+
route->matchers.path_matcher.string_matcher = it->second.string_value();
|
750
862
|
}
|
751
863
|
}
|
752
|
-
|
753
|
-
it = json.object_value().find("method");
|
864
|
+
it = json.object_value().find("path");
|
754
865
|
if (it != json.object_value().end()) {
|
755
|
-
if (
|
866
|
+
if (path_matcher_seen) {
|
756
867
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
757
|
-
"field:
|
868
|
+
"field:path error: other path matcher already specified"));
|
758
869
|
} else {
|
759
|
-
|
870
|
+
path_matcher_seen = true;
|
871
|
+
if (it->second.type() != Json::Type::STRING) {
|
872
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
873
|
+
"field:path error: should be string"));
|
874
|
+
} else {
|
875
|
+
route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
876
|
+
Matchers::PathMatcher::PathMatcherType::PATH;
|
877
|
+
route->matchers.path_matcher.string_matcher =
|
878
|
+
it->second.string_value();
|
879
|
+
}
|
760
880
|
}
|
761
881
|
}
|
762
|
-
|
763
|
-
|
764
|
-
|
882
|
+
it = json.object_value().find("regex");
|
883
|
+
if (it != json.object_value().end()) {
|
884
|
+
if (path_matcher_seen) {
|
885
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
886
|
+
"field:regex error: other path matcher already specified"));
|
887
|
+
} else {
|
888
|
+
path_matcher_seen = true;
|
889
|
+
if (it->second.type() != Json::Type::STRING) {
|
890
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
891
|
+
"field:regex error: should be string"));
|
892
|
+
} else {
|
893
|
+
route->matchers.path_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
894
|
+
Matchers::PathMatcher::PathMatcherType::REGEX;
|
895
|
+
route->matchers.path_matcher.regex_matcher =
|
896
|
+
absl::make_unique<RE2>(it->second.string_value());
|
897
|
+
}
|
898
|
+
}
|
765
899
|
}
|
766
|
-
|
767
|
-
}
|
768
|
-
|
769
|
-
static std::vector<grpc_error*> ParseRoute(
|
770
|
-
const Json& json, const XdsRoutingLbConfig::ActionMap& action_map,
|
771
|
-
XdsRoutingLbConfig::Route* route,
|
772
|
-
std::set<std::string /*action_name*/>* actions_to_be_used) {
|
773
|
-
std::vector<grpc_error*> error_list;
|
774
|
-
if (json.type() != Json::Type::OBJECT) {
|
900
|
+
if (!path_matcher_seen) {
|
775
901
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
776
|
-
"
|
777
|
-
return error_list;
|
902
|
+
"one path matcher: prefix, path, or regex is required"));
|
778
903
|
}
|
779
|
-
// Parse
|
780
|
-
|
781
|
-
if (it
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
904
|
+
// Parse Header Matcher: headers.
|
905
|
+
it = json.object_value().find("headers");
|
906
|
+
if (it != json.object_value().end()) {
|
907
|
+
if (it->second.type() != Json::Type::ARRAY) {
|
908
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
909
|
+
"field:headers error: should be array"));
|
910
|
+
} else {
|
911
|
+
const Json::Array& array = it->second.array_value();
|
912
|
+
for (size_t i = 0; i < array.size(); ++i) {
|
913
|
+
const Json& header_json = array[i];
|
914
|
+
if (header_json.type() != Json::Type::OBJECT) {
|
915
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
916
|
+
"value should be of type object"));
|
917
|
+
} else {
|
918
|
+
route->matchers.header_matchers.emplace_back();
|
919
|
+
XdsApi::RdsUpdate::RdsRoute::Matchers::HeaderMatcher&
|
920
|
+
header_matcher = route->matchers.header_matchers.back();
|
921
|
+
auto header_it = header_json.object_value().find("name");
|
922
|
+
if (header_it == header_json.object_value().end()) {
|
923
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
924
|
+
"field:name error:required field missing"));
|
925
|
+
} else {
|
926
|
+
if (header_it->second.type() != Json::Type::STRING) {
|
927
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
928
|
+
"field:name error: should be string"));
|
929
|
+
} else {
|
930
|
+
header_matcher.name = header_it->second.string_value();
|
931
|
+
}
|
932
|
+
}
|
933
|
+
header_it = header_json.object_value().find("invert_match");
|
934
|
+
if (header_it != header_json.object_value().end()) {
|
935
|
+
if (header_it->second.type() == Json::Type::JSON_TRUE) {
|
936
|
+
header_matcher.invert_match = true;
|
937
|
+
} else if (header_it->second.type() == Json::Type::JSON_FALSE) {
|
938
|
+
header_matcher.invert_match = false;
|
939
|
+
} else {
|
940
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
941
|
+
"field:present_match error: should be boolean"));
|
942
|
+
}
|
943
|
+
}
|
944
|
+
// Parse and ensure one and only one header matcher is set per
|
945
|
+
// header matcher.
|
946
|
+
bool header_matcher_seen = false;
|
947
|
+
header_it = header_json.object_value().find("exact_match");
|
948
|
+
if (header_it != header_json.object_value().end()) {
|
949
|
+
header_matcher_seen = true;
|
950
|
+
if (header_it->second.type() != Json::Type::STRING) {
|
951
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
952
|
+
"field:exact_match error: should be string"));
|
953
|
+
} else {
|
954
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
955
|
+
HeaderMatcher::HeaderMatcherType::EXACT;
|
956
|
+
header_matcher.string_matcher =
|
957
|
+
header_it->second.string_value();
|
958
|
+
}
|
959
|
+
}
|
960
|
+
header_it = header_json.object_value().find("regex_match");
|
961
|
+
if (header_it != header_json.object_value().end()) {
|
962
|
+
if (header_matcher_seen) {
|
963
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
964
|
+
"field:regex_match error: other header matcher already "
|
965
|
+
"specified"));
|
966
|
+
} else {
|
967
|
+
header_matcher_seen = true;
|
968
|
+
if (header_it->second.type() != Json::Type::STRING) {
|
969
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
970
|
+
"field:regex_match error: should be string"));
|
971
|
+
} else {
|
972
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
973
|
+
HeaderMatcher::HeaderMatcherType::REGEX;
|
974
|
+
header_matcher.regex_match =
|
975
|
+
absl::make_unique<RE2>(header_it->second.string_value());
|
976
|
+
}
|
977
|
+
}
|
978
|
+
}
|
979
|
+
header_it = header_json.object_value().find("range_match");
|
980
|
+
if (header_it != header_json.object_value().end()) {
|
981
|
+
if (header_matcher_seen) {
|
982
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
983
|
+
"field:range_match error: other header matcher already "
|
984
|
+
"specified"));
|
985
|
+
} else {
|
986
|
+
header_matcher_seen = true;
|
987
|
+
if (header_it->second.type() != Json::Type::OBJECT) {
|
988
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
989
|
+
"field:range_match error: should be object"));
|
990
|
+
} else {
|
991
|
+
auto range_it =
|
992
|
+
header_it->second.object_value().find("start");
|
993
|
+
if (range_it != header_it->second.object_value().end()) {
|
994
|
+
if (range_it->second.type() != Json::Type::NUMBER) {
|
995
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
996
|
+
"field:start error: should be of number"));
|
997
|
+
} else {
|
998
|
+
header_matcher.range_start = gpr_parse_nonnegative_int(
|
999
|
+
range_it->second.string_value().c_str());
|
1000
|
+
}
|
1001
|
+
} else {
|
1002
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1003
|
+
"field:start missing"));
|
1004
|
+
}
|
1005
|
+
range_it = header_it->second.object_value().find("end");
|
1006
|
+
if (range_it != header_it->second.object_value().end()) {
|
1007
|
+
if (range_it->second.type() != Json::Type::NUMBER) {
|
1008
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1009
|
+
"field:end error: should be of number"));
|
1010
|
+
} else {
|
1011
|
+
header_matcher.range_end = gpr_parse_nonnegative_int(
|
1012
|
+
range_it->second.string_value().c_str());
|
1013
|
+
}
|
1014
|
+
} else {
|
1015
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1016
|
+
"field:end missing"));
|
1017
|
+
}
|
1018
|
+
if (header_matcher.range_end > header_matcher.range_start) {
|
1019
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::
|
1020
|
+
Matchers::HeaderMatcher::HeaderMatcherType::RANGE;
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
}
|
1024
|
+
}
|
1025
|
+
header_it = header_json.object_value().find("present_match");
|
1026
|
+
if (header_it != header_json.object_value().end()) {
|
1027
|
+
if (header_matcher_seen) {
|
1028
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1029
|
+
"field:present_match error: other header matcher already "
|
1030
|
+
"specified"));
|
1031
|
+
} else {
|
1032
|
+
header_matcher_seen = true;
|
1033
|
+
if (header_it->second.type() == Json::Type::JSON_TRUE) {
|
1034
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1035
|
+
HeaderMatcher::HeaderMatcherType::PRESENT;
|
1036
|
+
header_matcher.present_match = true;
|
1037
|
+
} else if (header_it->second.type() == Json::Type::JSON_FALSE) {
|
1038
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1039
|
+
HeaderMatcher::HeaderMatcherType::PRESENT;
|
1040
|
+
header_matcher.present_match = false;
|
1041
|
+
} else {
|
1042
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1043
|
+
"field:present_match error: should be boolean"));
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
}
|
1047
|
+
header_it = header_json.object_value().find("prefix_match");
|
1048
|
+
if (header_it != header_json.object_value().end()) {
|
1049
|
+
if (header_matcher_seen) {
|
1050
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1051
|
+
"field:prefix_match error: other header matcher already "
|
1052
|
+
"specified"));
|
1053
|
+
} else {
|
1054
|
+
header_matcher_seen = true;
|
1055
|
+
if (header_it->second.type() != Json::Type::STRING) {
|
1056
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1057
|
+
"field:prefix_match error: should be string"));
|
1058
|
+
} else {
|
1059
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1060
|
+
HeaderMatcher::HeaderMatcherType::PREFIX;
|
1061
|
+
header_matcher.string_matcher =
|
1062
|
+
header_it->second.string_value();
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
header_it = header_json.object_value().find("suffix_match");
|
1067
|
+
if (header_it != header_json.object_value().end()) {
|
1068
|
+
if (header_matcher_seen) {
|
1069
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1070
|
+
"field:suffix_match error: other header matcher already "
|
1071
|
+
"specified"));
|
1072
|
+
} else {
|
1073
|
+
header_matcher_seen = true;
|
1074
|
+
if (header_it->second.type() != Json::Type::STRING) {
|
1075
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1076
|
+
"field:suffix_match error: should be string"));
|
1077
|
+
} else {
|
1078
|
+
header_matcher.type = XdsApi::RdsUpdate::RdsRoute::Matchers::
|
1079
|
+
HeaderMatcher::HeaderMatcherType::SUFFIX;
|
1080
|
+
header_matcher.string_matcher =
|
1081
|
+
header_it->second.string_value();
|
1082
|
+
}
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
}
|
1086
|
+
}
|
1087
|
+
}
|
1088
|
+
}
|
1089
|
+
// Parse Fraction numerator.
|
1090
|
+
it = json.object_value().find("match_fraction");
|
1091
|
+
if (it != json.object_value().end()) {
|
1092
|
+
if (it->second.type() != Json::Type::NUMBER) {
|
1093
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1094
|
+
"field:match_fraction error:must be of type number"));
|
1095
|
+
} else {
|
1096
|
+
route->matchers.fraction_per_million =
|
1097
|
+
gpr_parse_nonnegative_int(it->second.string_value().c_str());
|
790
1098
|
}
|
791
1099
|
}
|
792
1100
|
// Parse action.
|