grpc 1.56.0 → 1.57.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Makefile +31 -22
- data/include/grpc/event_engine/event_engine.h +22 -32
- data/include/grpc/grpc_security.h +19 -0
- data/include/grpc/impl/grpc_types.h +3 -0
- data/include/grpc/support/port_platform.h +29 -23
- data/src/core/ext/filters/client_channel/client_channel.cc +44 -8
- data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
- data/src/core/ext/filters/client_channel/http_proxy.cc +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +21 -52
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +19 -7
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +78 -132
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +38 -15
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +3 -5
- data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +22 -6
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +98 -72
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -16
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +56 -11
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +25 -0
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -32
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +4 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +20 -79
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -19
- data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +11 -2
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -41
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -67
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +31 -74
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +7 -51
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +16 -87
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +16 -50
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -74
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -4
- data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +69 -59
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +7 -2
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +366 -311
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +17 -1
- data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
- data/src/core/ext/filters/client_channel/retry_filter.h +91 -1
- data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
- data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +38 -58
- data/src/core/ext/filters/client_channel/subchannel.h +3 -3
- data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
- data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
- data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +162 -86
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -6
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -4
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +131 -186
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +176 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +326 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +569 -544
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +150 -9
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +47 -33
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +19 -5
- data/src/core/ext/transport/chttp2/transport/internal.h +8 -4
- data/src/core/ext/transport/chttp2/transport/parsing.cc +27 -15
- data/src/core/ext/transport/chttp2/transport/writing.cc +2 -3
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
- data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
- data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
- data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +33 -30
- data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -13
- data/src/core/ext/xds/xds_client_grpc.cc +11 -6
- data/src/core/ext/xds/xds_client_grpc.h +16 -2
- data/src/core/ext/xds/xds_client_stats.h +10 -0
- data/src/core/ext/xds/xds_cluster.cc +26 -16
- data/src/core/ext/xds/xds_endpoint.cc +4 -7
- data/src/core/ext/xds/xds_health_status.cc +0 -17
- data/src/core/ext/xds/xds_health_status.h +5 -25
- data/src/core/ext/xds/xds_lb_policy_registry.cc +39 -0
- data/src/core/ext/xds/xds_route_config.cc +4 -0
- data/src/core/ext/xds/xds_transport_grpc.cc +1 -3
- data/src/core/lib/address_utils/parse_address.cc +63 -1
- data/src/core/lib/address_utils/parse_address.h +8 -0
- data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
- data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
- data/src/core/lib/backoff/random_early_detection.h +5 -0
- data/src/core/lib/channel/channel_args.cc +21 -10
- data/src/core/lib/channel/channel_args.h +3 -0
- data/src/core/lib/channel/connected_channel.cc +4 -1
- data/src/core/lib/channel/promise_based_filter.h +1 -0
- data/src/core/lib/debug/trace.cc +1 -4
- data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -1
- data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -1
- data/src/core/lib/event_engine/event_engine.cc +0 -12
- data/src/core/lib/event_engine/forkable.cc +47 -42
- data/src/core/lib/event_engine/handle_containers.h +0 -4
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -6
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -6
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +25 -11
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +3 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +9 -12
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +66 -27
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +5 -0
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +42 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
- data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
- data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
- data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +90 -37
- data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +32 -12
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +12 -21
- data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +8 -12
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +55 -54
- data/src/core/lib/event_engine/windows/windows_endpoint.h +15 -12
- data/src/core/lib/event_engine/windows/windows_engine.cc +2 -1
- data/src/core/lib/event_engine/windows/windows_engine.h +8 -12
- data/src/core/lib/experiments/config.cc +60 -22
- data/src/core/lib/experiments/config.h +20 -8
- data/src/core/lib/experiments/experiments.cc +278 -0
- data/src/core/lib/experiments/experiments.h +59 -1
- data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
- data/src/core/lib/gprpp/fork.cc +8 -9
- data/src/core/lib/gprpp/fork.h +6 -5
- data/src/core/lib/gprpp/if_list.h +4530 -0
- data/src/core/lib/gprpp/orphanable.h +3 -3
- data/src/core/lib/gprpp/ref_counted.h +6 -6
- data/src/core/lib/gprpp/sorted_pack.h +3 -12
- data/src/core/lib/gprpp/status_helper.h +16 -15
- data/src/core/lib/gprpp/time.h +12 -0
- data/src/core/lib/gprpp/type_list.h +32 -0
- data/src/core/lib/http/httpcli.h +6 -9
- data/src/core/lib/iomgr/error.cc +32 -2
- data/src/core/lib/iomgr/error.h +9 -10
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -7
- data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
- data/src/core/lib/iomgr/exec_ctx.h +11 -0
- data/src/core/lib/iomgr/pollset.h +4 -5
- data/src/core/lib/iomgr/port.h +10 -0
- data/src/core/lib/iomgr/resolve_address.cc +13 -1
- data/src/core/lib/iomgr/resolve_address.h +17 -3
- data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -0
- data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
- data/src/core/lib/iomgr/tcp_posix.cc +21 -4
- data/src/core/lib/iomgr/tcp_server_posix.cc +37 -14
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +12 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +26 -2
- data/src/core/lib/iomgr/tcp_windows.cc +1 -3
- data/src/core/lib/iomgr/vsock.cc +59 -0
- data/src/core/lib/iomgr/vsock.h +38 -0
- data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
- data/src/core/lib/load_balancing/delegating_helper.h +115 -0
- data/src/core/lib/load_balancing/lb_policy.h +20 -0
- data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
- data/src/core/lib/promise/party.h +1 -1
- data/src/core/lib/resolver/resolver_factory.h +3 -2
- data/src/core/lib/resolver/server_address.cc +9 -94
- data/src/core/lib/resolver/server_address.h +10 -64
- data/src/core/lib/resource_quota/memory_quota.h +1 -1
- data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -1
- data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
- data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +8 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +5 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -1
- data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +1 -1
- data/src/core/lib/service_config/service_config_call_data.h +5 -0
- data/src/core/lib/slice/slice.h +16 -0
- data/src/core/lib/surface/call.cc +31 -29
- data/src/core/lib/surface/server.h +2 -2
- data/src/core/lib/surface/validate_metadata.cc +37 -22
- data/src/core/lib/surface/validate_metadata.h +13 -3
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata_batch.cc +7 -7
- data/src/core/lib/transport/metadata_batch.h +86 -48
- data/src/core/lib/transport/parsed_metadata.h +34 -20
- data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
- data/src/core/tsi/ssl_transport_security.cc +33 -9
- data/src/core/tsi/ssl_transport_security.h +13 -1
- data/src/ruby/bin/math_pb.rb +24 -18
- data/src/ruby/ext/grpc/extconf.rb +19 -18
- data/src/ruby/ext/grpc/rb_call.c +62 -39
- data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_channel.c +126 -49
- data/src/ruby/ext/grpc/rb_channel.h +1 -0
- data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
- data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
- data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
- data/src/ruby/ext/grpc/rb_grpc.c +192 -30
- data/src/ruby/ext/grpc/rb_grpc.h +8 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/ext/grpc/rb_server.c +62 -45
- data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
- data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
- data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
- data/third_party/boringssl-with-bazel/err_data.c +552 -552
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +4 -1
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
- data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
- data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +28 -185
- data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +49 -46
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +18 -0
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2809 -7417
- data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +27 -5
- data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +15 -14
- data/third_party/boringssl-with-bazel/src/crypto/err/err.c +13 -10
- data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
- data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +2 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +180 -404
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +24 -57
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +33 -71
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +18 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +15 -18
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +9 -11
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +11 -27
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +4 -4
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/hkdf.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -29
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +55 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +33 -52
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +3 -8
- data/third_party/boringssl-with-bazel/src/crypto/internal.h +198 -79
- data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +5 -4
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
- data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +19 -23
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
- data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +48 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/{refcount_no_threads.c → rand_extra/trusty.c} +15 -19
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
- data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +147 -72
- data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
- data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
- data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +14 -18
- data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +54 -143
- data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +7 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -15
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
- data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +5 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -116
- data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +21 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +11 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
- data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +0 -61
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +127 -81
- data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +224 -209
- data/third_party/boringssl-with-bazel/src/include/openssl/target.h +154 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -29
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +4 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +3 -2
- data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +9 -65
- data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -11
- data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +24 -18
- data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +37 -30
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +125 -26
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
- data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
- data/third_party/upb/upb/collections/map.c +3 -3
- metadata +30 -13
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
- data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
- data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
- data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +0 -89
@@ -21,16 +21,28 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include <stddef.h>
|
24
25
|
#include <stdint.h>
|
25
26
|
|
27
|
+
#include <string>
|
28
|
+
#include <utility>
|
26
29
|
#include <vector>
|
27
30
|
|
31
|
+
#include "absl/strings/str_cat.h"
|
32
|
+
#include "absl/strings/string_view.h"
|
33
|
+
#include "absl/types/optional.h"
|
34
|
+
#include "absl/types/span.h"
|
35
|
+
#include "absl/types/variant.h"
|
36
|
+
|
28
37
|
#include <grpc/slice.h>
|
29
38
|
|
30
39
|
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
40
|
+
#include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h"
|
31
41
|
#include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h"
|
32
42
|
#include "src/core/lib/backoff/random_early_detection.h"
|
33
43
|
#include "src/core/lib/iomgr/error.h"
|
44
|
+
#include "src/core/lib/slice/slice.h"
|
45
|
+
#include "src/core/lib/slice/slice_refcount.h"
|
34
46
|
#include "src/core/lib/transport/metadata_batch.h"
|
35
47
|
|
36
48
|
// IWYU pragma: no_include <type_traits>
|
@@ -92,17 +104,150 @@ class HPackParser {
|
|
92
104
|
void FinishFrame();
|
93
105
|
|
94
106
|
// Retrieve the associated hpack table (for tests, debugging)
|
95
|
-
HPackTable* hpack_table() { return &
|
107
|
+
HPackTable* hpack_table() { return &state_.hpack_table; }
|
96
108
|
// Is the current frame a boundary of some sort
|
97
109
|
bool is_boundary() const { return boundary_ != Boundary::None; }
|
98
110
|
// Is the current frame the end of a stream
|
99
111
|
bool is_eof() const { return boundary_ == Boundary::EndOfStream; }
|
100
112
|
|
113
|
+
// How many bytes are buffered (for tests to assert on)
|
114
|
+
size_t buffered_bytes() const { return unparsed_bytes_.size(); }
|
115
|
+
|
101
116
|
private:
|
102
117
|
// Helper classes: see implementation
|
103
118
|
class Parser;
|
104
119
|
class Input;
|
105
|
-
|
120
|
+
|
121
|
+
// Helper to parse a string and turn it into a slice with appropriate memory
|
122
|
+
// management characteristics
|
123
|
+
class String {
|
124
|
+
public:
|
125
|
+
// StringResult carries both a HpackParseStatus and the parsed string
|
126
|
+
struct StringResult;
|
127
|
+
|
128
|
+
String() : value_(absl::Span<const uint8_t>()) {}
|
129
|
+
String(const String&) = delete;
|
130
|
+
String& operator=(const String&) = delete;
|
131
|
+
String(String&& other) noexcept : value_(std::move(other.value_)) {
|
132
|
+
other.value_ = absl::Span<const uint8_t>();
|
133
|
+
}
|
134
|
+
String& operator=(String&& other) noexcept {
|
135
|
+
value_ = std::move(other.value_);
|
136
|
+
other.value_ = absl::Span<const uint8_t>();
|
137
|
+
return *this;
|
138
|
+
}
|
139
|
+
|
140
|
+
// Take the value and leave this empty
|
141
|
+
Slice Take();
|
142
|
+
|
143
|
+
// Return a reference to the value as a string view
|
144
|
+
absl::string_view string_view() const;
|
145
|
+
|
146
|
+
// Parse a non-binary string
|
147
|
+
static StringResult Parse(Input* input, bool is_huff, size_t length);
|
148
|
+
|
149
|
+
// Parse a binary string
|
150
|
+
static StringResult ParseBinary(Input* input, bool is_huff, size_t length);
|
151
|
+
|
152
|
+
private:
|
153
|
+
void AppendBytes(const uint8_t* data, size_t length);
|
154
|
+
explicit String(std::vector<uint8_t> v) : value_(std::move(v)) {}
|
155
|
+
explicit String(absl::Span<const uint8_t> v) : value_(v) {}
|
156
|
+
String(grpc_slice_refcount* r, const uint8_t* begin, const uint8_t* end)
|
157
|
+
: value_(Slice::FromRefcountAndBytes(r, begin, end)) {}
|
158
|
+
|
159
|
+
// Parse some huffman encoded bytes, using output(uint8_t b) to emit each
|
160
|
+
// decoded byte.
|
161
|
+
template <typename Out>
|
162
|
+
static HpackParseStatus ParseHuff(Input* input, uint32_t length,
|
163
|
+
Out output);
|
164
|
+
|
165
|
+
// Parse some uncompressed string bytes.
|
166
|
+
static StringResult ParseUncompressed(Input* input, uint32_t length,
|
167
|
+
uint32_t wire_size);
|
168
|
+
|
169
|
+
// Turn base64 encoded bytes into not base64 encoded bytes.
|
170
|
+
static StringResult Unbase64(String s);
|
171
|
+
|
172
|
+
// Main loop for Unbase64
|
173
|
+
static absl::optional<std::vector<uint8_t>> Unbase64Loop(
|
174
|
+
const uint8_t* cur, const uint8_t* end);
|
175
|
+
|
176
|
+
absl::variant<Slice, absl::Span<const uint8_t>, std::vector<uint8_t>>
|
177
|
+
value_;
|
178
|
+
};
|
179
|
+
|
180
|
+
// Prefix for a string
|
181
|
+
struct StringPrefix {
|
182
|
+
// Number of bytes in input for string
|
183
|
+
uint32_t length;
|
184
|
+
// Is it huffman compressed
|
185
|
+
bool huff;
|
186
|
+
|
187
|
+
std::string ToString() const {
|
188
|
+
return absl::StrCat(length, " bytes ",
|
189
|
+
huff ? "huffman compressed" : "uncompressed");
|
190
|
+
}
|
191
|
+
};
|
192
|
+
|
193
|
+
// Current parse state
|
194
|
+
// ┌───┐
|
195
|
+
// │Top│
|
196
|
+
// └┬─┬┘
|
197
|
+
// │┌▽────────────────┐
|
198
|
+
// ││ParsingKeyLength │
|
199
|
+
// │└┬───────────────┬┘
|
200
|
+
// │┌▽─────────────┐┌▽──────────────┐
|
201
|
+
// ││ParsingKeyBody││SkippingKeyBody│
|
202
|
+
// │└┬─────────────┘└───┬───────────┘
|
203
|
+
// ┌▽─▽────────────────┐┌▽──────────────────┐
|
204
|
+
// │ParsingValueLength ││SkippingValueLength│
|
205
|
+
// └┬─────────────────┬┘└┬──────────────────┘
|
206
|
+
// ┌▽───────────────┐┌▽──▽─────────────┐
|
207
|
+
// │ParsingValueBody││SkippingValueBody│
|
208
|
+
// └────────────────┘└─────────────────┘
|
209
|
+
enum class ParseState : uint8_t {
|
210
|
+
// Start of one opcode
|
211
|
+
kTop,
|
212
|
+
// Parsing a literal keys length
|
213
|
+
kParsingKeyLength,
|
214
|
+
// Parsing a literal key
|
215
|
+
kParsingKeyBody,
|
216
|
+
// Skipping a literal key
|
217
|
+
kSkippingKeyBody,
|
218
|
+
// Parsing a literal value length
|
219
|
+
kParsingValueLength,
|
220
|
+
// Parsing a literal value
|
221
|
+
kParsingValueBody,
|
222
|
+
// Reading a literal value length (so we can skip it)
|
223
|
+
kSkippingValueLength,
|
224
|
+
// Skipping a literal value
|
225
|
+
kSkippingValueBody,
|
226
|
+
};
|
227
|
+
|
228
|
+
// Shared state for Parser instances between slices.
|
229
|
+
struct InterSliceState {
|
230
|
+
HPackTable hpack_table;
|
231
|
+
// Error so far for this frame (set by class Input)
|
232
|
+
HpackParseResult frame_error;
|
233
|
+
// Length of frame so far.
|
234
|
+
uint32_t frame_length = 0;
|
235
|
+
// Length of the string being parsed
|
236
|
+
uint32_t string_length;
|
237
|
+
// How many more dynamic table updates are allowed
|
238
|
+
uint8_t dynamic_table_updates_allowed;
|
239
|
+
// Current parse state
|
240
|
+
ParseState parse_state = ParseState::kTop;
|
241
|
+
// RED for overly large metadata sets
|
242
|
+
RandomEarlyDetection metadata_early_detection;
|
243
|
+
// Should the current header be added to the hpack table?
|
244
|
+
bool add_to_table;
|
245
|
+
// Is the string being parsed huffman compressed?
|
246
|
+
bool is_string_huff_compressed;
|
247
|
+
// Is the value being parsed binary?
|
248
|
+
bool is_binary_header;
|
249
|
+
absl::variant<const HPackTable::Memento*, Slice> key;
|
250
|
+
};
|
106
251
|
|
107
252
|
grpc_error_handle ParseInput(Input input, bool is_last);
|
108
253
|
void ParseInputInner(Input* input);
|
@@ -114,6 +259,8 @@ class HPackParser {
|
|
114
259
|
|
115
260
|
// Bytes that could not be parsed last parsing round
|
116
261
|
std::vector<uint8_t> unparsed_bytes_;
|
262
|
+
// How many bytes would be needed before progress could be made?
|
263
|
+
size_t min_progress_size_ = 0;
|
117
264
|
// Buffer kind of boundary
|
118
265
|
// TODO(ctiller): see if we can move this argument to Parse, and avoid
|
119
266
|
// buffering.
|
@@ -122,15 +269,9 @@ class HPackParser {
|
|
122
269
|
// TODO(ctiller): see if we can move this argument to Parse, and avoid
|
123
270
|
// buffering.
|
124
271
|
Priority priority_;
|
125
|
-
uint8_t dynamic_table_updates_allowed_;
|
126
|
-
// Length of frame so far.
|
127
|
-
uint32_t frame_length_;
|
128
|
-
RandomEarlyDetection metadata_early_detection_;
|
129
272
|
// Information for logging
|
130
273
|
LogInfo log_info_;
|
131
|
-
|
132
|
-
// hpack table
|
133
|
-
HPackTable table_;
|
274
|
+
InterSliceState state_;
|
134
275
|
};
|
135
276
|
|
136
277
|
} // namespace grpc_core
|
@@ -25,16 +25,16 @@
|
|
25
25
|
#include <algorithm>
|
26
26
|
#include <cstddef>
|
27
27
|
#include <cstring>
|
28
|
-
#include <initializer_list>
|
29
28
|
#include <utility>
|
30
29
|
|
31
30
|
#include "absl/status/status.h"
|
32
|
-
#include "absl/strings/
|
31
|
+
#include "absl/strings/str_cat.h"
|
33
32
|
#include "absl/strings/string_view.h"
|
34
33
|
|
35
34
|
#include <grpc/support/log.h>
|
36
35
|
|
37
36
|
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
|
37
|
+
#include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h"
|
38
38
|
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
|
39
39
|
#include "src/core/lib/debug/trace.h"
|
40
40
|
#include "src/core/lib/slice/slice.h"
|
@@ -80,6 +80,14 @@ void HPackTable::MementoRingBuffer::Rebuild(uint32_t max_entries) {
|
|
80
80
|
entries_.swap(entries);
|
81
81
|
}
|
82
82
|
|
83
|
+
void HPackTable::MementoRingBuffer::ForEach(
|
84
|
+
absl::FunctionRef<void(uint32_t, const Memento&)> f) const {
|
85
|
+
uint32_t index = 0;
|
86
|
+
while (auto* m = Lookup(index++)) {
|
87
|
+
f(index, *m);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
83
91
|
// Evict one element from the table
|
84
92
|
void HPackTable::EvictOne() {
|
85
93
|
auto first_entry = entries_.PopOne();
|
@@ -100,15 +108,9 @@ void HPackTable::SetMaxBytes(uint32_t max_bytes) {
|
|
100
108
|
max_bytes_ = max_bytes;
|
101
109
|
}
|
102
110
|
|
103
|
-
|
104
|
-
if (current_table_bytes_ == bytes)
|
105
|
-
|
106
|
-
}
|
107
|
-
if (bytes > max_bytes_) {
|
108
|
-
return absl::InternalError(absl::StrFormat(
|
109
|
-
"Attempt to make hpack table %d bytes when max is %d bytes", bytes,
|
110
|
-
max_bytes_));
|
111
|
-
}
|
111
|
+
bool HPackTable::SetCurrentTableSize(uint32_t bytes) {
|
112
|
+
if (current_table_bytes_ == bytes) return true;
|
113
|
+
if (bytes > max_bytes_) return false;
|
112
114
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
113
115
|
gpr_log(GPR_INFO, "Update hpack parser table size to %d", bytes);
|
114
116
|
}
|
@@ -119,30 +121,16 @@ grpc_error_handle HPackTable::SetCurrentTableSize(uint32_t bytes) {
|
|
119
121
|
uint32_t new_cap = std::max(hpack_constants::EntriesForBytes(bytes),
|
120
122
|
hpack_constants::kInitialTableEntries);
|
121
123
|
entries_.Rebuild(new_cap);
|
122
|
-
return
|
124
|
+
return true;
|
123
125
|
}
|
124
126
|
|
125
|
-
|
126
|
-
if (current_table_bytes_ > max_bytes_)
|
127
|
-
return GRPC_ERROR_CREATE(absl::StrFormat(
|
128
|
-
"HPACK max table size reduced to %d but not reflected by hpack "
|
129
|
-
"stream (still at %d)",
|
130
|
-
max_bytes_, current_table_bytes_));
|
131
|
-
}
|
127
|
+
bool HPackTable::Add(Memento md) {
|
128
|
+
if (current_table_bytes_ > max_bytes_) return false;
|
132
129
|
|
133
130
|
// we can't add elements bigger than the max table size
|
134
131
|
if (md.md.transport_size() > current_table_bytes_) {
|
135
|
-
|
136
|
-
|
137
|
-
// size, that entry is added to the table. It is not an error to
|
138
|
-
// attempt to add an entry that is larger than the maximum size; an
|
139
|
-
// attempt to add an entry larger than the entire table causes
|
140
|
-
// the table to be emptied of all existing entries, and results in an
|
141
|
-
// empty table.
|
142
|
-
while (entries_.num_entries()) {
|
143
|
-
EvictOne();
|
144
|
-
}
|
145
|
-
return absl::OkStatus();
|
132
|
+
AddLargerThanCurrentTableSize();
|
133
|
+
return true;
|
146
134
|
}
|
147
135
|
|
148
136
|
// evict entries to ensure no overflow
|
@@ -154,7 +142,33 @@ grpc_error_handle HPackTable::Add(Memento md) {
|
|
154
142
|
// copy the finalized entry in
|
155
143
|
mem_used_ += md.md.transport_size();
|
156
144
|
entries_.Put(std::move(md));
|
157
|
-
return
|
145
|
+
return true;
|
146
|
+
}
|
147
|
+
|
148
|
+
void HPackTable::AddLargerThanCurrentTableSize() {
|
149
|
+
// HPACK draft 10 section 4.4 states:
|
150
|
+
// If the size of the new entry is less than or equal to the maximum
|
151
|
+
// size, that entry is added to the table. It is not an error to
|
152
|
+
// attempt to add an entry that is larger than the maximum size; an
|
153
|
+
// attempt to add an entry larger than the entire table causes
|
154
|
+
// the table to be emptied of all existing entries, and results in an
|
155
|
+
// empty table.
|
156
|
+
while (entries_.num_entries()) {
|
157
|
+
EvictOne();
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
std::string HPackTable::TestOnlyDynamicTableAsString() const {
|
162
|
+
std::string out;
|
163
|
+
entries_.ForEach([&out](uint32_t i, const Memento& m) {
|
164
|
+
if (m.parse_status == nullptr) {
|
165
|
+
absl::StrAppend(&out, i, ": ", m.md.DebugString(), "\n");
|
166
|
+
} else {
|
167
|
+
absl::StrAppend(&out, i, ": ", m.parse_status->Materialize().ToString(),
|
168
|
+
"\n");
|
169
|
+
}
|
170
|
+
});
|
171
|
+
return out;
|
158
172
|
}
|
159
173
|
|
160
174
|
namespace {
|
@@ -231,12 +245,12 @@ HPackTable::Memento MakeMemento(size_t i) {
|
|
231
245
|
auto sm = kStaticTable[i];
|
232
246
|
return HPackTable::Memento{
|
233
247
|
grpc_metadata_batch::Parse(
|
234
|
-
sm.key, Slice::FromStaticString(sm.value),
|
248
|
+
sm.key, Slice::FromStaticString(sm.value), true,
|
235
249
|
strlen(sm.key) + strlen(sm.value) + hpack_constants::kEntryOverhead,
|
236
250
|
[](absl::string_view, const Slice&) {
|
237
251
|
abort(); // not expecting to see this
|
238
252
|
}),
|
239
|
-
|
253
|
+
nullptr};
|
240
254
|
}
|
241
255
|
|
242
256
|
} // namespace
|
@@ -23,13 +23,15 @@
|
|
23
23
|
|
24
24
|
#include <stdint.h>
|
25
25
|
|
26
|
+
#include <memory>
|
27
|
+
#include <string>
|
26
28
|
#include <vector>
|
27
29
|
|
28
|
-
#include "absl/
|
30
|
+
#include "absl/functional/function_ref.h"
|
29
31
|
|
30
32
|
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
|
33
|
+
#include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h"
|
31
34
|
#include "src/core/lib/gprpp/no_destruct.h"
|
32
|
-
#include "src/core/lib/iomgr/error.h"
|
33
35
|
#include "src/core/lib/transport/metadata_batch.h"
|
34
36
|
#include "src/core/lib/transport/parsed_metadata.h"
|
35
37
|
|
@@ -45,11 +47,12 @@ class HPackTable {
|
|
45
47
|
HPackTable& operator=(const HPackTable&) = delete;
|
46
48
|
|
47
49
|
void SetMaxBytes(uint32_t max_bytes);
|
48
|
-
|
50
|
+
bool SetCurrentTableSize(uint32_t bytes);
|
51
|
+
uint32_t current_table_size() { return current_table_bytes_; }
|
49
52
|
|
50
53
|
struct Memento {
|
51
54
|
ParsedMetadata<grpc_metadata_batch> md;
|
52
|
-
|
55
|
+
std::unique_ptr<HpackParseResult> parse_status;
|
53
56
|
};
|
54
57
|
|
55
58
|
// Lookup, but don't ref.
|
@@ -68,7 +71,8 @@ class HPackTable {
|
|
68
71
|
}
|
69
72
|
|
70
73
|
// add a table entry to the index
|
71
|
-
|
74
|
+
GRPC_MUST_USE_RESULT bool Add(Memento md);
|
75
|
+
void AddLargerThanCurrentTableSize();
|
72
76
|
|
73
77
|
// Current entry count in the table.
|
74
78
|
uint32_t num_entries() const { return entries_.num_entries(); }
|
@@ -76,6 +80,13 @@ class HPackTable {
|
|
76
80
|
// Current size of the table.
|
77
81
|
uint32_t test_only_table_size() const { return mem_used_; }
|
78
82
|
|
83
|
+
// Maximum allowed size of the table currently
|
84
|
+
uint32_t max_bytes() const { return max_bytes_; }
|
85
|
+
uint32_t current_table_bytes() const { return current_table_bytes_; }
|
86
|
+
|
87
|
+
// Dynamic table entries, stringified
|
88
|
+
std::string TestOnlyDynamicTableAsString() const;
|
89
|
+
|
79
90
|
private:
|
80
91
|
struct StaticMementos {
|
81
92
|
StaticMementos();
|
@@ -98,6 +109,9 @@ class HPackTable {
|
|
98
109
|
// Lookup the entry at index, or return nullptr if none exists.
|
99
110
|
const Memento* Lookup(uint32_t index) const;
|
100
111
|
|
112
|
+
void ForEach(absl::FunctionRef<void(uint32_t dynamic_index, const Memento&)>
|
113
|
+
f) const;
|
114
|
+
|
101
115
|
uint32_t max_entries() const { return max_entries_; }
|
102
116
|
uint32_t num_entries() const { return num_entries_; }
|
103
117
|
|
@@ -26,6 +26,8 @@
|
|
26
26
|
|
27
27
|
#include <memory>
|
28
28
|
|
29
|
+
#include "absl/container/flat_hash_map.h"
|
30
|
+
#include "absl/meta/type_traits.h"
|
29
31
|
#include "absl/strings/string_view.h"
|
30
32
|
#include "absl/types/optional.h"
|
31
33
|
|
@@ -46,7 +48,6 @@
|
|
46
48
|
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
|
47
49
|
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
|
48
50
|
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
|
49
|
-
#include "src/core/ext/transport/chttp2/transport/stream_map.h"
|
50
51
|
#include "src/core/lib/channel/channel_args.h"
|
51
52
|
#include "src/core/lib/channel/channelz.h"
|
52
53
|
#include "src/core/lib/debug/trace.h"
|
@@ -278,7 +279,7 @@ struct grpc_chttp2_transport : public grpc_core::KeepsGrpcInitialized {
|
|
278
279
|
grpc_chttp2_stream_list lists[STREAM_LIST_COUNT] = {};
|
279
280
|
|
280
281
|
/// maps stream id to grpc_chttp2_stream objects
|
281
|
-
|
282
|
+
absl::flat_hash_map<uint32_t, grpc_chttp2_stream*> stream_map;
|
282
283
|
|
283
284
|
grpc_closure write_action_begin_locked;
|
284
285
|
grpc_closure write_action;
|
@@ -679,8 +680,9 @@ void grpc_chttp2_act_on_flowctl_action(
|
|
679
680
|
|
680
681
|
inline grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(
|
681
682
|
grpc_chttp2_transport* t, uint32_t id) {
|
682
|
-
|
683
|
-
|
683
|
+
auto it = t->stream_map.find(id);
|
684
|
+
if (it == t->stream_map.end()) return nullptr;
|
685
|
+
return it->second;
|
684
686
|
}
|
685
687
|
grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
|
686
688
|
uint32_t id);
|
@@ -805,6 +807,8 @@ void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
|
|
805
807
|
/// initialization
|
806
808
|
void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
|
807
809
|
bool is_client);
|
810
|
+
void grpc_chttp2_config_default_keepalive_args(
|
811
|
+
const grpc_core::ChannelArgs& channel_args, bool is_client);
|
808
812
|
|
809
813
|
void grpc_chttp2_retry_initiate_ping(grpc_chttp2_transport* t);
|
810
814
|
|
@@ -23,9 +23,9 @@
|
|
23
23
|
|
24
24
|
#include <initializer_list>
|
25
25
|
#include <string>
|
26
|
-
#include <utility>
|
27
26
|
|
28
27
|
#include "absl/base/attributes.h"
|
28
|
+
#include "absl/container/flat_hash_map.h"
|
29
29
|
#include "absl/status/status.h"
|
30
30
|
#include "absl/strings/str_cat.h"
|
31
31
|
#include "absl/strings/str_format.h"
|
@@ -47,7 +47,6 @@
|
|
47
47
|
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
|
48
48
|
#include "src/core/ext/transport/chttp2/transport/http_trace.h"
|
49
49
|
#include "src/core/ext/transport/chttp2/transport/internal.h"
|
50
|
-
#include "src/core/ext/transport/chttp2/transport/stream_map.h"
|
51
50
|
#include "src/core/lib/channel/channelz.h"
|
52
51
|
#include "src/core/lib/debug/trace.h"
|
53
52
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
@@ -55,6 +54,7 @@
|
|
55
54
|
#include "src/core/lib/gprpp/time.h"
|
56
55
|
#include "src/core/lib/iomgr/closure.h"
|
57
56
|
#include "src/core/lib/iomgr/combiner.h"
|
57
|
+
#include "src/core/lib/iomgr/endpoint.h"
|
58
58
|
#include "src/core/lib/iomgr/error.h"
|
59
59
|
#include "src/core/lib/slice/slice.h"
|
60
60
|
#include "src/core/lib/transport/bdp_estimator.h"
|
@@ -65,6 +65,8 @@
|
|
65
65
|
|
66
66
|
using grpc_core::HPackParser;
|
67
67
|
|
68
|
+
grpc_core::TraceFlag grpc_trace_chttp2_new_stream(false, "chttp2_new_stream");
|
69
|
+
|
68
70
|
static grpc_error_handle init_frame_parser(grpc_chttp2_transport* t);
|
69
71
|
static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
70
72
|
int is_continuation);
|
@@ -470,8 +472,8 @@ static HPackParser::LogInfo hpack_parser_log_info(
|
|
470
472
|
}
|
471
473
|
|
472
474
|
static grpc_error_handle init_header_skip_frame_parser(
|
473
|
-
grpc_chttp2_transport* t, HPackParser::Priority priority_type
|
474
|
-
|
475
|
+
grpc_chttp2_transport* t, HPackParser::Priority priority_type,
|
476
|
+
bool is_eoh) {
|
475
477
|
t->parser = grpc_chttp2_transport::Parser{
|
476
478
|
"header", grpc_chttp2_header_parser_parse, &t->hpack_parser};
|
477
479
|
t->hpack_parser.BeginFrame(
|
@@ -595,7 +597,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
|
595
597
|
GRPC_CHTTP2_IF_TRACING(
|
596
598
|
gpr_log(GPR_ERROR,
|
597
599
|
"grpc_chttp2_stream disbanded before CONTINUATION received"));
|
598
|
-
return init_header_skip_frame_parser(t, priority_type);
|
600
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
599
601
|
}
|
600
602
|
if (t->is_client) {
|
601
603
|
if (GPR_LIKELY((t->incoming_stream_id & 1) &&
|
@@ -605,7 +607,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
|
605
607
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
606
608
|
GPR_ERROR, "ignoring new grpc_chttp2_stream creation on client"));
|
607
609
|
}
|
608
|
-
return init_header_skip_frame_parser(t, priority_type);
|
610
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
609
611
|
} else if (GPR_UNLIKELY(t->last_new_stream_id >= t->incoming_stream_id)) {
|
610
612
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
611
613
|
GPR_ERROR,
|
@@ -613,26 +615,28 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
|
613
615
|
"last grpc_chttp2_stream "
|
614
616
|
"id=%d, new grpc_chttp2_stream id=%d",
|
615
617
|
t->last_new_stream_id, t->incoming_stream_id));
|
616
|
-
return init_header_skip_frame_parser(t, priority_type);
|
618
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
617
619
|
} else if (GPR_UNLIKELY((t->incoming_stream_id & 1) == 0)) {
|
618
620
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
619
621
|
GPR_ERROR,
|
620
622
|
"ignoring grpc_chttp2_stream with non-client generated index %d",
|
621
623
|
t->incoming_stream_id));
|
622
|
-
return init_header_skip_frame_parser(t, priority_type);
|
624
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
623
625
|
} else if (GPR_UNLIKELY(
|
624
|
-
|
626
|
+
t->stream_map.size() >=
|
625
627
|
t->settings[GRPC_ACKED_SETTINGS]
|
626
628
|
[GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS])) {
|
627
629
|
return GRPC_ERROR_CREATE("Max stream count exceeded");
|
628
|
-
} else if (t->sent_goaway_state == GRPC_CHTTP2_FINAL_GOAWAY_SENT
|
630
|
+
} else if (t->sent_goaway_state == GRPC_CHTTP2_FINAL_GOAWAY_SENT ||
|
631
|
+
t->sent_goaway_state ==
|
632
|
+
GRPC_CHTTP2_FINAL_GOAWAY_SEND_SCHEDULED) {
|
629
633
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
630
634
|
GPR_INFO,
|
631
635
|
"transport:%p SERVER peer:%s Final GOAWAY sent. Ignoring new "
|
632
636
|
"grpc_chttp2_stream request id=%d, last grpc_chttp2_stream id=%d",
|
633
637
|
t, std::string(t->peer_string.as_string_view()).c_str(),
|
634
638
|
t->incoming_stream_id, t->last_new_stream_id));
|
635
|
-
return init_header_skip_frame_parser(t, priority_type);
|
639
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
636
640
|
}
|
637
641
|
t->last_new_stream_id = t->incoming_stream_id;
|
638
642
|
s = t->incoming_stream =
|
@@ -640,7 +644,13 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
|
640
644
|
if (GPR_UNLIKELY(s == nullptr)) {
|
641
645
|
GRPC_CHTTP2_IF_TRACING(
|
642
646
|
gpr_log(GPR_ERROR, "grpc_chttp2_stream not accepted"));
|
643
|
-
return init_header_skip_frame_parser(t, priority_type);
|
647
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
648
|
+
}
|
649
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace) ||
|
650
|
+
GRPC_TRACE_FLAG_ENABLED(grpc_trace_chttp2_new_stream)) {
|
651
|
+
gpr_log(GPR_INFO, "[t:%p fd:%d peer:%s] Accepting new stream", t,
|
652
|
+
grpc_endpoint_get_fd(t->ep),
|
653
|
+
std::string(t->peer_string.as_string_view()).c_str());
|
644
654
|
}
|
645
655
|
if (t->channelz_socket != nullptr) {
|
646
656
|
t->channelz_socket->RecordStreamStartedFromRemote();
|
@@ -654,7 +664,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
|
654
664
|
GRPC_CHTTP2_IF_TRACING(gpr_log(
|
655
665
|
GPR_ERROR, "skipping already closed grpc_chttp2_stream header"));
|
656
666
|
t->incoming_stream = nullptr;
|
657
|
-
return init_header_skip_frame_parser(t, priority_type);
|
667
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
658
668
|
}
|
659
669
|
t->parser = grpc_chttp2_transport::Parser{
|
660
670
|
"header", grpc_chttp2_header_parser_parse, &t->hpack_parser};
|
@@ -672,6 +682,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
|
672
682
|
}
|
673
683
|
s->parsed_trailers_only = true;
|
674
684
|
s->trailing_metadata_buffer.Set(grpc_core::GrpcTrailersOnly(), true);
|
685
|
+
s->initial_metadata_buffer.Set(grpc_core::GrpcTrailersOnly(), true);
|
675
686
|
incoming_metadata_buffer = &s->trailing_metadata_buffer;
|
676
687
|
frame_type = HPackParser::LogInfo::kTrailers;
|
677
688
|
} else {
|
@@ -687,7 +698,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
|
|
687
698
|
break;
|
688
699
|
case 2:
|
689
700
|
gpr_log(GPR_ERROR, "too many header frames received");
|
690
|
-
return init_header_skip_frame_parser(t, priority_type);
|
701
|
+
return init_header_skip_frame_parser(t, priority_type, is_eoh);
|
691
702
|
}
|
692
703
|
if (frame_type == HPackParser::LogInfo::kTrailers && !t->header_eof) {
|
693
704
|
return GRPC_ERROR_CREATE(
|
@@ -815,8 +826,9 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
|
|
815
826
|
&unused)) {
|
816
827
|
grpc_chttp2_parsing_become_skip_parser(t);
|
817
828
|
if (s) {
|
818
|
-
grpc_chttp2_cancel_stream(t, s,
|
829
|
+
grpc_chttp2_cancel_stream(t, s, err);
|
819
830
|
}
|
831
|
+
return absl::OkStatus();
|
820
832
|
}
|
821
833
|
return err;
|
822
834
|
}
|
@@ -25,6 +25,7 @@
|
|
25
25
|
#include <memory>
|
26
26
|
#include <string>
|
27
27
|
|
28
|
+
#include "absl/container/flat_hash_map.h"
|
28
29
|
#include "absl/status/status.h"
|
29
30
|
#include "absl/strings/string_view.h"
|
30
31
|
#include "absl/types/optional.h"
|
@@ -50,7 +51,6 @@
|
|
50
51
|
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
|
51
52
|
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
|
52
53
|
#include "src/core/ext/transport/chttp2/transport/internal.h"
|
53
|
-
#include "src/core/ext/transport/chttp2/transport/stream_map.h"
|
54
54
|
#include "src/core/lib/channel/channelz.h"
|
55
55
|
#include "src/core/lib/debug/stats.h"
|
56
56
|
#include "src/core/lib/debug/stats_data.h"
|
@@ -123,8 +123,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
|
|
123
123
|
grpc_core::Duration next_allowed_ping_interval = grpc_core::Duration::Zero();
|
124
124
|
if (t->is_client) {
|
125
125
|
next_allowed_ping_interval =
|
126
|
-
(t->keepalive_permit_without_calls == 0 &&
|
127
|
-
grpc_chttp2_stream_map_size(&t->stream_map) == 0)
|
126
|
+
(t->keepalive_permit_without_calls == 0 && t->stream_map.empty())
|
128
127
|
? grpc_core::Duration::Hours(2)
|
129
128
|
: grpc_core::Duration::Seconds(
|
130
129
|
1); // A second is added to deal with
|