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
@@ -23,30 +23,31 @@
|
|
23
23
|
#include <assert.h>
|
24
24
|
#include <string.h>
|
25
25
|
|
26
|
+
#include <cstdint>
|
27
|
+
|
28
|
+
#include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
|
29
|
+
#include "src/core/ext/transport/chttp2/transport/hpack_encoder_table.h"
|
30
|
+
|
26
31
|
/* This is here for grpc_is_binary_header
|
27
32
|
* TODO(murgatroid99): Remove this
|
28
33
|
*/
|
29
34
|
#include <grpc/grpc.h>
|
35
|
+
#include <grpc/slice.h>
|
30
36
|
#include <grpc/support/alloc.h>
|
31
37
|
#include <grpc/support/log.h>
|
32
38
|
|
33
39
|
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
|
34
|
-
#include "src/core/ext/transport/chttp2/transport/hpack_utils.h"
|
35
40
|
#include "src/core/ext/transport/chttp2/transport/varint.h"
|
36
41
|
#include "src/core/lib/debug/stats.h"
|
37
42
|
#include "src/core/lib/slice/slice_internal.h"
|
38
43
|
#include "src/core/lib/slice/slice_string_helpers.h"
|
39
44
|
#include "src/core/lib/surface/validate_metadata.h"
|
40
|
-
#include "src/core/lib/transport/metadata.h"
|
41
|
-
#include "src/core/lib/transport/static_metadata.h"
|
42
45
|
#include "src/core/lib/transport/timeout_encoding.h"
|
43
46
|
|
44
47
|
namespace grpc_core {
|
45
48
|
|
46
49
|
namespace {
|
47
50
|
|
48
|
-
/* don't consider adding anything bigger than this to the hpack table */
|
49
|
-
constexpr size_t kMaxDecoderSpaceUsage = 512;
|
50
51
|
constexpr size_t kDataFrameHeaderSize = 9;
|
51
52
|
|
52
53
|
} /* namespace */
|
@@ -134,19 +135,23 @@ void HPackCompressor::Framer::EnsureSpace(size_t need_bytes) {
|
|
134
135
|
prefix_ = BeginFrame();
|
135
136
|
}
|
136
137
|
|
137
|
-
void HPackCompressor::Framer::Add(
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
138
|
+
void HPackCompressor::Framer::Add(Slice slice) {
|
139
|
+
while (true) {
|
140
|
+
const size_t len = slice.length();
|
141
|
+
if (len == 0) return;
|
142
|
+
const size_t remaining = max_frame_size_ - CurrentFrameSize();
|
143
|
+
if (len <= remaining) {
|
144
|
+
stats_->header_bytes += len;
|
145
|
+
grpc_slice_buffer_add(output_, slice.TakeCSlice());
|
146
|
+
return;
|
147
|
+
} else {
|
148
|
+
stats_->header_bytes += remaining;
|
149
|
+
Slice tail = slice.Split(remaining);
|
150
|
+
grpc_slice_buffer_add(output_, slice.TakeCSlice());
|
151
|
+
slice = std::move(tail);
|
152
|
+
FinishFrame(false);
|
153
|
+
prefix_ = BeginFrame();
|
154
|
+
}
|
150
155
|
}
|
151
156
|
}
|
152
157
|
|
@@ -156,37 +161,6 @@ uint8_t* HPackCompressor::Framer::AddTiny(size_t len) {
|
|
156
161
|
return grpc_slice_buffer_tiny_add(output_, len);
|
157
162
|
}
|
158
163
|
|
159
|
-
// Add a key to the dynamic table. Both key and value will be added to table at
|
160
|
-
// the decoder.
|
161
|
-
void HPackCompressor::AddKeyWithIndex(grpc_slice_refcount* key_ref,
|
162
|
-
uint32_t new_index, uint32_t key_hash) {
|
163
|
-
key_index_.Insert(KeySliceRef(key_ref, key_hash), new_index);
|
164
|
-
}
|
165
|
-
|
166
|
-
/* add an element to the decoder table */
|
167
|
-
void HPackCompressor::AddElemWithIndex(grpc_mdelem elem, uint32_t new_index,
|
168
|
-
uint32_t elem_hash, uint32_t key_hash) {
|
169
|
-
GPR_DEBUG_ASSERT(GRPC_MDELEM_IS_INTERNED(elem));
|
170
|
-
elem_index_.Insert(KeyElem(elem, elem_hash), new_index);
|
171
|
-
AddKeyWithIndex(GRPC_MDKEY(elem).refcount, new_index, key_hash);
|
172
|
-
}
|
173
|
-
|
174
|
-
void HPackCompressor::AddElem(grpc_mdelem elem, size_t elem_size,
|
175
|
-
uint32_t elem_hash, uint32_t key_hash) {
|
176
|
-
uint32_t new_index = table_.AllocateIndex(elem_size);
|
177
|
-
if (new_index != 0) {
|
178
|
-
AddElemWithIndex(elem, new_index, elem_hash, key_hash);
|
179
|
-
}
|
180
|
-
}
|
181
|
-
|
182
|
-
void HPackCompressor::AddKey(grpc_mdelem elem, size_t elem_size,
|
183
|
-
uint32_t key_hash) {
|
184
|
-
uint32_t new_index = table_.AllocateIndex(elem_size);
|
185
|
-
if (new_index != 0) {
|
186
|
-
AddKeyWithIndex(GRPC_MDKEY(elem).refcount, new_index, key_hash);
|
187
|
-
}
|
188
|
-
}
|
189
|
-
|
190
164
|
void HPackCompressor::Framer::EmitIndexed(uint32_t elem_index) {
|
191
165
|
GRPC_STATS_INC_HPACK_SEND_INDEXED();
|
192
166
|
VarintWriter<1> w(elem_index);
|
@@ -195,35 +169,33 @@ void HPackCompressor::Framer::EmitIndexed(uint32_t elem_index) {
|
|
195
169
|
|
196
170
|
struct WireValue {
|
197
171
|
WireValue(uint8_t huffman_prefix, bool insert_null_before_wire_value,
|
198
|
-
|
199
|
-
: data(slice),
|
172
|
+
Slice slice)
|
173
|
+
: data(std::move(slice)),
|
200
174
|
huffman_prefix(huffman_prefix),
|
201
175
|
insert_null_before_wire_value(insert_null_before_wire_value),
|
202
|
-
length(
|
203
|
-
|
204
|
-
// While wire_value is const from the POV of hpack encoder code, actually
|
205
|
-
// adding it to a slice buffer will possibly split the slice.
|
206
|
-
const grpc_slice data;
|
176
|
+
length(data.length() + (insert_null_before_wire_value ? 1 : 0)) {}
|
177
|
+
Slice data;
|
207
178
|
const uint8_t huffman_prefix;
|
208
179
|
const bool insert_null_before_wire_value;
|
209
180
|
const size_t length;
|
210
181
|
};
|
211
182
|
|
212
|
-
static WireValue GetWireValue(
|
183
|
+
static WireValue GetWireValue(Slice value, bool true_binary_enabled,
|
213
184
|
bool is_bin_hdr) {
|
214
185
|
if (is_bin_hdr) {
|
215
186
|
if (true_binary_enabled) {
|
216
187
|
GRPC_STATS_INC_HPACK_SEND_BINARY();
|
217
|
-
return WireValue(0x00, true,
|
188
|
+
return WireValue(0x00, true, std::move(value));
|
218
189
|
} else {
|
219
190
|
GRPC_STATS_INC_HPACK_SEND_BINARY_BASE64();
|
220
191
|
return WireValue(0x80, false,
|
221
|
-
grpc_chttp2_base64_encode_and_huffman_compress(
|
192
|
+
Slice(grpc_chttp2_base64_encode_and_huffman_compress(
|
193
|
+
value.c_slice())));
|
222
194
|
}
|
223
195
|
} else {
|
224
196
|
/* TODO(ctiller): opportunistically compress non-binary headers */
|
225
197
|
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
|
226
|
-
return WireValue(0x00, false,
|
198
|
+
return WireValue(0x00, false, std::move(value));
|
227
199
|
}
|
228
200
|
}
|
229
201
|
|
@@ -238,38 +210,11 @@ struct UnsureIfInterned {
|
|
238
210
|
}
|
239
211
|
};
|
240
212
|
|
241
|
-
class StringValue {
|
242
|
-
public:
|
243
|
-
template <typename MetadataKeyType>
|
244
|
-
StringValue(MetadataKeyType, grpc_mdelem elem, bool use_true_binary_metadata)
|
245
|
-
: wire_value_(GetWireValue(GRPC_MDVALUE(elem), use_true_binary_metadata,
|
246
|
-
MetadataKeyType::IsBinary(GRPC_MDKEY(elem)))),
|
247
|
-
len_val_(wire_value_.length) {}
|
248
|
-
|
249
|
-
size_t prefix_length() const {
|
250
|
-
return len_val_.length() +
|
251
|
-
(wire_value_.insert_null_before_wire_value ? 1 : 0);
|
252
|
-
}
|
253
|
-
|
254
|
-
void WritePrefix(uint8_t* prefix_data) {
|
255
|
-
len_val_.Write(wire_value_.huffman_prefix, prefix_data);
|
256
|
-
if (wire_value_.insert_null_before_wire_value) {
|
257
|
-
prefix_data[len_val_.length()] = 0;
|
258
|
-
}
|
259
|
-
}
|
260
|
-
|
261
|
-
const grpc_slice& data() { return wire_value_.data; }
|
262
|
-
|
263
|
-
private:
|
264
|
-
WireValue wire_value_;
|
265
|
-
VarintWriter<1> len_val_;
|
266
|
-
};
|
267
|
-
|
268
213
|
class BinaryStringValue {
|
269
214
|
public:
|
270
|
-
explicit BinaryStringValue(
|
271
|
-
|
272
|
-
|
215
|
+
explicit BinaryStringValue(Slice value, bool use_true_binary_metadata)
|
216
|
+
: wire_value_(
|
217
|
+
GetWireValue(std::move(value), use_true_binary_metadata, true)),
|
273
218
|
len_val_(wire_value_.length) {}
|
274
219
|
|
275
220
|
size_t prefix_length() const {
|
@@ -284,7 +229,7 @@ class BinaryStringValue {
|
|
284
229
|
}
|
285
230
|
}
|
286
231
|
|
287
|
-
|
232
|
+
Slice data() { return std::move(wire_value_.data); }
|
288
233
|
|
289
234
|
private:
|
290
235
|
WireValue wire_value_;
|
@@ -293,24 +238,24 @@ class BinaryStringValue {
|
|
293
238
|
|
294
239
|
class NonBinaryStringValue {
|
295
240
|
public:
|
296
|
-
explicit NonBinaryStringValue(
|
297
|
-
: value_(value), len_val_(
|
241
|
+
explicit NonBinaryStringValue(Slice value)
|
242
|
+
: value_(std::move(value)), len_val_(value_.length()) {}
|
298
243
|
|
299
244
|
size_t prefix_length() const { return len_val_.length(); }
|
300
245
|
|
301
246
|
void WritePrefix(uint8_t* prefix_data) { len_val_.Write(0x00, prefix_data); }
|
302
247
|
|
303
|
-
|
248
|
+
Slice data() { return std::move(value_); }
|
304
249
|
|
305
250
|
private:
|
306
|
-
|
251
|
+
Slice value_;
|
307
252
|
VarintWriter<1> len_val_;
|
308
253
|
};
|
309
254
|
|
310
255
|
class StringKey {
|
311
256
|
public:
|
312
|
-
explicit StringKey(
|
313
|
-
: key_(key), len_key_(
|
257
|
+
explicit StringKey(Slice key)
|
258
|
+
: key_(std::move(key)), len_key_(key_.length()) {}
|
314
259
|
|
315
260
|
size_t prefix_length() const { return 1 + len_key_.length(); }
|
316
261
|
|
@@ -319,91 +264,71 @@ class StringKey {
|
|
319
264
|
len_key_.Write(0x00, data + 1);
|
320
265
|
}
|
321
266
|
|
322
|
-
|
267
|
+
Slice key() { return std::move(key_); }
|
323
268
|
|
324
269
|
private:
|
325
|
-
|
270
|
+
Slice key_;
|
326
271
|
VarintWriter<1> len_key_;
|
327
272
|
};
|
328
273
|
|
329
|
-
void HPackCompressor::Framer::
|
330
|
-
|
331
|
-
GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX();
|
332
|
-
StringValue emit(DefinitelyInterned(), elem, use_true_binary_metadata_);
|
333
|
-
VarintWriter<2> key(key_index);
|
334
|
-
uint8_t* data = AddTiny(key.length() + emit.prefix_length());
|
335
|
-
key.Write(0x40, data);
|
336
|
-
emit.WritePrefix(data + key.length());
|
337
|
-
Add(emit.data());
|
338
|
-
}
|
339
|
-
|
340
|
-
void HPackCompressor::Framer::EmitLitHdrNotIdx(uint32_t key_index,
|
341
|
-
grpc_mdelem elem) {
|
342
|
-
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX();
|
343
|
-
StringValue emit(DefinitelyInterned(), elem, use_true_binary_metadata_);
|
344
|
-
VarintWriter<4> key(key_index);
|
345
|
-
uint8_t* data = AddTiny(key.length() + emit.prefix_length());
|
346
|
-
key.Write(0x00, data);
|
347
|
-
emit.WritePrefix(data + key.length());
|
348
|
-
Add(emit.data());
|
349
|
-
}
|
350
|
-
|
351
|
-
void HPackCompressor::Framer::EmitLitHdrWithStringKeyIncIdx(grpc_mdelem elem) {
|
274
|
+
void HPackCompressor::Framer::EmitLitHdrWithNonBinaryStringKeyIncIdx(
|
275
|
+
Slice key_slice, Slice value_slice) {
|
352
276
|
GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V();
|
353
277
|
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
|
354
|
-
StringKey key(
|
278
|
+
StringKey key(std::move(key_slice));
|
355
279
|
key.WritePrefix(0x40, AddTiny(key.prefix_length()));
|
356
|
-
Add(
|
357
|
-
|
280
|
+
Add(key.key());
|
281
|
+
NonBinaryStringValue emit(std::move(value_slice));
|
358
282
|
emit.WritePrefix(AddTiny(emit.prefix_length()));
|
359
283
|
Add(emit.data());
|
360
284
|
}
|
361
285
|
|
362
|
-
void HPackCompressor::Framer::
|
363
|
-
|
364
|
-
|
286
|
+
void HPackCompressor::Framer::EmitLitHdrWithBinaryStringKeyNotIdx(
|
287
|
+
Slice key_slice, Slice value_slice) {
|
288
|
+
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
|
365
289
|
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
|
366
|
-
StringKey key(key_slice);
|
367
|
-
key.WritePrefix(
|
368
|
-
Add(
|
369
|
-
|
290
|
+
StringKey key(std::move(key_slice));
|
291
|
+
key.WritePrefix(0x00, AddTiny(key.prefix_length()));
|
292
|
+
Add(key.key());
|
293
|
+
BinaryStringValue emit(std::move(value_slice), use_true_binary_metadata_);
|
370
294
|
emit.WritePrefix(AddTiny(emit.prefix_length()));
|
371
|
-
Add(
|
295
|
+
Add(emit.data());
|
372
296
|
}
|
373
297
|
|
374
|
-
void HPackCompressor::Framer::
|
375
|
-
|
298
|
+
void HPackCompressor::Framer::EmitLitHdrWithBinaryStringKeyIncIdx(
|
299
|
+
Slice key_slice, Slice value_slice) {
|
300
|
+
GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V();
|
376
301
|
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
|
377
|
-
StringKey key(
|
378
|
-
key.WritePrefix(
|
379
|
-
Add(
|
380
|
-
|
302
|
+
StringKey key(std::move(key_slice));
|
303
|
+
key.WritePrefix(0x40, AddTiny(key.prefix_length()));
|
304
|
+
Add(key.key());
|
305
|
+
BinaryStringValue emit(std::move(value_slice), use_true_binary_metadata_);
|
381
306
|
emit.WritePrefix(AddTiny(emit.prefix_length()));
|
382
307
|
Add(emit.data());
|
383
308
|
}
|
384
309
|
|
385
310
|
void HPackCompressor::Framer::EmitLitHdrWithBinaryStringKeyNotIdx(
|
386
|
-
|
387
|
-
|
311
|
+
uint32_t key_index, Slice value_slice) {
|
312
|
+
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX();
|
388
313
|
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
emit.WritePrefix(
|
314
|
+
BinaryStringValue emit(std::move(value_slice), use_true_binary_metadata_);
|
315
|
+
VarintWriter<4> key(key_index);
|
316
|
+
uint8_t* data = AddTiny(key.length() + emit.prefix_length());
|
317
|
+
key.Write(0x00, data);
|
318
|
+
emit.WritePrefix(data + key.length());
|
394
319
|
Add(emit.data());
|
395
320
|
}
|
396
321
|
|
397
322
|
void HPackCompressor::Framer::EmitLitHdrWithNonBinaryStringKeyNotIdx(
|
398
|
-
|
323
|
+
Slice key_slice, Slice value_slice) {
|
399
324
|
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
|
400
325
|
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
|
401
|
-
StringKey key(key_slice);
|
326
|
+
StringKey key(std::move(key_slice));
|
402
327
|
key.WritePrefix(0x00, AddTiny(key.prefix_length()));
|
403
|
-
Add(
|
404
|
-
NonBinaryStringValue emit(value_slice);
|
328
|
+
Add(key.key());
|
329
|
+
NonBinaryStringValue emit(std::move(value_slice));
|
405
330
|
emit.WritePrefix(AddTiny(emit.prefix_length()));
|
406
|
-
Add(
|
331
|
+
Add(emit.data());
|
407
332
|
}
|
408
333
|
|
409
334
|
void HPackCompressor::Framer::AdvertiseTableSizeChange() {
|
@@ -411,159 +336,308 @@ void HPackCompressor::Framer::AdvertiseTableSizeChange() {
|
|
411
336
|
w.Write(0x20, AddTiny(w.length()));
|
412
337
|
}
|
413
338
|
|
414
|
-
void HPackCompressor::
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
"Encode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
|
425
|
-
k, v, GRPC_MDELEM_IS_INTERNED(elem), GRPC_MDELEM_STORAGE(elem),
|
426
|
-
grpc_slice_is_interned(GRPC_MDKEY(elem)),
|
427
|
-
grpc_slice_is_interned(GRPC_MDVALUE(elem)));
|
428
|
-
gpr_free(k);
|
429
|
-
gpr_free(v);
|
430
|
-
}
|
431
|
-
|
432
|
-
struct EmitIndexedStatus {
|
433
|
-
EmitIndexedStatus() = default;
|
434
|
-
EmitIndexedStatus(uint32_t elem_hash, bool emitted, bool can_add)
|
435
|
-
: elem_hash(elem_hash), emitted(emitted), can_add(can_add) {}
|
436
|
-
const uint32_t elem_hash = 0;
|
437
|
-
const bool emitted = false;
|
438
|
-
const bool can_add = false;
|
439
|
-
};
|
440
|
-
|
441
|
-
/* encode an mdelem */
|
442
|
-
void HPackCompressor::Framer::EncodeDynamic(grpc_mdelem elem) {
|
443
|
-
const grpc_slice& elem_key = GRPC_MDKEY(elem);
|
444
|
-
// User-provided key len validated in grpc_validate_header_key_is_legal().
|
445
|
-
GPR_DEBUG_ASSERT(GRPC_SLICE_LENGTH(elem_key) > 0);
|
446
|
-
// Header ordering: all reserved headers (prefixed with ':') must precede
|
447
|
-
// regular headers. This can be a debug assert, since:
|
448
|
-
// 1) User cannot give us ':' headers (grpc_validate_header_key_is_legal()).
|
449
|
-
// 2) grpc filters/core should be checked during debug builds. */
|
450
|
-
#ifndef NDEBUG
|
451
|
-
if (GRPC_SLICE_START_PTR(elem_key)[0] != ':') { /* regular header */
|
452
|
-
seen_regular_header_ = true;
|
453
|
-
} else {
|
454
|
-
GPR_DEBUG_ASSERT(
|
455
|
-
!seen_regular_header_ &&
|
456
|
-
"Reserved header (colon-prefixed) happening after regular ones.");
|
457
|
-
}
|
458
|
-
#endif
|
459
|
-
if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
|
460
|
-
Log(elem);
|
461
|
-
}
|
462
|
-
const bool elem_interned = GRPC_MDELEM_IS_INTERNED(elem);
|
463
|
-
const bool key_interned = elem_interned || grpc_slice_is_interned(elem_key);
|
464
|
-
// Key is not interned, emit literals.
|
465
|
-
if (!key_interned) {
|
466
|
-
EmitLitHdrWithStringKeyNotIdx(elem);
|
339
|
+
void HPackCompressor::SliceIndex::EmitTo(absl::string_view key,
|
340
|
+
const Slice& value, Framer* framer) {
|
341
|
+
auto& table = framer->compressor_->table_;
|
342
|
+
using It = std::vector<ValueIndex>::iterator;
|
343
|
+
It prev = values_.end();
|
344
|
+
uint32_t transport_length =
|
345
|
+
key.length() + value.length() + hpack_constants::kEntryOverhead;
|
346
|
+
if (transport_length > HPackEncoderTable::MaxEntrySize()) {
|
347
|
+
framer->EmitLitHdrWithNonBinaryStringKeyNotIdx(Slice::FromStaticString(key),
|
348
|
+
value.Ref());
|
467
349
|
return;
|
468
350
|
}
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
351
|
+
// Linear scan through previous values to see if we find the value.
|
352
|
+
for (It it = values_.begin(); it != values_.end(); ++it) {
|
353
|
+
if (value == it->value) {
|
354
|
+
// Got a hit... is it still in the decode table?
|
355
|
+
if (table.ConvertableToDynamicIndex(it->index)) {
|
356
|
+
// Yes, emit the index and proceed to cleanup.
|
357
|
+
framer->EmitIndexed(table.DynamicIndex(it->index));
|
358
|
+
} else {
|
359
|
+
// Not current, emit a new literal and update the index.
|
360
|
+
it->index = table.AllocateIndex(transport_length);
|
361
|
+
framer->EmitLitHdrWithNonBinaryStringKeyIncIdx(
|
362
|
+
Slice::FromStaticString(key), value.Ref());
|
363
|
+
}
|
364
|
+
// Bubble this entry up if we can - ensures that the most used values end
|
365
|
+
// up towards the start of the array.
|
366
|
+
if (prev != values_.end()) std::swap(*prev, *it);
|
367
|
+
// If there are entries at the end of the array, and those entries are no
|
368
|
+
// longer in the table, remove them.
|
369
|
+
while (!values_.empty() &&
|
370
|
+
!table.ConvertableToDynamicIndex(values_.back().index)) {
|
371
|
+
values_.pop_back();
|
372
|
+
}
|
373
|
+
// All done, early out.
|
486
374
|
return;
|
487
375
|
}
|
488
|
-
|
489
|
-
if (!can_add_to_hashtable) elem_hash = 0;
|
490
|
-
}
|
491
|
-
|
492
|
-
/* should this elem be in the table? */
|
493
|
-
const size_t decoder_space_usage =
|
494
|
-
MetadataSizeInHPackTable(elem, use_true_binary_metadata_);
|
495
|
-
const bool decoder_space_available =
|
496
|
-
decoder_space_usage < kMaxDecoderSpaceUsage;
|
497
|
-
const bool should_add_elem =
|
498
|
-
elem_interned && decoder_space_available && elem_hash != 0;
|
499
|
-
/* no hits for the elem... maybe there's a key? */
|
500
|
-
const uint32_t key_hash = elem_key.refcount->Hash(elem_key);
|
501
|
-
auto indices_key =
|
502
|
-
compressor_->key_index_.Lookup(KeySliceRef(elem_key.refcount, key_hash));
|
503
|
-
if (indices_key.has_value() &&
|
504
|
-
compressor_->table_.ConvertableToDynamicIndex(*indices_key)) {
|
505
|
-
if (should_add_elem) {
|
506
|
-
EmitLitHdrIncIdx(compressor_->table_.DynamicIndex(*indices_key), elem);
|
507
|
-
compressor_->AddElem(elem, decoder_space_usage, elem_hash, key_hash);
|
508
|
-
} else {
|
509
|
-
EmitLitHdrNotIdx(compressor_->table_.DynamicIndex(*indices_key), elem);
|
510
|
-
}
|
511
|
-
return;
|
376
|
+
prev = it;
|
512
377
|
}
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
378
|
+
// No hit, emit a new literal and add it to the index.
|
379
|
+
uint32_t index = table.AllocateIndex(transport_length);
|
380
|
+
framer->EmitLitHdrWithNonBinaryStringKeyIncIdx(Slice::FromStaticString(key),
|
381
|
+
value.Ref());
|
382
|
+
values_.emplace_back(value.Ref(), index);
|
383
|
+
}
|
384
|
+
|
385
|
+
void HPackCompressor::Framer::Encode(const Slice& key, const Slice& value) {
|
386
|
+
if (absl::EndsWith(key.as_string_view(), "-bin")) {
|
387
|
+
EmitLitHdrWithBinaryStringKeyNotIdx(key.Ref(), value.Ref());
|
517
388
|
} else {
|
518
|
-
|
519
|
-
}
|
520
|
-
if (should_add_elem) {
|
521
|
-
compressor_->AddElem(elem, decoder_space_usage, elem_hash, key_hash);
|
522
|
-
} else if (should_add_key) {
|
523
|
-
compressor_->AddKey(elem, decoder_space_usage, key_hash);
|
389
|
+
EmitLitHdrWithNonBinaryStringKeyNotIdx(key.Ref(), value.Ref());
|
524
390
|
}
|
525
391
|
}
|
526
392
|
|
393
|
+
void HPackCompressor::Framer::Encode(HttpPathMetadata, const Slice& value) {
|
394
|
+
compressor_->path_index_.EmitTo(HttpPathMetadata::key(), value, this);
|
395
|
+
}
|
396
|
+
|
397
|
+
void HPackCompressor::Framer::Encode(HttpAuthorityMetadata,
|
398
|
+
const Slice& value) {
|
399
|
+
compressor_->authority_index_.EmitTo(HttpAuthorityMetadata::key(), value,
|
400
|
+
this);
|
401
|
+
}
|
402
|
+
|
527
403
|
void HPackCompressor::Framer::Encode(TeMetadata, TeMetadata::ValueType value) {
|
528
404
|
GPR_ASSERT(value == TeMetadata::ValueType::kTrailers);
|
529
405
|
EncodeAlwaysIndexed(
|
530
|
-
&compressor_->te_index_,
|
406
|
+
&compressor_->te_index_, "te", Slice::FromStaticString("trailers"),
|
531
407
|
2 /* te */ + 8 /* trailers */ + hpack_constants::kEntryOverhead);
|
532
408
|
}
|
533
409
|
|
410
|
+
void HPackCompressor::Framer::Encode(ContentTypeMetadata,
|
411
|
+
ContentTypeMetadata::ValueType value) {
|
412
|
+
if (value != ContentTypeMetadata::ValueType::kApplicationGrpc) {
|
413
|
+
gpr_log(GPR_ERROR, "Not encoding bad content-type header");
|
414
|
+
return;
|
415
|
+
}
|
416
|
+
EncodeAlwaysIndexed(&compressor_->content_type_index_, "content-type",
|
417
|
+
Slice::FromStaticString("application/grpc"),
|
418
|
+
12 /* content-type */ + 16 /* application/grpc */ +
|
419
|
+
hpack_constants::kEntryOverhead);
|
420
|
+
}
|
421
|
+
|
422
|
+
void HPackCompressor::Framer::Encode(HttpSchemeMetadata,
|
423
|
+
HttpSchemeMetadata::ValueType value) {
|
424
|
+
switch (value) {
|
425
|
+
case HttpSchemeMetadata::ValueType::kHttp:
|
426
|
+
EmitIndexed(6); // :scheme: http
|
427
|
+
break;
|
428
|
+
case HttpSchemeMetadata::ValueType::kHttps:
|
429
|
+
EmitIndexed(7); // :scheme: https
|
430
|
+
break;
|
431
|
+
case HttpSchemeMetadata::ValueType::kInvalid:
|
432
|
+
GPR_ASSERT(false);
|
433
|
+
break;
|
434
|
+
}
|
435
|
+
}
|
436
|
+
|
437
|
+
void HPackCompressor::Framer::Encode(GrpcTraceBinMetadata, const Slice& slice) {
|
438
|
+
EncodeIndexedKeyWithBinaryValue(&compressor_->grpc_trace_bin_index_,
|
439
|
+
"grpc-trace-bin", slice.Ref());
|
440
|
+
}
|
441
|
+
|
442
|
+
void HPackCompressor::Framer::Encode(GrpcTagsBinMetadata, const Slice& slice) {
|
443
|
+
EncodeIndexedKeyWithBinaryValue(&compressor_->grpc_tags_bin_index_,
|
444
|
+
"grpc-tags-bin", slice.Ref());
|
445
|
+
}
|
446
|
+
|
447
|
+
void HPackCompressor::Framer::Encode(HttpStatusMetadata, uint32_t status) {
|
448
|
+
if (status == 200) {
|
449
|
+
EmitIndexed(8); // :status: 200
|
450
|
+
return;
|
451
|
+
}
|
452
|
+
uint8_t index = 0;
|
453
|
+
switch (status) {
|
454
|
+
case 204:
|
455
|
+
index = 9; // :status: 204
|
456
|
+
break;
|
457
|
+
case 206:
|
458
|
+
index = 10; // :status: 206
|
459
|
+
break;
|
460
|
+
case 304:
|
461
|
+
index = 11; // :status: 304
|
462
|
+
break;
|
463
|
+
case 400:
|
464
|
+
index = 12; // :status: 400
|
465
|
+
break;
|
466
|
+
case 404:
|
467
|
+
index = 13; // :status: 404
|
468
|
+
break;
|
469
|
+
case 500:
|
470
|
+
index = 14; // :status: 500
|
471
|
+
break;
|
472
|
+
}
|
473
|
+
if (GPR_LIKELY(index != 0)) {
|
474
|
+
EmitIndexed(index);
|
475
|
+
} else {
|
476
|
+
EmitLitHdrWithNonBinaryStringKeyIncIdx(Slice::FromStaticString(":status"),
|
477
|
+
Slice::FromInt64(status));
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
void HPackCompressor::Framer::Encode(HttpMethodMetadata,
|
482
|
+
HttpMethodMetadata::ValueType method) {
|
483
|
+
switch (method) {
|
484
|
+
case HttpMethodMetadata::ValueType::kGet:
|
485
|
+
EmitIndexed(2); // :method: GET
|
486
|
+
break;
|
487
|
+
case HttpMethodMetadata::ValueType::kPost:
|
488
|
+
EmitIndexed(3); // :method: POST
|
489
|
+
break;
|
490
|
+
case HttpMethodMetadata::ValueType::kPut:
|
491
|
+
EmitLitHdrWithNonBinaryStringKeyNotIdx(Slice::FromStaticString(":method"),
|
492
|
+
Slice::FromStaticString("PUT"));
|
493
|
+
break;
|
494
|
+
case HttpMethodMetadata::ValueType::kInvalid:
|
495
|
+
GPR_ASSERT(false);
|
496
|
+
break;
|
497
|
+
}
|
498
|
+
}
|
499
|
+
|
534
500
|
void HPackCompressor::Framer::EncodeAlwaysIndexed(uint32_t* index,
|
535
|
-
|
536
|
-
|
501
|
+
absl::string_view key,
|
502
|
+
Slice value,
|
537
503
|
uint32_t transport_length) {
|
538
504
|
if (compressor_->table_.ConvertableToDynamicIndex(*index)) {
|
539
505
|
EmitIndexed(compressor_->table_.DynamicIndex(*index));
|
540
506
|
} else {
|
541
507
|
*index = compressor_->table_.AllocateIndex(transport_length);
|
542
|
-
EmitLitHdrWithNonBinaryStringKeyIncIdx(key,
|
508
|
+
EmitLitHdrWithNonBinaryStringKeyIncIdx(Slice::FromStaticString(key),
|
509
|
+
std::move(value));
|
510
|
+
}
|
511
|
+
}
|
512
|
+
|
513
|
+
void HPackCompressor::Framer::EncodeIndexedKeyWithBinaryValue(
|
514
|
+
uint32_t* index, absl::string_view key, Slice value) {
|
515
|
+
if (compressor_->table_.ConvertableToDynamicIndex(*index)) {
|
516
|
+
EmitLitHdrWithBinaryStringKeyNotIdx(
|
517
|
+
compressor_->table_.DynamicIndex(*index), std::move(value));
|
518
|
+
} else {
|
519
|
+
*index = compressor_->table_.AllocateIndex(key.length() + value.length() +
|
520
|
+
hpack_constants::kEntryOverhead);
|
521
|
+
EmitLitHdrWithBinaryStringKeyIncIdx(Slice::FromStaticString(key),
|
522
|
+
std::move(value));
|
543
523
|
}
|
544
524
|
}
|
545
525
|
|
546
526
|
void HPackCompressor::Framer::Encode(GrpcTimeoutMetadata,
|
547
527
|
grpc_millis deadline) {
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
528
|
+
Timeout timeout = Timeout::FromDuration(deadline - ExecCtx::Get()->Now());
|
529
|
+
for (auto it = compressor_->previous_timeouts_.begin();
|
530
|
+
it != compressor_->previous_timeouts_.end(); ++it) {
|
531
|
+
double ratio = timeout.RatioVersus(it->timeout);
|
532
|
+
// If the timeout we're sending is shorter than a previous timeout, but
|
533
|
+
// within 3% of it, we'll consider sending it.
|
534
|
+
if (ratio > -3 && ratio <= 0 &&
|
535
|
+
compressor_->table_.ConvertableToDynamicIndex(it->index)) {
|
536
|
+
EmitIndexed(compressor_->table_.DynamicIndex(it->index));
|
537
|
+
// Put this timeout to the front of the queue - forces common timeouts to
|
538
|
+
// be considered earlier.
|
539
|
+
std::swap(*it, *compressor_->previous_timeouts_.begin());
|
540
|
+
return;
|
541
|
+
}
|
542
|
+
}
|
543
|
+
// Clean out some expired timeouts.
|
544
|
+
while (!compressor_->previous_timeouts_.empty() &&
|
545
|
+
!compressor_->table_.ConvertableToDynamicIndex(
|
546
|
+
compressor_->previous_timeouts_.back().index)) {
|
547
|
+
compressor_->previous_timeouts_.pop_back();
|
548
|
+
}
|
549
|
+
Slice encoded = timeout.Encode();
|
550
|
+
uint32_t index = compressor_->table_.AllocateIndex(
|
551
|
+
GrpcTimeoutMetadata::key().length() + encoded.length() +
|
552
|
+
hpack_constants::kEntryOverhead);
|
553
|
+
compressor_->previous_timeouts_.push_back(PreviousTimeout{timeout, index});
|
554
|
+
EmitLitHdrWithNonBinaryStringKeyIncIdx(
|
555
|
+
Slice::FromStaticString(GrpcTimeoutMetadata::key()), std::move(encoded));
|
555
556
|
}
|
556
557
|
|
557
558
|
void HPackCompressor::Framer::Encode(UserAgentMetadata, const Slice& slice) {
|
559
|
+
if (slice.length() > HPackEncoderTable::MaxEntrySize()) {
|
560
|
+
EmitLitHdrWithNonBinaryStringKeyNotIdx(
|
561
|
+
Slice::FromStaticString(UserAgentMetadata::key()), slice.Ref());
|
562
|
+
return;
|
563
|
+
}
|
558
564
|
if (!slice.is_equivalent(compressor_->user_agent_)) {
|
559
565
|
compressor_->user_agent_ = slice.Ref();
|
560
566
|
compressor_->user_agent_index_ = 0;
|
561
567
|
}
|
562
568
|
EncodeAlwaysIndexed(
|
563
|
-
&compressor_->user_agent_index_,
|
569
|
+
&compressor_->user_agent_index_, "user-agent", slice.Ref(),
|
564
570
|
10 /* user-agent */ + slice.size() + hpack_constants::kEntryOverhead);
|
565
571
|
}
|
566
572
|
|
573
|
+
void HPackCompressor::Framer::Encode(GrpcStatusMetadata,
|
574
|
+
grpc_status_code status) {
|
575
|
+
const uint32_t code = static_cast<uint32_t>(status);
|
576
|
+
uint32_t* index = nullptr;
|
577
|
+
if (code < kNumCachedGrpcStatusValues) {
|
578
|
+
index = &compressor_->cached_grpc_status_[code];
|
579
|
+
if (compressor_->table_.ConvertableToDynamicIndex(*index)) {
|
580
|
+
EmitIndexed(compressor_->table_.DynamicIndex(*index));
|
581
|
+
return;
|
582
|
+
}
|
583
|
+
}
|
584
|
+
Slice key = Slice::FromStaticString(GrpcStatusMetadata::key());
|
585
|
+
Slice value = Slice::FromInt64(code);
|
586
|
+
const uint32_t transport_length =
|
587
|
+
key.length() + value.length() + hpack_constants::kEntryOverhead;
|
588
|
+
if (index != nullptr) {
|
589
|
+
*index = compressor_->table_.AllocateIndex(transport_length);
|
590
|
+
EmitLitHdrWithNonBinaryStringKeyIncIdx(std::move(key), std::move(value));
|
591
|
+
} else {
|
592
|
+
EmitLitHdrWithNonBinaryStringKeyNotIdx(std::move(key), std::move(value));
|
593
|
+
}
|
594
|
+
}
|
595
|
+
|
596
|
+
void HPackCompressor::Framer::Encode(GrpcEncodingMetadata,
|
597
|
+
grpc_compression_algorithm value) {
|
598
|
+
uint32_t* index = nullptr;
|
599
|
+
if (value < GRPC_COMPRESS_ALGORITHMS_COUNT) {
|
600
|
+
index = &compressor_->cached_grpc_encoding_[static_cast<uint32_t>(value)];
|
601
|
+
if (compressor_->table_.ConvertableToDynamicIndex(*index)) {
|
602
|
+
EmitIndexed(compressor_->table_.DynamicIndex(*index));
|
603
|
+
return;
|
604
|
+
}
|
605
|
+
}
|
606
|
+
auto key = Slice::FromStaticString(GrpcEncodingMetadata::key());
|
607
|
+
auto encoded_value = GrpcEncodingMetadata::Encode(value);
|
608
|
+
uint32_t transport_length =
|
609
|
+
key.length() + encoded_value.length() + hpack_constants::kEntryOverhead;
|
610
|
+
if (index != nullptr) {
|
611
|
+
*index = compressor_->table_.AllocateIndex(transport_length);
|
612
|
+
EmitLitHdrWithNonBinaryStringKeyIncIdx(std::move(key),
|
613
|
+
std::move(encoded_value));
|
614
|
+
} else {
|
615
|
+
EmitLitHdrWithNonBinaryStringKeyNotIdx(std::move(key),
|
616
|
+
std::move(encoded_value));
|
617
|
+
}
|
618
|
+
}
|
619
|
+
|
620
|
+
void HPackCompressor::Framer::Encode(GrpcAcceptEncodingMetadata,
|
621
|
+
CompressionAlgorithmSet value) {
|
622
|
+
if (compressor_->grpc_accept_encoding_index_ != 0 &&
|
623
|
+
value == compressor_->grpc_accept_encoding_ &&
|
624
|
+
compressor_->table_.ConvertableToDynamicIndex(
|
625
|
+
compressor_->grpc_accept_encoding_index_)) {
|
626
|
+
EmitIndexed(compressor_->table_.DynamicIndex(
|
627
|
+
compressor_->grpc_accept_encoding_index_));
|
628
|
+
return;
|
629
|
+
}
|
630
|
+
auto key = Slice::FromStaticString(GrpcAcceptEncodingMetadata::key());
|
631
|
+
auto encoded_value = GrpcAcceptEncodingMetadata::Encode(value);
|
632
|
+
uint32_t transport_length =
|
633
|
+
key.length() + encoded_value.length() + hpack_constants::kEntryOverhead;
|
634
|
+
compressor_->grpc_accept_encoding_index_ =
|
635
|
+
compressor_->table_.AllocateIndex(transport_length);
|
636
|
+
compressor_->grpc_accept_encoding_ = value;
|
637
|
+
EmitLitHdrWithNonBinaryStringKeyIncIdx(std::move(key),
|
638
|
+
std::move(encoded_value));
|
639
|
+
}
|
640
|
+
|
567
641
|
void HPackCompressor::SetMaxUsableSize(uint32_t max_table_size) {
|
568
642
|
max_usable_size_ = max_table_size;
|
569
643
|
SetMaxTableSize(std::min(table_.max_size(), max_table_size));
|
@@ -595,16 +669,4 @@ HPackCompressor::Framer::Framer(const EncodeHeaderOptions& options,
|
|
595
669
|
}
|
596
670
|
}
|
597
671
|
|
598
|
-
void HPackCompressor::Framer::Encode(grpc_mdelem md) {
|
599
|
-
if (GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC) {
|
600
|
-
const uintptr_t static_index =
|
601
|
-
reinterpret_cast<StaticMetadata*>(GRPC_MDELEM_DATA(md))->StaticIndex();
|
602
|
-
if (static_index < hpack_constants::kLastStaticEntry) {
|
603
|
-
EmitIndexed(static_cast<uint32_t>(static_index + 1));
|
604
|
-
return;
|
605
|
-
}
|
606
|
-
}
|
607
|
-
EncodeDynamic(md);
|
608
|
-
}
|
609
|
-
|
610
672
|
} // namespace grpc_core
|