grpc 1.43.1 → 1.44.0.pre2
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 +84 -64
- data/include/grpc/grpc_security.h +10 -0
- data/include/grpc/impl/codegen/compression_types.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/client_channel/backend_metric.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel.cc +62 -68
- data/src/core/ext/filters/client_channel/client_channel.h +8 -8
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/config_selector.h +4 -4
- data/src/core/ext/filters/client_channel/dynamic_filters.h +1 -1
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +16 -14
- data/src/core/ext/filters/client_channel/health/health_check_client.h +3 -3
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +4 -3
- data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +6 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +3 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +31 -32
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +43 -29
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -2
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +120 -68
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +60 -48
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +62 -61
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +16 -11
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -5
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +19 -15
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +14 -12
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +50 -105
- data/src/core/ext/filters/client_channel/lb_policy.cc +15 -14
- data/src/core/ext/filters/client_channel/lb_policy.h +19 -3
- data/src/core/ext/filters/client_channel/resolver/binder/binder_resolver.cc +3 -3
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +207 -81
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +22 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +19 -15
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +23 -38
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +118 -207
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +25 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +82 -73
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +10 -10
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +2 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -5
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +157 -67
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +2 -2
- data/src/core/ext/filters/client_channel/retry_filter.cc +37 -64
- data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
- data/src/core/ext/filters/client_channel/retry_service_config.h +1 -1
- data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +1 -1
- data/src/core/ext/filters/client_channel/subchannel.cc +12 -16
- data/src/core/ext/filters/client_channel/subchannel.h +2 -3
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +37 -48
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +6 -8
- data/src/core/ext/filters/fault_injection/service_config_parser.h +1 -1
- data/src/core/ext/filters/http/client/http_client_filter.cc +51 -122
- data/src/core/ext/filters/http/client_authority_filter.cc +8 -24
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +42 -140
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +5 -25
- data/src/core/ext/filters/http/server/http_server_filter.cc +50 -135
- data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
- data/src/core/ext/filters/message_size/message_size_filter.h +1 -1
- data/src/core/ext/filters/rbac/rbac_filter.cc +157 -0
- data/src/core/ext/filters/rbac/rbac_filter.h +74 -0
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +605 -0
- data/src/core/ext/filters/rbac/rbac_service_config_parser.h +70 -0
- data/src/core/ext/filters/server_config_selector/server_config_selector.h +3 -2
- data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +11 -6
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +1 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +89 -29
- data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +45 -186
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +341 -279
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +69 -159
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_table.h +2 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +19 -32
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +0 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +94 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +2 -24
- data/src/core/ext/transport/chttp2/transport/internal.h +0 -33
- data/src/core/ext/transport/chttp2/transport/parsing.cc +0 -6
- data/src/core/ext/transport/chttp2/transport/writing.cc +47 -116
- data/src/core/ext/transport/inproc/inproc_plugin.cc +0 -4
- data/src/core/ext/transport/inproc/inproc_transport.cc +11 -63
- data/src/core/ext/transport/inproc/inproc_transport.h +0 -3
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.c +61 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +146 -0
- data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.c +188 -0
- data/src/core/ext/upbdefs-generated/envoy/config/rbac/v3/rbac.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.c +154 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/checked.upbdefs.h +95 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.c +58 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/eval.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.c +44 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/explain.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.c +153 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/syntax.upbdefs.h +100 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.c +75 -0
- data/src/core/ext/upbdefs-generated/google/api/expr/v1alpha1/value.upbdefs.h +55 -0
- data/src/core/ext/xds/upb_utils.h +65 -0
- data/src/core/ext/xds/xds_api.cc +81 -3458
- data/src/core/ext/xds/xds_api.h +56 -611
- data/src/core/ext/xds/xds_bootstrap.cc +189 -125
- data/src/core/ext/xds/xds_bootstrap.h +20 -15
- data/src/core/ext/xds/xds_certificate_provider.h +1 -0
- data/src/core/ext/xds/xds_channel_creds.cc +108 -0
- data/src/core/ext/xds/xds_channel_creds.h +50 -0
- data/src/core/ext/xds/xds_client.cc +584 -994
- data/src/core/ext/xds/xds_client.h +78 -135
- data/src/core/ext/xds/xds_cluster.cc +451 -0
- data/src/core/ext/xds/xds_cluster.h +111 -0
- data/src/core/ext/xds/xds_common_types.cc +388 -0
- data/src/core/ext/xds/xds_common_types.h +110 -0
- data/src/core/ext/xds/xds_endpoint.cc +364 -0
- data/src/core/ext/xds/xds_endpoint.h +135 -0
- data/src/core/ext/xds/xds_http_filters.cc +5 -0
- data/src/core/ext/xds/xds_http_rbac_filter.cc +563 -0
- data/src/core/ext/xds/xds_http_rbac_filter.h +54 -0
- data/src/core/ext/xds/xds_listener.cc +1036 -0
- data/src/core/ext/xds/xds_listener.h +220 -0
- data/src/core/ext/{transport/chttp2/transport/hpack_utils.h → xds/xds_resource_type.cc} +12 -9
- data/src/core/ext/xds/xds_resource_type.h +98 -0
- data/src/core/ext/xds/xds_resource_type_impl.h +87 -0
- data/src/core/ext/xds/xds_route_config.cc +993 -0
- data/src/core/ext/xds/xds_route_config.h +215 -0
- data/src/core/ext/xds/xds_routing.cc +11 -8
- data/src/core/ext/xds/xds_routing.h +8 -5
- data/src/core/ext/xds/xds_server_config_fetcher.cc +159 -99
- data/src/core/lib/address_utils/parse_address.cc +20 -0
- data/src/core/lib/address_utils/parse_address.h +5 -0
- data/src/core/lib/address_utils/sockaddr_utils.cc +33 -36
- data/src/core/lib/address_utils/sockaddr_utils.h +1 -16
- data/src/core/lib/backoff/backoff.cc +4 -30
- data/src/core/lib/backoff/backoff.h +3 -3
- data/src/core/lib/channel/channel_args.cc +0 -1
- data/src/core/lib/channel/channel_stack.cc +8 -0
- data/src/core/lib/channel/channel_stack.h +1 -1
- data/src/core/lib/channel/channel_stack_builder.cc +5 -9
- data/src/core/lib/channel/channel_stack_builder.h +4 -7
- data/src/core/lib/channel/channelz.cc +1 -0
- data/src/core/lib/compression/compression.cc +19 -111
- data/src/core/lib/compression/compression_internal.cc +142 -202
- data/src/core/lib/compression/compression_internal.h +64 -69
- data/src/core/lib/compression/message_compress.cc +11 -11
- data/src/core/lib/compression/message_compress.h +2 -2
- data/src/core/lib/gpr/useful.h +4 -0
- data/src/core/lib/gprpp/bitset.h +7 -0
- data/src/core/lib/gprpp/chunked_vector.h +45 -3
- data/src/core/lib/gprpp/status_helper.cc +20 -28
- data/src/core/lib/gprpp/status_helper.h +6 -19
- data/src/core/lib/gprpp/table.h +11 -0
- data/src/core/lib/http/httpcli.cc +37 -46
- data/src/core/lib/http/httpcli.h +3 -15
- data/src/core/lib/iomgr/call_combiner.cc +15 -4
- data/src/core/lib/iomgr/closure.h +29 -9
- data/src/core/lib/iomgr/combiner.cc +25 -3
- data/src/core/lib/iomgr/error.cc +2 -0
- data/src/core/lib/iomgr/error.h +3 -0
- data/src/core/lib/iomgr/event_engine/iomgr.cc +3 -2
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.cc +6 -0
- data/src/core/lib/iomgr/event_engine/resolved_address_internal.h +2 -0
- data/src/core/lib/iomgr/event_engine/resolver.cc +66 -48
- data/src/core/lib/iomgr/event_engine/resolver.h +56 -0
- data/src/core/lib/iomgr/exec_ctx.cc +22 -9
- data/src/core/lib/iomgr/executor.cc +10 -1
- data/src/core/lib/iomgr/fork_posix.cc +3 -2
- data/src/core/lib/iomgr/iomgr_custom.cc +4 -1
- data/src/core/lib/iomgr/iomgr_posix.cc +2 -2
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +2 -2
- data/src/core/lib/iomgr/iomgr_windows.cc +2 -2
- data/src/core/lib/iomgr/port.h +2 -2
- data/src/core/lib/iomgr/resolve_address.cc +5 -24
- data/src/core/lib/iomgr/resolve_address.h +47 -44
- data/src/core/lib/iomgr/resolve_address_custom.cc +131 -109
- data/src/core/lib/iomgr/resolve_address_custom.h +101 -19
- data/src/core/lib/iomgr/resolve_address_impl.h +59 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +82 -66
- data/src/core/lib/iomgr/resolve_address_posix.h +47 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +93 -74
- data/src/core/lib/iomgr/resolve_address_windows.h +47 -0
- data/src/core/lib/iomgr/resolved_address.h +39 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc +1 -0
- data/src/core/lib/iomgr/unix_sockets_posix.cc +22 -34
- data/src/core/lib/iomgr/unix_sockets_posix.h +4 -7
- data/src/core/lib/iomgr/unix_sockets_posix_noop.cc +6 -15
- data/src/core/lib/matchers/matchers.cc +1 -1
- data/src/core/lib/promise/activity.h +49 -20
- data/src/core/lib/promise/detail/status.h +5 -0
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.cc +17 -25
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver.h +43 -44
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_factory.h +10 -5
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.cc +3 -2
- data/src/core/{ext/filters/client_channel → lib/resolver}/resolver_registry.h +4 -5
- data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.cc +1 -1
- data/src/core/{ext/filters/client_channel → lib/resolver}/server_address.h +4 -4
- data/src/core/lib/resource_quota/api.h +0 -1
- data/src/core/lib/{gprpp → resource_quota}/arena.cc +16 -13
- data/src/core/lib/{gprpp → resource_quota}/arena.h +24 -13
- data/src/core/lib/security/authorization/evaluate_args.cc +30 -15
- data/src/core/lib/security/authorization/evaluate_args.h +1 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +60 -0
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +62 -0
- data/src/core/lib/security/authorization/matchers.cc +227 -0
- data/src/core/lib/security/authorization/matchers.h +211 -0
- data/src/core/lib/security/authorization/rbac_policy.cc +442 -0
- data/src/core/lib/security/authorization/rbac_policy.h +170 -0
- data/src/core/lib/security/context/security_context.cc +4 -2
- data/src/core/lib/security/context/security_context.h +1 -1
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +5 -5
- data/src/core/lib/security/credentials/composite/composite_credentials.h +4 -3
- data/src/core/lib/security/credentials/credentials.h +10 -20
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +6 -9
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +7 -9
- data/src/core/lib/security/credentials/external/external_account_credentials.h +2 -7
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +2 -3
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +5 -4
- data/src/core/lib/security/credentials/fake/fake_credentials.h +8 -7
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +2 -5
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +16 -19
- data/src/core/lib/security/credentials/iam/iam_credentials.h +6 -5
- data/src/core/lib/security/credentials/jwt/json_token.cc +4 -6
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +16 -28
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +8 -8
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +6 -13
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +44 -57
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +13 -15
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +6 -7
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +5 -4
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -10
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +6 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +7 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.h +1 -1
- data/src/core/lib/security/security_connector/security_connector.cc +0 -4
- data/src/core/lib/security/security_connector/security_connector.h +5 -1
- data/src/core/lib/security/security_connector/ssl_utils.cc +14 -24
- data/src/core/lib/security/security_connector/ssl_utils.h +5 -14
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +2 -3
- data/src/core/lib/security/transport/auth_filters.h +7 -0
- data/src/core/lib/security/transport/client_auth_filter.cc +53 -33
- data/src/core/lib/security/transport/server_auth_filter.cc +40 -35
- data/src/core/{ext → lib}/service_config/service_config.cc +2 -2
- data/src/core/{ext → lib}/service_config/service_config.h +4 -4
- data/src/core/{ext → lib}/service_config/service_config_call_data.h +5 -5
- data/src/core/{ext → lib}/service_config/service_config_parser.cc +1 -1
- data/src/core/{ext → lib}/service_config/service_config_parser.h +3 -3
- data/src/core/lib/slice/slice.cc +3 -1
- data/src/core/lib/slice/slice.h +43 -13
- data/src/core/lib/slice/slice_intern.cc +3 -101
- data/src/core/lib/slice/slice_internal.h +1 -2
- data/src/core/lib/slice/slice_refcount.h +4 -13
- data/src/core/lib/slice/slice_refcount_base.h +0 -16
- data/src/core/lib/surface/call.cc +140 -382
- data/src/core/lib/surface/call.h +4 -4
- data/src/core/lib/surface/channel.cc +42 -44
- data/src/core/lib/surface/channel.h +4 -4
- data/src/core/lib/surface/init.cc +0 -2
- data/src/core/lib/surface/lame_client.cc +0 -1
- data/src/core/lib/surface/server.cc +12 -29
- data/src/core/lib/surface/server.h +2 -2
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/error_utils.h +14 -0
- data/src/core/lib/transport/metadata_batch.h +799 -717
- data/src/core/lib/transport/parsed_metadata.cc +2 -0
- data/src/core/lib/transport/parsed_metadata.h +95 -92
- data/src/core/lib/transport/timeout_encoding.cc +200 -66
- data/src/core/lib/transport/timeout_encoding.h +40 -10
- data/src/core/lib/transport/transport.h +1 -1
- data/src/core/lib/transport/transport_op_string.cc +6 -39
- data/src/core/lib/uri/uri_parser.cc +223 -53
- data/src/core/lib/uri/uri_parser.h +36 -23
- data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -3
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/ssl/session_cache/ssl_session.h +2 -4
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +3 -5
- data/src/core/tsi/ssl_transport_security.cc +53 -13
- data/src/core/tsi/ssl_transport_security.h +18 -6
- data/src/ruby/ext/grpc/extconf.rb +10 -3
- 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/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +2 -1
- data/third_party/abseil-cpp/absl/base/internal/fast_type_id.h +48 -0
- data/third_party/abseil-cpp/absl/random/bernoulli_distribution.h +200 -0
- data/third_party/abseil-cpp/absl/random/beta_distribution.h +427 -0
- data/third_party/abseil-cpp/absl/random/discrete_distribution.cc +98 -0
- data/third_party/abseil-cpp/absl/random/discrete_distribution.h +247 -0
- data/third_party/abseil-cpp/absl/random/distributions.h +452 -0
- data/third_party/abseil-cpp/absl/random/exponential_distribution.h +165 -0
- data/third_party/abseil-cpp/absl/random/gaussian_distribution.cc +104 -0
- data/third_party/abseil-cpp/absl/random/gaussian_distribution.h +275 -0
- data/third_party/abseil-cpp/absl/random/internal/distribution_caller.h +92 -0
- data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +268 -0
- data/third_party/abseil-cpp/absl/random/internal/fastmath.h +57 -0
- data/third_party/abseil-cpp/absl/random/internal/generate_real.h +144 -0
- data/third_party/abseil-cpp/absl/random/internal/iostream_state_saver.h +245 -0
- data/third_party/abseil-cpp/absl/random/internal/nonsecure_base.h +150 -0
- data/third_party/abseil-cpp/absl/random/internal/pcg_engine.h +308 -0
- data/third_party/abseil-cpp/absl/random/internal/platform.h +171 -0
- data/third_party/abseil-cpp/absl/random/internal/pool_urbg.cc +253 -0
- data/third_party/abseil-cpp/absl/random/internal/pool_urbg.h +131 -0
- data/third_party/abseil-cpp/absl/random/internal/randen.cc +91 -0
- data/third_party/abseil-cpp/absl/random/internal/randen.h +102 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +221 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_detect.h +33 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +239 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +526 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.h +50 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_round_keys.cc +462 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_slow.cc +471 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_slow.h +40 -0
- data/third_party/abseil-cpp/absl/random/internal/randen_traits.h +88 -0
- data/third_party/abseil-cpp/absl/random/internal/salted_seed_seq.h +167 -0
- data/third_party/abseil-cpp/absl/random/internal/seed_material.cc +267 -0
- data/third_party/abseil-cpp/absl/random/internal/seed_material.h +104 -0
- data/third_party/abseil-cpp/absl/random/internal/traits.h +101 -0
- data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +244 -0
- data/third_party/abseil-cpp/absl/random/internal/wide_multiply.h +111 -0
- data/third_party/abseil-cpp/absl/random/log_uniform_int_distribution.h +257 -0
- data/third_party/abseil-cpp/absl/random/poisson_distribution.h +258 -0
- data/third_party/abseil-cpp/absl/random/random.h +189 -0
- data/third_party/abseil-cpp/absl/random/seed_gen_exception.cc +46 -0
- data/third_party/abseil-cpp/absl/random/seed_gen_exception.h +55 -0
- data/third_party/abseil-cpp/absl/random/seed_sequences.cc +29 -0
- data/third_party/abseil-cpp/absl/random/seed_sequences.h +110 -0
- data/third_party/abseil-cpp/absl/random/uniform_int_distribution.h +275 -0
- data/third_party/abseil-cpp/absl/random/uniform_real_distribution.h +202 -0
- data/third_party/abseil-cpp/absl/random/zipf_distribution.h +271 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +1 -0
- data/third_party/boringssl-with-bazel/src/crypto/base64/base64.c +13 -0
- data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +21 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +12 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/mem.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs7/pkcs7.c +29 -0
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +0 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/base64.h +8 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +13 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +10 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +1 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs7.h +9 -4
- data/third_party/boringssl-with-bazel/src/include/openssl/pkcs8.h +6 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +23 -2
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +4 -0
- data/third_party/xxhash/xxhash.h +607 -352
- metadata +149 -77
- data/src/core/ext/transport/chttp2/transport/hpack_encoder_index.h +0 -107
- data/src/core/ext/transport/chttp2/transport/hpack_utils.cc +0 -46
- data/src/core/ext/transport/chttp2/transport/popularity_count.h +0 -60
- data/src/core/lib/compression/algorithm_metadata.h +0 -62
- data/src/core/lib/compression/compression_args.cc +0 -140
- data/src/core/lib/compression/compression_args.h +0 -58
- data/src/core/lib/compression/stream_compression.cc +0 -81
- data/src/core/lib/compression/stream_compression.h +0 -117
- data/src/core/lib/compression/stream_compression_gzip.cc +0 -231
- data/src/core/lib/compression/stream_compression_gzip.h +0 -28
- data/src/core/lib/compression/stream_compression_identity.cc +0 -91
- data/src/core/lib/compression/stream_compression_identity.h +0 -29
- data/src/core/lib/security/credentials/credentials_metadata.cc +0 -61
- data/src/core/lib/slice/static_slice.cc +0 -377
- data/src/core/lib/slice/static_slice.h +0 -300
- data/src/core/lib/transport/metadata.cc +0 -714
- data/src/core/lib/transport/metadata.h +0 -449
- data/src/core/lib/transport/metadata_batch.cc +0 -99
- data/src/core/lib/transport/static_metadata.cc +0 -1032
- data/src/core/lib/transport/static_metadata.h +0 -322
- data/src/core/lib/transport/status_metadata.cc +0 -63
- data/src/core/lib/transport/status_metadata.h +0 -48
@@ -21,14 +21,13 @@
|
|
21
21
|
|
22
22
|
#include <grpc/support/port_platform.h>
|
23
23
|
|
24
|
+
#include <cstdint>
|
25
|
+
|
24
26
|
#include <grpc/slice.h>
|
25
27
|
#include <grpc/slice_buffer.h>
|
26
28
|
|
27
29
|
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
28
|
-
#include "src/core/ext/transport/chttp2/transport/hpack_encoder_index.h"
|
29
30
|
#include "src/core/ext/transport/chttp2/transport/hpack_encoder_table.h"
|
30
|
-
#include "src/core/ext/transport/chttp2/transport/popularity_count.h"
|
31
|
-
#include "src/core/lib/transport/metadata.h"
|
32
31
|
#include "src/core/lib/transport/metadata_batch.h"
|
33
32
|
#include "src/core/lib/transport/transport.h"
|
34
33
|
|
@@ -36,48 +35,9 @@ extern grpc_core::TraceFlag grpc_http_trace;
|
|
36
35
|
|
37
36
|
namespace grpc_core {
|
38
37
|
|
39
|
-
// Wrapper to take an array of mdelems and make them encodable
|
40
|
-
class MetadataArray {
|
41
|
-
public:
|
42
|
-
MetadataArray(grpc_mdelem** elems, size_t count)
|
43
|
-
: elems_(elems), count_(count) {}
|
44
|
-
|
45
|
-
template <typename Encoder>
|
46
|
-
void Encode(Encoder* encoder) const {
|
47
|
-
for (size_t i = 0; i < count_; i++) {
|
48
|
-
encoder->Encode(*elems_[i]);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
private:
|
53
|
-
grpc_mdelem** elems_;
|
54
|
-
size_t count_;
|
55
|
-
};
|
56
|
-
|
57
|
-
namespace metadata_detail {
|
58
|
-
template <typename A, typename B>
|
59
|
-
class ConcatMetadata {
|
60
|
-
public:
|
61
|
-
ConcatMetadata(const A& a, const B& b) : a_(a), b_(b) {}
|
62
|
-
|
63
|
-
template <typename Encoder>
|
64
|
-
void Encode(Encoder* encoder) const {
|
65
|
-
a_.Encode(encoder);
|
66
|
-
b_.Encode(encoder);
|
67
|
-
}
|
68
|
-
|
69
|
-
private:
|
70
|
-
const A& a_;
|
71
|
-
const B& b_;
|
72
|
-
};
|
73
|
-
} // namespace metadata_detail
|
74
|
-
|
75
|
-
template <typename A, typename B>
|
76
|
-
metadata_detail::ConcatMetadata<A, B> ConcatMetadata(const A& a, const B& b) {
|
77
|
-
return metadata_detail::ConcatMetadata<A, B>(a, b);
|
78
|
-
}
|
79
|
-
|
80
38
|
class HPackCompressor {
|
39
|
+
class SliceIndex;
|
40
|
+
|
81
41
|
public:
|
82
42
|
HPackCompressor() = default;
|
83
43
|
~HPackCompressor() = default;
|
@@ -116,30 +76,41 @@ class HPackCompressor {
|
|
116
76
|
Framer(const Framer&) = delete;
|
117
77
|
Framer& operator=(const Framer&) = delete;
|
118
78
|
|
119
|
-
void Encode(
|
79
|
+
void Encode(const Slice& key, const Slice& value);
|
80
|
+
void Encode(HttpPathMetadata, const Slice& value);
|
81
|
+
void Encode(HttpAuthorityMetadata, const Slice& value);
|
82
|
+
void Encode(HttpStatusMetadata, uint32_t status);
|
120
83
|
void Encode(GrpcTimeoutMetadata, grpc_millis deadline);
|
121
84
|
void Encode(TeMetadata, TeMetadata::ValueType value);
|
85
|
+
void Encode(ContentTypeMetadata, ContentTypeMetadata::ValueType value);
|
86
|
+
void Encode(HttpSchemeMetadata, HttpSchemeMetadata::ValueType value);
|
87
|
+
void Encode(HttpMethodMetadata, HttpMethodMetadata::ValueType method);
|
122
88
|
void Encode(UserAgentMetadata, const Slice& slice);
|
89
|
+
void Encode(GrpcStatusMetadata, grpc_status_code status);
|
90
|
+
void Encode(GrpcEncodingMetadata, grpc_compression_algorithm value);
|
91
|
+
void Encode(GrpcAcceptEncodingMetadata, CompressionAlgorithmSet value);
|
92
|
+
void Encode(GrpcTagsBinMetadata, const Slice& slice);
|
93
|
+
void Encode(GrpcTraceBinMetadata, const Slice& slice);
|
123
94
|
void Encode(GrpcMessageMetadata, const Slice& slice) {
|
124
95
|
if (slice.empty()) return;
|
125
96
|
EmitLitHdrWithNonBinaryStringKeyNotIdx(
|
126
|
-
|
127
|
-
slice.c_slice());
|
97
|
+
Slice::FromStaticString("grpc-message"), slice.Ref());
|
128
98
|
}
|
129
99
|
template <typename Which>
|
130
|
-
void Encode(Which, const
|
100
|
+
void Encode(Which, const typename Which::ValueType& value) {
|
101
|
+
const Slice& slice = MetadataValueAsSlice<Which>(value);
|
131
102
|
if (absl::EndsWith(Which::key(), "-bin")) {
|
132
103
|
EmitLitHdrWithBinaryStringKeyNotIdx(
|
133
|
-
|
134
|
-
slice.c_slice());
|
104
|
+
Slice::FromStaticString(Which::key()), slice.Ref());
|
135
105
|
} else {
|
136
106
|
EmitLitHdrWithNonBinaryStringKeyNotIdx(
|
137
|
-
|
138
|
-
slice.c_slice());
|
107
|
+
Slice::FromStaticString(Which::key()), slice.Ref());
|
139
108
|
}
|
140
109
|
}
|
141
110
|
|
142
111
|
private:
|
112
|
+
friend class SliceIndex;
|
113
|
+
|
143
114
|
struct FramePrefix {
|
144
115
|
// index (in output_) of the header for the frame
|
145
116
|
size_t header_idx;
|
@@ -154,26 +125,24 @@ class HPackCompressor {
|
|
154
125
|
|
155
126
|
void AdvertiseTableSizeChange();
|
156
127
|
void EmitIndexed(uint32_t index);
|
157
|
-
void
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
void
|
162
|
-
|
163
|
-
void
|
164
|
-
|
165
|
-
void
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
const grpc_slice& value,
|
173
|
-
uint32_t transport_length);
|
128
|
+
void EmitLitHdrWithNonBinaryStringKeyIncIdx(Slice key_slice,
|
129
|
+
Slice value_slice);
|
130
|
+
void EmitLitHdrWithBinaryStringKeyIncIdx(Slice key_slice,
|
131
|
+
Slice value_slice);
|
132
|
+
void EmitLitHdrWithBinaryStringKeyNotIdx(Slice key_slice,
|
133
|
+
Slice value_slice);
|
134
|
+
void EmitLitHdrWithBinaryStringKeyNotIdx(uint32_t key_index,
|
135
|
+
Slice value_slice);
|
136
|
+
void EmitLitHdrWithNonBinaryStringKeyNotIdx(Slice key_slice,
|
137
|
+
Slice value_slice);
|
138
|
+
|
139
|
+
void EncodeAlwaysIndexed(uint32_t* index, absl::string_view key,
|
140
|
+
Slice value, uint32_t transport_length);
|
141
|
+
void EncodeIndexedKeyWithBinaryValue(uint32_t* index, absl::string_view key,
|
142
|
+
Slice value);
|
174
143
|
|
175
144
|
size_t CurrentFrameSize() const;
|
176
|
-
void Add(
|
145
|
+
void Add(Slice slice);
|
177
146
|
uint8_t* AddTiny(size_t len);
|
178
147
|
|
179
148
|
// maximum size of a frame
|
@@ -183,10 +152,6 @@ class HPackCompressor {
|
|
183
152
|
const bool is_end_of_stream_;
|
184
153
|
// output stream id
|
185
154
|
const uint32_t stream_id_;
|
186
|
-
#ifndef NDEBUG
|
187
|
-
// have we seen a regular (non-colon-prefixed) header yet?
|
188
|
-
bool seen_regular_header_ = false;
|
189
|
-
#endif
|
190
155
|
grpc_slice_buffer* const output_;
|
191
156
|
grpc_transport_one_way_stats* const stats_;
|
192
157
|
HPackCompressor* const compressor_;
|
@@ -195,14 +160,7 @@ class HPackCompressor {
|
|
195
160
|
|
196
161
|
private:
|
197
162
|
static constexpr size_t kNumFilterValues = 64;
|
198
|
-
|
199
|
-
void AddKeyWithIndex(grpc_slice_refcount* key_ref, uint32_t new_index,
|
200
|
-
uint32_t key_hash);
|
201
|
-
void AddElemWithIndex(grpc_mdelem elem, uint32_t new_index,
|
202
|
-
uint32_t elem_hash, uint32_t key_hash);
|
203
|
-
void AddElem(grpc_mdelem elem, size_t elem_size, uint32_t elem_hash,
|
204
|
-
uint32_t key_hash);
|
205
|
-
void AddKey(grpc_mdelem elem, size_t elem_size, uint32_t key_hash);
|
163
|
+
static constexpr uint32_t kNumCachedGrpcStatusValues = 16;
|
206
164
|
|
207
165
|
// maximum number of bytes we'll use for the decode table (to guard against
|
208
166
|
// peers ooming us by setting decode table size high)
|
@@ -212,96 +170,48 @@ class HPackCompressor {
|
|
212
170
|
bool advertise_table_size_change_ = false;
|
213
171
|
HPackEncoderTable table_;
|
214
172
|
|
215
|
-
|
216
|
-
// popularity count for particular hashes, and are used to determine whether
|
217
|
-
// a new literal should be added to the compression table or not.
|
218
|
-
// They track a single integer that counts how often a particular value has
|
219
|
-
// been seen. When that count reaches max (255), all values are halved.
|
220
|
-
PopularityCount<kNumFilterValues> filter_elems_;
|
221
|
-
|
222
|
-
class KeyElem {
|
173
|
+
class SliceIndex {
|
223
174
|
public:
|
224
|
-
|
225
|
-
public:
|
226
|
-
Stored() : elem_(GRPC_MDNULL) {}
|
227
|
-
explicit Stored(grpc_mdelem elem) : elem_(GRPC_MDELEM_REF(elem)) {}
|
228
|
-
Stored(const Stored& other) : elem_(GRPC_MDELEM_REF(other.elem_)) {}
|
229
|
-
Stored& operator=(Stored other) {
|
230
|
-
std::swap(elem_, other.elem_);
|
231
|
-
return *this;
|
232
|
-
}
|
233
|
-
~Stored() { GRPC_MDELEM_UNREF(elem_); }
|
234
|
-
|
235
|
-
const grpc_mdelem& elem() const { return elem_; }
|
236
|
-
|
237
|
-
bool operator==(const Stored& other) const noexcept {
|
238
|
-
return elem_.payload == other.elem_.payload;
|
239
|
-
}
|
240
|
-
|
241
|
-
private:
|
242
|
-
grpc_mdelem elem_;
|
243
|
-
};
|
244
|
-
|
245
|
-
KeyElem(grpc_mdelem elem, uint32_t hash) : elem_(elem), hash_(hash) {}
|
246
|
-
KeyElem(const KeyElem&);
|
247
|
-
KeyElem& operator=(const KeyElem&);
|
248
|
-
|
249
|
-
uint32_t hash() const {
|
250
|
-
// TODO(ctiller): unify this with what's in the cc file when we move this
|
251
|
-
// code to c++
|
252
|
-
return hash_ >> 6;
|
253
|
-
}
|
254
|
-
|
255
|
-
Stored stored() const { return Stored(elem_); }
|
256
|
-
|
257
|
-
bool operator==(const Stored& stored) const noexcept {
|
258
|
-
return elem_.payload == stored.elem().payload;
|
259
|
-
}
|
175
|
+
void EmitTo(absl::string_view key, const Slice& value, Framer* framer);
|
260
176
|
|
261
177
|
private:
|
262
|
-
|
263
|
-
|
178
|
+
struct ValueIndex {
|
179
|
+
ValueIndex(Slice value, uint32_t index)
|
180
|
+
: value(std::move(value)), index(index) {}
|
181
|
+
Slice value;
|
182
|
+
uint32_t index;
|
183
|
+
};
|
184
|
+
std::vector<ValueIndex> values_;
|
264
185
|
};
|
265
186
|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
KeySliceRef(grpc_slice_refcount* ref, uint32_t hash)
|
271
|
-
: ref_(ref), hash_(hash) {}
|
272
|
-
KeySliceRef(const KeySliceRef&) = delete;
|
273
|
-
KeySliceRef& operator=(const KeySliceRef&) = delete;
|
274
|
-
|
275
|
-
uint32_t hash() const {
|
276
|
-
// TODO(ctiller): unify this with what's in the cc file when we move this
|
277
|
-
// code to c++
|
278
|
-
return hash_ >> 6;
|
279
|
-
}
|
280
|
-
|
281
|
-
Stored stored() const {
|
282
|
-
ref_->Ref();
|
283
|
-
return Stored(ref_);
|
284
|
-
}
|
285
|
-
|
286
|
-
bool operator==(const Stored& stored) const noexcept {
|
287
|
-
return ref_ == stored.get();
|
288
|
-
}
|
289
|
-
|
290
|
-
private:
|
291
|
-
grpc_slice_refcount* ref_;
|
292
|
-
uint32_t hash_;
|
187
|
+
struct PreviousTimeout {
|
188
|
+
Timeout timeout;
|
189
|
+
uint32_t index;
|
293
190
|
};
|
294
191
|
|
295
|
-
// entry tables for keys & elems: these tables track values that have been
|
296
|
-
// seen and *may* be in the decompressor table
|
297
|
-
HPackEncoderIndex<KeyElem, kNumFilterValues> elem_index_;
|
298
|
-
HPackEncoderIndex<KeySliceRef, kNumFilterValues> key_index_;
|
299
192
|
// Index into table_ for the te:trailers metadata element
|
300
193
|
uint32_t te_index_ = 0;
|
194
|
+
// Index into table_ for the content-type metadata element
|
195
|
+
uint32_t content_type_index_ = 0;
|
301
196
|
// Index into table_ for the user-agent metadata element
|
302
197
|
uint32_t user_agent_index_ = 0;
|
198
|
+
// Cached grpc-status values
|
199
|
+
uint32_t cached_grpc_status_[kNumCachedGrpcStatusValues] = {};
|
200
|
+
// Cached grpc-encoding values
|
201
|
+
uint32_t cached_grpc_encoding_[GRPC_COMPRESS_ALGORITHMS_COUNT] = {};
|
202
|
+
// Cached grpc-accept-encoding value
|
203
|
+
uint32_t grpc_accept_encoding_index_ = 0;
|
204
|
+
// The grpc-accept-encoding string referred to by grpc_accept_encoding_index_
|
205
|
+
CompressionAlgorithmSet grpc_accept_encoding_;
|
206
|
+
// Index of something that was sent with grpc-tags-bin
|
207
|
+
uint32_t grpc_tags_bin_index_ = 0;
|
208
|
+
// Index of something that was sent with grpc-trace-bin
|
209
|
+
uint32_t grpc_trace_bin_index_ = 0;
|
303
210
|
// The user-agent string referred to by user_agent_index_
|
304
211
|
Slice user_agent_;
|
212
|
+
SliceIndex path_index_;
|
213
|
+
SliceIndex authority_index_;
|
214
|
+
std::vector<PreviousTimeout> previous_timeouts_;
|
305
215
|
};
|
306
216
|
|
307
217
|
} // namespace grpc_core
|
@@ -22,7 +22,7 @@ namespace grpc_core {
|
|
22
22
|
|
23
23
|
uint32_t HPackEncoderTable::AllocateIndex(size_t element_size) {
|
24
24
|
uint32_t new_index = tail_remote_index_ + table_elems_ + 1;
|
25
|
-
GPR_DEBUG_ASSERT(element_size
|
25
|
+
GPR_DEBUG_ASSERT(element_size <= MaxEntrySize());
|
26
26
|
|
27
27
|
if (element_size > max_table_size_) {
|
28
28
|
while (table_size_ > 0) {
|
@@ -29,6 +29,8 @@ class HPackEncoderTable {
|
|
29
29
|
public:
|
30
30
|
HPackEncoderTable() : elem_size_(hpack_constants::kInitialTableEntries) {}
|
31
31
|
|
32
|
+
static constexpr size_t MaxEntrySize() { return 65535; }
|
33
|
+
|
32
34
|
// Reserve space in table for the new element, evict entries if needed.
|
33
35
|
// Return the new index of the element. Return 0 to indicate not adding to
|
34
36
|
// table.
|
@@ -1076,11 +1076,7 @@ class HPackParser::Parser {
|
|
1076
1076
|
return HandleMetadataSizeLimitExceeded(md);
|
1077
1077
|
}
|
1078
1078
|
|
1079
|
-
|
1080
|
-
if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) {
|
1081
|
-
input_->SetError(err);
|
1082
|
-
return false;
|
1083
|
-
}
|
1079
|
+
metadata_buffer_->Set(md);
|
1084
1080
|
return true;
|
1085
1081
|
}
|
1086
1082
|
|
@@ -1129,8 +1125,11 @@ class HPackParser::Parser {
|
|
1129
1125
|
auto value_slice = value->Take<TakeValueType>();
|
1130
1126
|
const auto transport_size = key_string.size() + value_slice.size() +
|
1131
1127
|
hpack_constants::kEntryOverhead;
|
1132
|
-
return grpc_metadata_batch::Parse(
|
1133
|
-
|
1128
|
+
return grpc_metadata_batch::Parse(
|
1129
|
+
key->string_view(), std::move(value_slice), transport_size,
|
1130
|
+
[key_string](absl::string_view error, const Slice& value) {
|
1131
|
+
ReportMetadataParseError(key_string, error, value.as_string_view());
|
1132
|
+
});
|
1134
1133
|
}
|
1135
1134
|
|
1136
1135
|
// Parse an index encoded key and a string encoded value
|
@@ -1143,7 +1142,11 @@ class HPackParser::Parser {
|
|
1143
1142
|
}
|
1144
1143
|
auto value = ParseValueString(elem->is_binary_header());
|
1145
1144
|
if (GPR_UNLIKELY(!value.has_value())) return {};
|
1146
|
-
return elem->WithNewValue(value->Take<TakeValueType>()
|
1145
|
+
return elem->WithNewValue(value->Take<TakeValueType>(),
|
1146
|
+
[=](absl::string_view error, const Slice& value) {
|
1147
|
+
ReportMetadataParseError(
|
1148
|
+
elem->key(), error, value.as_string_view());
|
1149
|
+
});
|
1147
1150
|
}
|
1148
1151
|
|
1149
1152
|
// Parse a varint index encoded key and a string encoded value
|
@@ -1230,6 +1233,14 @@ class HPackParser::Parser {
|
|
1230
1233
|
false);
|
1231
1234
|
}
|
1232
1235
|
|
1236
|
+
static void ReportMetadataParseError(absl::string_view key,
|
1237
|
+
absl::string_view error,
|
1238
|
+
absl::string_view value) {
|
1239
|
+
gpr_log(
|
1240
|
+
GPR_ERROR, "Error parsing metadata: %s",
|
1241
|
+
absl::StrCat("error=", error, " key=", key, " value=", value).c_str());
|
1242
|
+
}
|
1243
|
+
|
1233
1244
|
Input* const input_;
|
1234
1245
|
grpc_metadata_batch* const metadata_buffer_;
|
1235
1246
|
HPackTable* const table_;
|
@@ -1356,25 +1367,6 @@ static void force_client_rst_stream(void* sp, grpc_error_handle /*error*/) {
|
|
1356
1367
|
GRPC_CHTTP2_STREAM_UNREF(s, "final_rst");
|
1357
1368
|
}
|
1358
1369
|
|
1359
|
-
static void parse_stream_compression_md(grpc_chttp2_transport* /*t*/,
|
1360
|
-
grpc_chttp2_stream* s,
|
1361
|
-
grpc_metadata_batch* initial_metadata) {
|
1362
|
-
if (initial_metadata->legacy_index()->named.content_encoding == nullptr ||
|
1363
|
-
grpc_stream_compression_method_parse(
|
1364
|
-
GRPC_MDVALUE(
|
1365
|
-
initial_metadata->legacy_index()->named.content_encoding->md),
|
1366
|
-
false, &s->stream_decompression_method) == 0) {
|
1367
|
-
s->stream_decompression_method =
|
1368
|
-
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS;
|
1369
|
-
}
|
1370
|
-
|
1371
|
-
if (s->stream_decompression_method !=
|
1372
|
-
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS) {
|
1373
|
-
s->stream_decompression_ctx = nullptr;
|
1374
|
-
grpc_slice_buffer_init(&s->decompressed_data_buffer);
|
1375
|
-
}
|
1376
|
-
}
|
1377
|
-
|
1378
1370
|
grpc_error_handle grpc_chttp2_header_parser_parse(void* hpack_parser,
|
1379
1371
|
grpc_chttp2_transport* t,
|
1380
1372
|
grpc_chttp2_stream* s,
|
@@ -1398,11 +1390,6 @@ grpc_error_handle grpc_chttp2_header_parser_parse(void* hpack_parser,
|
|
1398
1390
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
1399
1391
|
"Too many trailer frames");
|
1400
1392
|
}
|
1401
|
-
/* Process stream compression md element if it exists */
|
1402
|
-
if (s->header_frames_received ==
|
1403
|
-
0) { /* Only acts on initial metadata */
|
1404
|
-
parse_stream_compression_md(t, s, &s->initial_metadata_buffer);
|
1405
|
-
}
|
1406
1393
|
s->published_metadata[s->header_frames_received] =
|
1407
1394
|
GRPC_METADATA_PUBLISHED_FROM_WIRE;
|
1408
1395
|
maybe_complete_funcs[s->header_frames_received](t, s);
|
@@ -25,7 +25,6 @@
|
|
25
25
|
|
26
26
|
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
27
27
|
#include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h"
|
28
|
-
#include "src/core/lib/transport/metadata.h"
|
29
28
|
#include "src/core/lib/transport/metadata_batch.h"
|
30
29
|
|
31
30
|
namespace grpc_core {
|
@@ -28,11 +28,11 @@
|
|
28
28
|
#include <grpc/support/alloc.h>
|
29
29
|
#include <grpc/support/log.h>
|
30
30
|
|
31
|
+
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
|
31
32
|
#include "src/core/lib/debug/trace.h"
|
32
33
|
#include "src/core/lib/gpr/murmur_hash.h"
|
33
34
|
#include "src/core/lib/slice/slice_internal.h"
|
34
35
|
#include "src/core/lib/surface/validate_metadata.h"
|
35
|
-
#include "src/core/lib/transport/static_metadata.h"
|
36
36
|
|
37
37
|
extern grpc_core::TraceFlag grpc_http_trace;
|
38
38
|
|
@@ -143,4 +143,97 @@ grpc_error_handle HPackTable::Add(Memento md) {
|
|
143
143
|
return GRPC_ERROR_NONE;
|
144
144
|
}
|
145
145
|
|
146
|
+
namespace {
|
147
|
+
struct StaticTableEntry {
|
148
|
+
const char* key;
|
149
|
+
const char* value;
|
150
|
+
};
|
151
|
+
|
152
|
+
const StaticTableEntry kStaticTable[hpack_constants::kLastStaticEntry] = {
|
153
|
+
{":authority", ""},
|
154
|
+
{":method", "GET"},
|
155
|
+
{":method", "POST"},
|
156
|
+
{":path", "/"},
|
157
|
+
{":path", "/index.html"},
|
158
|
+
{":scheme", "http"},
|
159
|
+
{":scheme", "https"},
|
160
|
+
{":status", "200"},
|
161
|
+
{":status", "204"},
|
162
|
+
{":status", "206"},
|
163
|
+
{":status", "304"},
|
164
|
+
{":status", "400"},
|
165
|
+
{":status", "404"},
|
166
|
+
{":status", "500"},
|
167
|
+
{"accept-charset", ""},
|
168
|
+
{"accept-encoding", "gzip, deflate"},
|
169
|
+
{"accept-language", ""},
|
170
|
+
{"accept-ranges", ""},
|
171
|
+
{"accept", ""},
|
172
|
+
{"access-control-allow-origin", ""},
|
173
|
+
{"age", ""},
|
174
|
+
{"allow", ""},
|
175
|
+
{"authorization", ""},
|
176
|
+
{"cache-control", ""},
|
177
|
+
{"content-disposition", ""},
|
178
|
+
{"content-encoding", ""},
|
179
|
+
{"content-language", ""},
|
180
|
+
{"content-length", ""},
|
181
|
+
{"content-location", ""},
|
182
|
+
{"content-range", ""},
|
183
|
+
{"content-type", ""},
|
184
|
+
{"cookie", ""},
|
185
|
+
{"date", ""},
|
186
|
+
{"etag", ""},
|
187
|
+
{"expect", ""},
|
188
|
+
{"expires", ""},
|
189
|
+
{"from", ""},
|
190
|
+
{"host", ""},
|
191
|
+
{"if-match", ""},
|
192
|
+
{"if-modified-since", ""},
|
193
|
+
{"if-none-match", ""},
|
194
|
+
{"if-range", ""},
|
195
|
+
{"if-unmodified-since", ""},
|
196
|
+
{"last-modified", ""},
|
197
|
+
{"link", ""},
|
198
|
+
{"location", ""},
|
199
|
+
{"max-forwards", ""},
|
200
|
+
{"proxy-authenticate", ""},
|
201
|
+
{"proxy-authorization", ""},
|
202
|
+
{"range", ""},
|
203
|
+
{"referer", ""},
|
204
|
+
{"refresh", ""},
|
205
|
+
{"retry-after", ""},
|
206
|
+
{"server", ""},
|
207
|
+
{"set-cookie", ""},
|
208
|
+
{"strict-transport-security", ""},
|
209
|
+
{"transfer-encoding", ""},
|
210
|
+
{"user-agent", ""},
|
211
|
+
{"vary", ""},
|
212
|
+
{"via", ""},
|
213
|
+
{"www-authenticate", ""},
|
214
|
+
};
|
215
|
+
|
216
|
+
GPR_ATTRIBUTE_NOINLINE HPackTable::Memento MakeMemento(size_t i) {
|
217
|
+
auto sm = kStaticTable[i];
|
218
|
+
return grpc_metadata_batch::Parse(
|
219
|
+
sm.key, Slice::FromStaticString(sm.value),
|
220
|
+
strlen(sm.key) + strlen(sm.value) + hpack_constants::kEntryOverhead,
|
221
|
+
[](absl::string_view, const Slice&) {
|
222
|
+
abort(); // not expecting to see this
|
223
|
+
});
|
224
|
+
}
|
225
|
+
|
226
|
+
} // namespace
|
227
|
+
|
228
|
+
const HPackTable::StaticMementos& HPackTable::GetStaticMementos() {
|
229
|
+
static const StaticMementos static_mementos;
|
230
|
+
return static_mementos;
|
231
|
+
}
|
232
|
+
|
233
|
+
HPackTable::StaticMementos::StaticMementos() {
|
234
|
+
for (uint32_t i = 0; i < hpack_constants::kLastStaticEntry; i++) {
|
235
|
+
memento[i] = MakeMemento(i);
|
236
|
+
}
|
237
|
+
}
|
238
|
+
|
146
239
|
} // namespace grpc_core
|
@@ -26,9 +26,7 @@
|
|
26
26
|
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
|
27
27
|
#include "src/core/lib/gprpp/memory.h"
|
28
28
|
#include "src/core/lib/iomgr/error.h"
|
29
|
-
#include "src/core/lib/transport/metadata.h"
|
30
29
|
#include "src/core/lib/transport/metadata_batch.h"
|
31
|
-
#include "src/core/lib/transport/static_metadata.h"
|
32
30
|
|
33
31
|
namespace grpc_core {
|
34
32
|
|
@@ -69,17 +67,10 @@ class HPackTable {
|
|
69
67
|
|
70
68
|
private:
|
71
69
|
struct StaticMementos {
|
72
|
-
StaticMementos()
|
73
|
-
for (uint32_t i = 0; i < hpack_constants::kLastStaticEntry; i++) {
|
74
|
-
memento[i] = Memento(g_static_mdelem_manifested[i]);
|
75
|
-
}
|
76
|
-
}
|
70
|
+
StaticMementos();
|
77
71
|
Memento memento[hpack_constants::kLastStaticEntry];
|
78
72
|
};
|
79
|
-
static const StaticMementos& GetStaticMementos()
|
80
|
-
static const StaticMementos static_mementos;
|
81
|
-
return static_mementos;
|
82
|
-
}
|
73
|
+
static const StaticMementos& GetStaticMementos() GPR_ATTRIBUTE_NOINLINE;
|
83
74
|
|
84
75
|
enum { kInlineEntries = hpack_constants::kInitialTableEntries };
|
85
76
|
using EntriesVec = absl::InlinedVector<Memento, kInlineEntries>;
|
@@ -121,17 +112,4 @@ class HPackTable {
|
|
121
112
|
|
122
113
|
} // namespace grpc_core
|
123
114
|
|
124
|
-
/* Returns the static hpack table index that corresponds to /a elem. Returns 0
|
125
|
-
if /a elem is not statically stored or if it is not in the static hpack
|
126
|
-
table */
|
127
|
-
inline uintptr_t grpc_chttp2_get_static_hpack_table_index(grpc_mdelem md) {
|
128
|
-
uintptr_t index =
|
129
|
-
reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(md)) -
|
130
|
-
grpc_core::g_static_mdelem_table;
|
131
|
-
if (index < grpc_core::hpack_constants::kLastStaticEntry) {
|
132
|
-
return index + 1; // Hpack static metadata element indices start at 1
|
133
|
-
}
|
134
|
-
return 0;
|
135
|
-
}
|
136
|
-
|
137
115
|
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_TABLE_H */
|
@@ -36,7 +36,6 @@
|
|
36
36
|
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
|
37
37
|
#include "src/core/ext/transport/chttp2/transport/stream_map.h"
|
38
38
|
#include "src/core/lib/channel/channelz.h"
|
39
|
-
#include "src/core/lib/compression/stream_compression.h"
|
40
39
|
#include "src/core/lib/gprpp/manual_constructor.h"
|
41
40
|
#include "src/core/lib/iomgr/combiner.h"
|
42
41
|
#include "src/core/lib/iomgr/endpoint.h"
|
@@ -254,8 +253,6 @@ class Chttp2IncomingByteStream : public ByteStream {
|
|
254
253
|
static void NextLocked(void* arg, grpc_error_handle error_ignored);
|
255
254
|
static void OrphanLocked(void* arg, grpc_error_handle error_ignored);
|
256
255
|
|
257
|
-
void MaybeCreateStreamDecompressionCtx();
|
258
|
-
|
259
256
|
grpc_chttp2_transport* transport_; // Immutable.
|
260
257
|
grpc_chttp2_stream* stream_; // Immutable.
|
261
258
|
|
@@ -523,8 +520,6 @@ struct grpc_chttp2_stream {
|
|
523
520
|
explicit Reffer(grpc_chttp2_stream* s);
|
524
521
|
} reffer;
|
525
522
|
|
526
|
-
grpc_core::MemoryAllocator::Reservation stream_reservation;
|
527
|
-
|
528
523
|
grpc_closure destroy_stream;
|
529
524
|
grpc_closure* destroy_stream_arg;
|
530
525
|
|
@@ -644,38 +639,10 @@ struct grpc_chttp2_stream {
|
|
644
639
|
grpc_chttp2_write_cb* finish_after_write = nullptr;
|
645
640
|
size_t sending_bytes = 0;
|
646
641
|
|
647
|
-
/* Stream compression method to be used. */
|
648
|
-
grpc_stream_compression_method stream_compression_method =
|
649
|
-
GRPC_STREAM_COMPRESSION_IDENTITY_COMPRESS;
|
650
|
-
/* Stream decompression method to be used. */
|
651
|
-
grpc_stream_compression_method stream_decompression_method =
|
652
|
-
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS;
|
653
|
-
|
654
|
-
/** Whether bytes stored in unprocessed_incoming_byte_stream is decompressed
|
655
|
-
*/
|
656
|
-
bool unprocessed_incoming_frames_decompressed = false;
|
657
642
|
/** Whether the bytes needs to be traced using Fathom */
|
658
643
|
bool traced = false;
|
659
|
-
/** gRPC header bytes that are already decompressed */
|
660
|
-
size_t decompressed_header_bytes = 0;
|
661
644
|
/** Byte counter for number of bytes written */
|
662
645
|
size_t byte_counter = 0;
|
663
|
-
|
664
|
-
/** Amount of uncompressed bytes sent out when compressed_data_buffer is
|
665
|
-
* emptied */
|
666
|
-
size_t uncompressed_data_size;
|
667
|
-
/** Stream compression compress context */
|
668
|
-
grpc_stream_compression_context* stream_compression_ctx;
|
669
|
-
/** Buffer storing data that is compressed but not sent */
|
670
|
-
grpc_slice_buffer compressed_data_buffer;
|
671
|
-
|
672
|
-
/** Stream compression decompress context */
|
673
|
-
grpc_stream_compression_context* stream_decompression_ctx;
|
674
|
-
/** Temporary buffer storing decompressed data.
|
675
|
-
* Initialized, used, and destroyed only when stream uses (non-identity)
|
676
|
-
* compression.
|
677
|
-
*/
|
678
|
-
grpc_slice_buffer decompressed_data_buffer;
|
679
646
|
};
|
680
647
|
|
681
648
|
/** Transport writing call flow:
|
@@ -31,7 +31,6 @@
|
|
31
31
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
32
32
|
#include "src/core/lib/slice/slice_utils.h"
|
33
33
|
#include "src/core/lib/transport/http2_errors.h"
|
34
|
-
#include "src/core/lib/transport/static_metadata.h"
|
35
34
|
#include "src/core/lib/transport/status_conversion.h"
|
36
35
|
#include "src/core/lib/transport/timeout_encoding.h"
|
37
36
|
|
@@ -306,11 +305,6 @@ static grpc_error_handle skip_parser(void* /*parser*/,
|
|
306
305
|
return GRPC_ERROR_NONE;
|
307
306
|
}
|
308
307
|
|
309
|
-
grpc_error_handle skip_header(grpc_mdelem md) {
|
310
|
-
GRPC_MDELEM_UNREF(md);
|
311
|
-
return GRPC_ERROR_NONE;
|
312
|
-
}
|
313
|
-
|
314
308
|
static HPackParser::Boundary hpack_boundary_type(grpc_chttp2_transport* t,
|
315
309
|
bool is_eoh) {
|
316
310
|
if (is_eoh) {
|