grpc 1.2.5 → 1.3.4
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 +1434 -399
- data/etc/roots.pem +34 -150
- data/include/grpc/grpc.h +71 -0
- data/include/grpc/impl/codegen/atm.h +5 -0
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +6 -0
- data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
- data/include/grpc/impl/codegen/atm_windows.h +11 -0
- data/include/grpc/impl/codegen/grpc_types.h +54 -13
- data/include/grpc/impl/codegen/port_platform.h +15 -1
- data/include/grpc/support/alloc.h +2 -1
- data/include/grpc/support/sync.h +4 -0
- data/include/grpc/support/tls.h +1 -1
- data/src/core/ext/census/gen/trace_context.pb.h +1 -1
- data/src/core/ext/census/grpc_filter.c +14 -10
- data/src/core/ext/census/grpc_plugin.c +3 -1
- data/src/core/ext/census/trace_label.h +1 -1
- data/src/core/ext/census/trace_propagation.h +1 -1
- data/src/core/ext/census/trace_status.h +1 -1
- data/src/core/ext/census/trace_string.h +1 -1
- data/src/core/ext/census/tracing.h +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/channel_connectivity.c +56 -27
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel.c +407 -202
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel.h +10 -6
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_factory.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/client_channel_plugin.c +12 -7
- data/src/core/ext/{client_channel → filters/client_channel}/connector.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/connector.h +3 -5
- data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.c +6 -6
- data/src/core/ext/{client_channel → filters/client_channel}/http_connect_handshaker.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.c +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/http_proxy.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy.h +4 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.c +22 -20
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb.h +4 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel.h +5 -4
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/grpclb_channel_secure.c +2 -2
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.c +1 -1
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/load_balancer_api.h +6 -5
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +1 -1
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -0
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/pick_first/pick_first.c +20 -15
- data/src/core/ext/{lb_policy → filters/client_channel/lb_policy}/round_robin/round_robin.c +21 -16
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_factory.h +5 -5
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/lb_policy_registry.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/parse_address.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/parse_address.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper.h +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.c +10 -4
- data/src/core/ext/{client_channel → filters/client_channel}/proxy_mapper_registry.h +4 -4
- data/src/core/ext/{client_channel → filters/client_channel}/resolver.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/resolver.h +4 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
- data/src/core/ext/{resolver → filters/client_channel/resolver}/dns/native/dns_resolver.c +21 -5
- data/src/core/ext/{resolver → filters/client_channel/resolver}/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_factory.h +6 -6
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.c +1 -2
- data/src/core/ext/{client_channel → filters/client_channel}/resolver_registry.h +4 -4
- data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
- data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel.c +49 -43
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel.h +21 -7
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/subchannel_index.h +5 -5
- data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.c +1 -1
- data/src/core/ext/{client_channel → filters/client_channel}/uri_parser.h +3 -3
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.c +4 -2
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting.h +3 -3
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.c +17 -14
- data/src/core/ext/{load_reporting → filters/load_reporting}/load_reporting_filter.h +4 -4
- data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
- data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
- data/src/core/ext/transport/chttp2/client/chttp2_connector.c +6 -41
- data/src/core/ext/transport/chttp2/client/chttp2_connector.h +1 -1
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +2 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +3 -3
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +2 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +2 -5
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +2 -2
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +449 -204
- data/src/core/ext/transport/chttp2/transport/frame_data.c +10 -7
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +37 -7
- data/src/core/ext/transport/chttp2/transport/frame_ping.h +3 -0
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +4 -3
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +18 -38
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -29
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +2 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +64 -37
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +11 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +60 -39
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +2 -2
- data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +22 -43
- data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +8 -10
- data/src/core/ext/transport/chttp2/transport/internal.h +24 -2
- data/src/core/ext/transport/chttp2/transport/parsing.c +33 -15
- data/src/core/ext/transport/chttp2/transport/writing.c +56 -10
- data/src/core/lib/channel/channel_args.c +7 -0
- data/src/core/lib/channel/channel_args.h +2 -0
- data/src/core/lib/channel/channel_stack.c +20 -27
- data/src/core/lib/channel/channel_stack.h +18 -16
- data/src/core/lib/channel/compress_filter.c +20 -18
- data/src/core/lib/channel/connected_channel.c +9 -8
- data/src/core/lib/channel/deadline_filter.c +28 -24
- data/src/core/lib/channel/deadline_filter.h +3 -3
- data/src/core/lib/channel/handshaker.c +3 -2
- data/src/core/lib/channel/http_client_filter.c +119 -61
- data/src/core/lib/channel/http_server_filter.c +124 -69
- data/src/core/lib/channel/message_size_filter.c +23 -19
- data/src/core/lib/http/httpcli.c +8 -6
- data/src/core/lib/http/httpcli_security_connector.c +5 -5
- data/src/core/lib/http/parser.c +57 -31
- data/src/core/lib/iomgr/closure.c +15 -0
- data/src/core/lib/iomgr/closure.h +4 -0
- data/src/core/lib/iomgr/combiner.c +8 -0
- data/src/core/lib/iomgr/endpoint_pair.h +2 -3
- data/src/core/lib/iomgr/endpoint_pair_posix.c +10 -7
- data/src/core/lib/iomgr/endpoint_pair_uv.c +2 -3
- data/src/core/lib/iomgr/endpoint_pair_windows.c +9 -6
- data/src/core/lib/iomgr/error.c +360 -177
- data/src/core/lib/iomgr/error.h +31 -33
- data/src/core/lib/iomgr/error_internal.h +30 -9
- data/src/core/lib/iomgr/ev_epoll_linux.c +25 -239
- data/src/core/lib/iomgr/ev_poll_posix.c +11 -7
- data/src/core/lib/iomgr/ev_posix.c +6 -0
- data/src/core/lib/iomgr/ev_posix.h +3 -0
- data/src/core/lib/iomgr/exec_ctx.c +6 -0
- data/src/core/lib/iomgr/executor.c +8 -2
- data/src/core/lib/iomgr/load_file.c +6 -3
- data/src/core/lib/iomgr/lockfree_event.c +238 -0
- data/src/core/{ext/client_channel/initial_connect_string.h → lib/iomgr/lockfree_event.h} +17 -13
- data/src/core/lib/iomgr/pollset.h +4 -0
- data/src/core/lib/iomgr/pollset_windows.c +2 -2
- data/src/core/lib/iomgr/port.h +9 -0
- data/src/core/lib/iomgr/resolve_address_posix.c +15 -9
- data/src/core/lib/iomgr/resolve_address_uv.c +8 -6
- data/src/core/lib/iomgr/resolve_address_windows.c +2 -2
- data/src/core/lib/iomgr/resource_quota.c +19 -4
- data/src/core/lib/iomgr/resource_quota.h +2 -0
- data/src/core/lib/iomgr/sockaddr_utils.c +3 -1
- data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
- data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.c +25 -9
- data/src/core/lib/iomgr/socket_utils_posix.h +7 -0
- data/src/core/lib/iomgr/tcp_client.h +0 -4
- data/src/core/lib/iomgr/tcp_client_posix.c +15 -31
- data/src/core/lib/iomgr/tcp_client_uv.c +10 -6
- data/src/core/lib/iomgr/tcp_client_windows.c +9 -19
- data/src/core/lib/iomgr/tcp_posix.c +111 -22
- data/src/core/lib/iomgr/tcp_posix.h +3 -4
- data/src/core/lib/iomgr/tcp_server_posix.c +39 -417
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
- data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
- data/src/core/lib/iomgr/tcp_server_uv.c +43 -16
- data/src/core/lib/iomgr/tcp_server_windows.c +10 -22
- data/src/core/lib/iomgr/tcp_uv.c +16 -13
- data/src/core/lib/iomgr/tcp_windows.c +24 -12
- data/src/core/lib/iomgr/tcp_windows.h +2 -2
- data/src/core/lib/iomgr/timer.h +3 -0
- data/src/core/lib/iomgr/timer_generic.c +257 -72
- data/src/core/lib/iomgr/timer_generic.h +1 -1
- data/src/core/lib/iomgr/timer_heap.c +8 -8
- data/src/core/lib/iomgr/udp_server.c +54 -24
- data/src/core/lib/iomgr/udp_server.h +7 -7
- data/src/core/lib/iomgr/unix_sockets_posix.c +1 -1
- data/src/core/lib/iomgr/unix_sockets_posix_noop.c +2 -1
- data/src/core/lib/iomgr/wakeup_fd_posix.h +1 -1
- data/src/core/lib/profiling/basic_timers.c +1 -1
- data/src/core/lib/security/credentials/credentials.h +1 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +10 -9
- data/src/core/lib/security/credentials/jwt/json_token.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.c +2 -2
- data/src/core/lib/security/transport/client_auth_filter.c +33 -26
- data/src/core/lib/security/transport/secure_endpoint.c +8 -5
- data/src/core/lib/security/transport/security_connector.c +37 -37
- data/src/core/lib/security/transport/security_connector.h +1 -1
- data/src/core/lib/security/transport/security_handshaker.c +15 -12
- data/src/core/lib/security/transport/server_auth_filter.c +20 -18
- data/src/core/lib/security/transport/tsi_error.c +5 -3
- data/src/core/lib/security/transport/tsi_error.h +1 -1
- data/src/core/lib/{security/util → slice}/b64.c +21 -6
- data/src/core/lib/{security/util → slice}/b64.h +16 -4
- data/src/core/lib/slice/slice.c +4 -2
- data/src/core/lib/slice/slice_buffer.c +16 -14
- data/src/core/lib/support/arena.c +98 -0
- data/src/core/{ext/client_channel/initial_connect_string.c → lib/support/arena.h} +17 -15
- data/src/core/{ext/client_channel/default_initial_connect_string.c → lib/support/atm.c} +14 -5
- data/src/core/lib/support/cpu_linux.c +5 -0
- data/src/core/lib/support/sync.c +4 -0
- data/src/core/lib/support/time.c +4 -10
- data/src/core/lib/support/wrap_memcpy.c +3 -1
- data/src/core/lib/surface/call.c +252 -221
- data/src/core/lib/surface/channel.c +72 -21
- data/src/core/lib/surface/channel.h +8 -0
- data/src/core/lib/surface/completion_queue.c +2 -3
- data/src/core/lib/surface/completion_queue_factory.c +77 -0
- data/src/core/lib/surface/completion_queue_factory.h +51 -0
- data/src/core/lib/surface/init_secure.c +3 -1
- data/src/core/lib/surface/lame_client.c +18 -14
- data/src/core/lib/surface/server.c +43 -41
- data/src/core/lib/surface/validate_metadata.c +8 -4
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.h +1 -1
- data/src/core/lib/transport/connectivity_state.c +2 -1
- data/src/core/lib/transport/error_utils.c +17 -17
- data/src/core/lib/transport/error_utils.h +1 -1
- data/src/core/lib/transport/metadata_batch.c +6 -7
- data/src/core/lib/transport/pid_controller.c +1 -0
- data/src/core/lib/transport/service_config.c +12 -0
- data/src/core/lib/transport/service_config.h +6 -0
- data/src/core/lib/transport/transport.c +29 -17
- data/src/core/lib/transport/transport.h +85 -42
- data/src/core/lib/transport/transport_impl.h +5 -3
- data/src/core/lib/transport/transport_op_string.c +20 -14
- data/src/core/plugin_registry/grpc_plugin_registry.c +8 -0
- data/src/core/{lib/tsi → tsi}/fake_transport_security.c +2 -2
- data/src/core/{lib/tsi → tsi}/fake_transport_security.h +4 -4
- data/src/core/{lib/tsi → tsi}/ssl_transport_security.c +40 -79
- data/src/core/{lib/tsi → tsi}/ssl_transport_security.h +44 -21
- data/src/core/{lib/tsi → tsi}/ssl_types.h +3 -3
- data/src/core/{lib/tsi → tsi}/transport_security.c +2 -2
- data/src/core/{lib/tsi → tsi}/transport_security.h +4 -4
- data/src/core/{lib/tsi → tsi}/transport_security_interface.h +3 -3
- data/src/ruby/ext/grpc/extconf.rb +1 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +2 -2
- data/src/ruby/ext/grpc/rb_channel.c +520 -93
- data/src/ruby/ext/grpc/rb_channel.h +2 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +3 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +5 -2
- data/src/ruby/ext/grpc/rb_event_thread.c +6 -6
- data/src/ruby/ext/grpc/rb_grpc.c +29 -7
- data/src/ruby/ext/grpc/rb_grpc.h +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +10 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +15 -0
- data/src/ruby/ext/grpc/rb_server.c +5 -3
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_connection_spec.rb +173 -0
- data/src/ruby/spec/channel_spec.rb +29 -0
- data/src/ruby/spec/generic/rpc_server_pool_spec.rb +27 -17
- data/third_party/cares/ares_build.h +264 -0
- data/third_party/cares/cares/ares.h +636 -0
- data/third_party/cares/cares/ares__close_sockets.c +61 -0
- data/third_party/cares/cares/ares__get_hostent.c +261 -0
- data/third_party/cares/cares/ares__read_line.c +73 -0
- data/third_party/cares/cares/ares__timeval.c +111 -0
- data/third_party/cares/cares/ares_cancel.c +63 -0
- data/third_party/cares/cares/ares_create_query.c +202 -0
- data/third_party/cares/cares/ares_data.c +221 -0
- data/third_party/cares/cares/ares_data.h +72 -0
- data/third_party/cares/cares/ares_destroy.c +108 -0
- data/third_party/cares/cares/ares_dns.h +103 -0
- data/third_party/cares/cares/ares_expand_name.c +205 -0
- data/third_party/cares/cares/ares_expand_string.c +70 -0
- data/third_party/cares/cares/ares_fds.c +59 -0
- data/third_party/cares/cares/ares_free_hostent.c +41 -0
- data/third_party/cares/cares/ares_free_string.c +25 -0
- data/third_party/cares/cares/ares_getenv.c +30 -0
- data/third_party/cares/cares/ares_getenv.h +26 -0
- data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
- data/third_party/cares/cares/ares_gethostbyname.c +518 -0
- data/third_party/cares/cares/ares_getnameinfo.c +422 -0
- data/third_party/cares/cares/ares_getopt.c +122 -0
- data/third_party/cares/cares/ares_getopt.h +53 -0
- data/third_party/cares/cares/ares_getsock.c +66 -0
- data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
- data/third_party/cares/cares/ares_init.c +2146 -0
- data/third_party/cares/cares/ares_iphlpapi.h +221 -0
- data/third_party/cares/cares/ares_ipv6.h +78 -0
- data/third_party/cares/cares/ares_library_init.c +167 -0
- data/third_party/cares/cares/ares_library_init.h +42 -0
- data/third_party/cares/cares/ares_llist.c +63 -0
- data/third_party/cares/cares/ares_llist.h +39 -0
- data/third_party/cares/cares/ares_mkquery.c +24 -0
- data/third_party/cares/cares/ares_nowarn.c +260 -0
- data/third_party/cares/cares/ares_nowarn.h +61 -0
- data/third_party/cares/cares/ares_options.c +402 -0
- data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
- data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
- data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
- data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
- data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
- data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
- data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
- data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
- data/third_party/cares/cares/ares_platform.c +11035 -0
- data/third_party/cares/cares/ares_platform.h +43 -0
- data/third_party/cares/cares/ares_private.h +363 -0
- data/third_party/cares/cares/ares_process.c +1359 -0
- data/third_party/cares/cares/ares_query.c +186 -0
- data/third_party/cares/cares/ares_rules.h +125 -0
- data/third_party/cares/cares/ares_search.c +316 -0
- data/third_party/cares/cares/ares_send.c +131 -0
- data/third_party/cares/cares/ares_setup.h +217 -0
- data/third_party/cares/cares/ares_strcasecmp.c +66 -0
- data/third_party/cares/cares/ares_strcasecmp.h +30 -0
- data/third_party/cares/cares/ares_strdup.c +49 -0
- data/third_party/cares/cares/ares_strdup.h +24 -0
- data/third_party/cares/cares/ares_strerror.c +56 -0
- data/third_party/cares/cares/ares_timeout.c +88 -0
- data/third_party/cares/cares/ares_version.c +11 -0
- data/third_party/cares/cares/ares_version.h +24 -0
- data/third_party/cares/cares/ares_writev.c +79 -0
- data/third_party/cares/cares/bitncmp.c +59 -0
- data/third_party/cares/cares/bitncmp.h +26 -0
- data/third_party/cares/cares/config-win32.h +377 -0
- data/third_party/cares/cares/inet_net_pton.c +450 -0
- data/third_party/cares/cares/inet_ntop.c +208 -0
- data/third_party/cares/cares/setup_once.h +554 -0
- data/third_party/cares/cares/windows_port.c +22 -0
- data/third_party/cares/config_darwin/ares_config.h +523 -0
- data/third_party/cares/config_linux/ares_config.h +524 -0
- metadata +164 -68
@@ -54,7 +54,8 @@ void grpc_chttp2_data_parser_destroy(grpc_exec_ctx *exec_ctx,
|
|
54
54
|
grpc_chttp2_data_parser *parser) {
|
55
55
|
if (parser->parsing_frame != NULL) {
|
56
56
|
grpc_chttp2_incoming_byte_stream_finished(
|
57
|
-
exec_ctx, parser->parsing_frame,
|
57
|
+
exec_ctx, parser->parsing_frame,
|
58
|
+
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"));
|
58
59
|
}
|
59
60
|
GRPC_ERROR_UNREF(parser->error);
|
60
61
|
}
|
@@ -65,8 +66,9 @@ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser,
|
|
65
66
|
if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) {
|
66
67
|
char *msg;
|
67
68
|
gpr_asprintf(&msg, "unsupported data flags: 0x%02x", flags);
|
68
|
-
grpc_error *err =
|
69
|
-
|
69
|
+
grpc_error *err =
|
70
|
+
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg),
|
71
|
+
GRPC_ERROR_INT_STREAM_ID, (intptr_t)stream_id);
|
70
72
|
gpr_free(msg);
|
71
73
|
return err;
|
72
74
|
}
|
@@ -173,13 +175,13 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
|
|
173
175
|
break;
|
174
176
|
default:
|
175
177
|
gpr_asprintf(&msg, "Bad GRPC frame type 0x%02x", p->frame_type);
|
176
|
-
p->error =
|
178
|
+
p->error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
177
179
|
p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID,
|
178
180
|
(intptr_t)s->id);
|
179
181
|
gpr_free(msg);
|
180
182
|
msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
|
181
|
-
p->error =
|
182
|
-
|
183
|
+
p->error = grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES,
|
184
|
+
grpc_slice_from_copied_string(msg));
|
183
185
|
gpr_free(msg);
|
184
186
|
p->error =
|
185
187
|
grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg);
|
@@ -265,7 +267,8 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
|
|
265
267
|
}
|
266
268
|
}
|
267
269
|
|
268
|
-
GPR_UNREACHABLE_CODE(
|
270
|
+
GPR_UNREACHABLE_CODE(
|
271
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here"));
|
269
272
|
}
|
270
273
|
|
271
274
|
grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
|
@@ -54,7 +54,7 @@ grpc_error *grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser *p,
|
|
54
54
|
if (length < 8) {
|
55
55
|
char *msg;
|
56
56
|
gpr_asprintf(&msg, "goaway frame too short (%d bytes)", length);
|
57
|
-
grpc_error *err =
|
57
|
+
grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
58
58
|
gpr_free(msg);
|
59
59
|
return err;
|
60
60
|
}
|
@@ -156,7 +156,8 @@ grpc_error *grpc_chttp2_goaway_parser_parse(grpc_exec_ctx *exec_ctx,
|
|
156
156
|
}
|
157
157
|
return GRPC_ERROR_NONE;
|
158
158
|
}
|
159
|
-
GPR_UNREACHABLE_CODE(
|
159
|
+
GPR_UNREACHABLE_CODE(
|
160
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here"));
|
160
161
|
}
|
161
162
|
|
162
163
|
void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
|
@@ -40,6 +40,8 @@
|
|
40
40
|
#include <grpc/support/log.h>
|
41
41
|
#include <grpc/support/string_util.h>
|
42
42
|
|
43
|
+
static bool g_disable_ping_ack = false;
|
44
|
+
|
43
45
|
grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes) {
|
44
46
|
grpc_slice slice = grpc_slice_malloc(9 + 8);
|
45
47
|
uint8_t *p = GRPC_SLICE_START_PTR(slice);
|
@@ -71,7 +73,7 @@ grpc_error *grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser *parser,
|
|
71
73
|
if (flags & 0xfe || length != 8) {
|
72
74
|
char *msg;
|
73
75
|
gpr_asprintf(&msg, "invalid ping: length=%d, flags=%02x", length, flags);
|
74
|
-
grpc_error *error =
|
76
|
+
grpc_error *error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
75
77
|
gpr_free(msg);
|
76
78
|
return error;
|
77
79
|
}
|
@@ -101,15 +103,43 @@ grpc_error *grpc_chttp2_ping_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
|
|
101
103
|
if (p->is_ack) {
|
102
104
|
grpc_chttp2_ack_ping(exec_ctx, t, p->opaque_8bytes);
|
103
105
|
} else {
|
104
|
-
if (t->
|
105
|
-
|
106
|
-
|
107
|
-
t->
|
106
|
+
if (!t->is_client) {
|
107
|
+
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
|
108
|
+
gpr_timespec next_allowed_ping =
|
109
|
+
gpr_time_add(t->ping_recv_state.last_ping_recv_time,
|
110
|
+
t->ping_policy.min_ping_interval_without_data);
|
111
|
+
|
112
|
+
if (t->keepalive_permit_without_calls == 0 &&
|
113
|
+
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
|
114
|
+
/* According to RFC1122, the interval of TCP Keep-Alive is default to
|
115
|
+
no less than two hours. When there is no outstanding streams, we
|
116
|
+
restrict the number of PINGS equivalent to TCP Keep-Alive. */
|
117
|
+
next_allowed_ping =
|
118
|
+
gpr_time_add(t->ping_recv_state.last_ping_recv_time,
|
119
|
+
gpr_time_from_seconds(7200, GPR_TIMESPAN));
|
120
|
+
}
|
121
|
+
|
122
|
+
if (gpr_time_cmp(next_allowed_ping, now) > 0) {
|
123
|
+
grpc_chttp2_add_ping_strike(exec_ctx, t);
|
124
|
+
}
|
125
|
+
|
126
|
+
t->ping_recv_state.last_ping_recv_time = now;
|
127
|
+
}
|
128
|
+
if (!g_disable_ping_ack) {
|
129
|
+
if (t->ping_ack_count == t->ping_ack_capacity) {
|
130
|
+
t->ping_ack_capacity = GPR_MAX(t->ping_ack_capacity * 3 / 2, 3);
|
131
|
+
t->ping_acks = gpr_realloc(
|
132
|
+
t->ping_acks, t->ping_ack_capacity * sizeof(*t->ping_acks));
|
133
|
+
}
|
134
|
+
t->ping_acks[t->ping_ack_count++] = p->opaque_8bytes;
|
135
|
+
grpc_chttp2_initiate_write(exec_ctx, t, false, "ping response");
|
108
136
|
}
|
109
|
-
t->ping_acks[t->ping_ack_count++] = p->opaque_8bytes;
|
110
|
-
grpc_chttp2_initiate_write(exec_ctx, t, false, "ping response");
|
111
137
|
}
|
112
138
|
}
|
113
139
|
|
114
140
|
return GRPC_ERROR_NONE;
|
115
141
|
}
|
142
|
+
|
143
|
+
void grpc_set_disable_ping_ack(bool disable_ping_ack) {
|
144
|
+
g_disable_ping_ack = disable_ping_ack;
|
145
|
+
}
|
@@ -53,4 +53,7 @@ grpc_error *grpc_chttp2_ping_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
|
|
53
53
|
grpc_chttp2_stream *s,
|
54
54
|
grpc_slice slice, int is_last);
|
55
55
|
|
56
|
+
/* Test-only function for disabling ping ack */
|
57
|
+
void grpc_set_disable_ping_ack(bool disable_ping_ack);
|
58
|
+
|
56
59
|
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */
|
@@ -76,7 +76,7 @@ grpc_error *grpc_chttp2_rst_stream_parser_begin_frame(
|
|
76
76
|
char *msg;
|
77
77
|
gpr_asprintf(&msg, "invalid rst_stream: length=%d, flags=%02x", length,
|
78
78
|
flags);
|
79
|
-
grpc_error *err =
|
79
|
+
grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
80
80
|
gpr_free(msg);
|
81
81
|
return err;
|
82
82
|
}
|
@@ -112,8 +112,9 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx,
|
|
112
112
|
char *message;
|
113
113
|
gpr_asprintf(&message, "Received RST_STREAM with error code %d", reason);
|
114
114
|
error = grpc_error_set_int(
|
115
|
-
grpc_error_set_str(
|
116
|
-
GRPC_ERROR_STR_GRPC_MESSAGE,
|
115
|
+
grpc_error_set_str(GRPC_ERROR_CREATE_FROM_STATIC_STRING("RST_STREAM"),
|
116
|
+
GRPC_ERROR_STR_GRPC_MESSAGE,
|
117
|
+
grpc_slice_from_copied_string(message)),
|
117
118
|
GRPC_ERROR_INT_HTTP2_ERROR, (intptr_t)reason);
|
118
119
|
gpr_free(message);
|
119
120
|
}
|
@@ -46,29 +46,6 @@
|
|
46
46
|
#include "src/core/lib/debug/trace.h"
|
47
47
|
#include "src/core/lib/transport/http2_errors.h"
|
48
48
|
|
49
|
-
#define MAX_MAX_HEADER_LIST_SIZE (1024 * 1024 * 1024)
|
50
|
-
|
51
|
-
/* HTTP/2 mandated initial connection settings */
|
52
|
-
const grpc_chttp2_setting_parameters
|
53
|
-
grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS] = {
|
54
|
-
{NULL, 0, 0, 0, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE,
|
55
|
-
GRPC_HTTP2_PROTOCOL_ERROR},
|
56
|
-
{"HEADER_TABLE_SIZE", 4096, 0, 0xffffffff,
|
57
|
-
GRPC_CHTTP2_CLAMP_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
|
58
|
-
{"ENABLE_PUSH", 1, 0, 1, GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE,
|
59
|
-
GRPC_HTTP2_PROTOCOL_ERROR},
|
60
|
-
{"MAX_CONCURRENT_STREAMS", 0xffffffffu, 0, 0xffffffffu,
|
61
|
-
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
|
62
|
-
{"INITIAL_WINDOW_SIZE", 65535, 0, 0x7fffffffu,
|
63
|
-
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE,
|
64
|
-
GRPC_HTTP2_FLOW_CONTROL_ERROR},
|
65
|
-
{"MAX_FRAME_SIZE", 16384, 16384, 16777215,
|
66
|
-
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE, GRPC_HTTP2_PROTOCOL_ERROR},
|
67
|
-
{"MAX_HEADER_LIST_SIZE", MAX_MAX_HEADER_LIST_SIZE, 0,
|
68
|
-
MAX_MAX_HEADER_LIST_SIZE, GRPC_CHTTP2_CLAMP_INVALID_VALUE,
|
69
|
-
GRPC_HTTP2_PROTOCOL_ERROR},
|
70
|
-
};
|
71
|
-
|
72
49
|
static uint8_t *fill_header(uint8_t *out, uint32_t length, uint8_t flags) {
|
73
50
|
*out++ = (uint8_t)(length >> 16);
|
74
51
|
*out++ = (uint8_t)(length >> 8);
|
@@ -98,9 +75,8 @@ grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
|
|
98
75
|
|
99
76
|
for (i = 0; i < count; i++) {
|
100
77
|
if (new[i] != old[i] || (force_mask & (1u << i)) != 0) {
|
101
|
-
|
102
|
-
*p++ = (uint8_t)(i
|
103
|
-
*p++ = (uint8_t)(i);
|
78
|
+
*p++ = (uint8_t)(grpc_setting_id_to_wire_id[i] >> 8);
|
79
|
+
*p++ = (uint8_t)(grpc_setting_id_to_wire_id[i]);
|
104
80
|
*p++ = (uint8_t)(new[i] >> 24);
|
105
81
|
*p++ = (uint8_t)(new[i] >> 16);
|
106
82
|
*p++ = (uint8_t)(new[i] >> 8);
|
@@ -131,13 +107,16 @@ grpc_error *grpc_chttp2_settings_parser_begin_frame(
|
|
131
107
|
if (flags == GRPC_CHTTP2_FLAG_ACK) {
|
132
108
|
parser->is_ack = 1;
|
133
109
|
if (length != 0) {
|
134
|
-
return
|
110
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
111
|
+
"non-empty settings ack frame received");
|
135
112
|
}
|
136
113
|
return GRPC_ERROR_NONE;
|
137
114
|
} else if (flags != 0) {
|
138
|
-
return
|
115
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
116
|
+
"invalid flags on settings frame");
|
139
117
|
} else if (length % 6 != 0) {
|
140
|
-
return
|
118
|
+
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
119
|
+
"settings frames must be a multiple of six bytes");
|
141
120
|
} else {
|
142
121
|
return GRPC_ERROR_NONE;
|
143
122
|
}
|
@@ -151,6 +130,7 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p,
|
|
151
130
|
const uint8_t *cur = GRPC_SLICE_START_PTR(slice);
|
152
131
|
const uint8_t *end = GRPC_SLICE_END_PTR(slice);
|
153
132
|
char *msg;
|
133
|
+
grpc_chttp2_setting_id id;
|
154
134
|
|
155
135
|
if (parser->is_ack) {
|
156
136
|
return GRPC_ERROR_NONE;
|
@@ -213,9 +193,9 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p,
|
|
213
193
|
parser->value |= *cur;
|
214
194
|
cur++;
|
215
195
|
|
216
|
-
if (parser->id
|
196
|
+
if (grpc_wire_id_to_setting_id(parser->id, &id)) {
|
217
197
|
const grpc_chttp2_setting_parameters *sp =
|
218
|
-
&grpc_chttp2_settings_parameters[
|
198
|
+
&grpc_chttp2_settings_parameters[id];
|
219
199
|
if (parser->value < sp->min_value || parser->value > sp->max_value) {
|
220
200
|
switch (sp->invalid_value_behavior) {
|
221
201
|
case GRPC_CHTTP2_CLAMP_INVALID_VALUE:
|
@@ -229,24 +209,24 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p,
|
|
229
209
|
&t->qbuf);
|
230
210
|
gpr_asprintf(&msg, "invalid value %u passed for %s",
|
231
211
|
parser->value, sp->name);
|
232
|
-
grpc_error *err =
|
212
|
+
grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
233
213
|
gpr_free(msg);
|
234
214
|
return err;
|
235
215
|
}
|
236
216
|
}
|
237
|
-
if (
|
238
|
-
parser->incoming_settings[
|
217
|
+
if (id == GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE &&
|
218
|
+
parser->incoming_settings[id] != parser->value) {
|
239
219
|
t->initial_window_update +=
|
240
|
-
(int64_t)parser->value - parser->incoming_settings[
|
220
|
+
(int64_t)parser->value - parser->incoming_settings[id];
|
241
221
|
if (grpc_http_trace) {
|
242
222
|
gpr_log(GPR_DEBUG, "adding %d for initial_window change",
|
243
223
|
(int)t->initial_window_update);
|
244
224
|
}
|
245
225
|
}
|
246
|
-
parser->incoming_settings[
|
226
|
+
parser->incoming_settings[id] = parser->value;
|
247
227
|
if (grpc_http_trace) {
|
248
|
-
gpr_log(GPR_DEBUG, "CHTTP2:%s:%s: got setting %
|
249
|
-
t->is_client ? "CLI" : "SVR", t->peer_string,
|
228
|
+
gpr_log(GPR_DEBUG, "CHTTP2:%s:%s: got setting %s = %d",
|
229
|
+
t->is_client ? "CLI" : "SVR", t->peer_string, sp->name,
|
250
230
|
parser->value);
|
251
231
|
}
|
252
232
|
} else if (grpc_http_trace) {
|
@@ -37,6 +37,7 @@
|
|
37
37
|
#include <grpc/slice.h>
|
38
38
|
#include <grpc/support/port_platform.h>
|
39
39
|
#include "src/core/ext/transport/chttp2/transport/frame.h"
|
40
|
+
#include "src/core/ext/transport/chttp2/transport/http2_settings.h"
|
40
41
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
41
42
|
|
42
43
|
typedef enum {
|
@@ -48,17 +49,6 @@ typedef enum {
|
|
48
49
|
GRPC_CHTTP2_SPS_VAL3
|
49
50
|
} grpc_chttp2_settings_parse_state;
|
50
51
|
|
51
|
-
/* The things HTTP/2 defines as connection level settings */
|
52
|
-
typedef enum {
|
53
|
-
GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE = 1,
|
54
|
-
GRPC_CHTTP2_SETTINGS_ENABLE_PUSH = 2,
|
55
|
-
GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS = 3,
|
56
|
-
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 4,
|
57
|
-
GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE = 5,
|
58
|
-
GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE = 6,
|
59
|
-
GRPC_CHTTP2_NUM_SETTINGS
|
60
|
-
} grpc_chttp2_setting_id;
|
61
|
-
|
62
52
|
typedef struct {
|
63
53
|
grpc_chttp2_settings_parse_state state;
|
64
54
|
uint32_t *target_settings;
|
@@ -68,24 +58,6 @@ typedef struct {
|
|
68
58
|
uint32_t incoming_settings[GRPC_CHTTP2_NUM_SETTINGS];
|
69
59
|
} grpc_chttp2_settings_parser;
|
70
60
|
|
71
|
-
typedef enum {
|
72
|
-
GRPC_CHTTP2_CLAMP_INVALID_VALUE,
|
73
|
-
GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE
|
74
|
-
} grpc_chttp2_invalid_value_behavior;
|
75
|
-
|
76
|
-
typedef struct {
|
77
|
-
const char *name;
|
78
|
-
uint32_t default_value;
|
79
|
-
uint32_t min_value;
|
80
|
-
uint32_t max_value;
|
81
|
-
grpc_chttp2_invalid_value_behavior invalid_value_behavior;
|
82
|
-
uint32_t error_value;
|
83
|
-
} grpc_chttp2_setting_parameters;
|
84
|
-
|
85
|
-
/* HTTP/2 mandated connection setting parameters */
|
86
|
-
extern const grpc_chttp2_setting_parameters
|
87
|
-
grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS];
|
88
|
-
|
89
61
|
/* Create a settings frame by diffing old & new, and updating old to be new */
|
90
62
|
grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *newval,
|
91
63
|
uint32_t force_mask, size_t count);
|
@@ -70,7 +70,7 @@ grpc_error *grpc_chttp2_window_update_parser_begin_frame(
|
|
70
70
|
char *msg;
|
71
71
|
gpr_asprintf(&msg, "invalid window update: length=%d, flags=%02x", length,
|
72
72
|
flags);
|
73
|
-
grpc_error *err =
|
73
|
+
grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
74
74
|
gpr_free(msg);
|
75
75
|
return err;
|
76
76
|
}
|
@@ -102,7 +102,7 @@ grpc_error *grpc_chttp2_window_update_parser_parse(
|
|
102
102
|
if (received_update == 0 || (received_update & 0x80000000u)) {
|
103
103
|
char *msg;
|
104
104
|
gpr_asprintf(&msg, "invalid window update bytes: %d", p->amount);
|
105
|
-
grpc_error *err =
|
105
|
+
grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
|
106
106
|
gpr_free(msg);
|
107
107
|
return err;
|
108
108
|
}
|
@@ -86,6 +86,7 @@ typedef struct {
|
|
86
86
|
grpc_transport_one_way_stats *stats;
|
87
87
|
/* maximum size of a frame */
|
88
88
|
size_t max_frame_size;
|
89
|
+
bool use_true_binary_metadata;
|
89
90
|
} framer_state;
|
90
91
|
|
91
92
|
/* fills p (which is expected to be 9 bytes long) with a data frame header */
|
@@ -290,86 +291,113 @@ static void emit_indexed(grpc_chttp2_hpack_compressor *c, uint32_t elem_index,
|
|
290
291
|
len);
|
291
292
|
}
|
292
293
|
|
293
|
-
|
294
|
+
typedef struct {
|
295
|
+
grpc_slice data;
|
296
|
+
uint8_t huffman_prefix;
|
297
|
+
bool insert_null_before_wire_value;
|
298
|
+
} wire_value;
|
299
|
+
|
300
|
+
static wire_value get_wire_value(grpc_mdelem elem, bool true_binary_enabled) {
|
294
301
|
if (grpc_is_binary_header(GRPC_MDKEY(elem))) {
|
295
|
-
|
296
|
-
|
302
|
+
if (true_binary_enabled) {
|
303
|
+
return (wire_value){
|
304
|
+
.huffman_prefix = 0x00,
|
305
|
+
.insert_null_before_wire_value = true,
|
306
|
+
.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)),
|
307
|
+
};
|
308
|
+
} else {
|
309
|
+
return (wire_value){
|
310
|
+
.huffman_prefix = 0x80,
|
311
|
+
.insert_null_before_wire_value = false,
|
312
|
+
.data = grpc_chttp2_base64_encode_and_huffman_compress(
|
313
|
+
GRPC_MDVALUE(elem)),
|
314
|
+
};
|
315
|
+
}
|
316
|
+
} else {
|
317
|
+
/* TODO(ctiller): opportunistically compress non-binary headers */
|
318
|
+
return (wire_value){
|
319
|
+
.huffman_prefix = 0x00,
|
320
|
+
.insert_null_before_wire_value = false,
|
321
|
+
.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem)),
|
322
|
+
};
|
297
323
|
}
|
298
|
-
|
299
|
-
|
300
|
-
|
324
|
+
}
|
325
|
+
|
326
|
+
static size_t wire_value_length(wire_value v) {
|
327
|
+
return GPR_SLICE_LENGTH(v.data) + v.insert_null_before_wire_value;
|
328
|
+
}
|
329
|
+
|
330
|
+
static void add_wire_value(framer_state *st, wire_value v) {
|
331
|
+
if (v.insert_null_before_wire_value) *add_tiny_header_data(st, 1) = 0;
|
332
|
+
add_header_data(st, v.data);
|
301
333
|
}
|
302
334
|
|
303
335
|
static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor *c,
|
304
336
|
uint32_t key_index, grpc_mdelem elem,
|
305
337
|
framer_state *st) {
|
306
338
|
uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 2);
|
307
|
-
|
308
|
-
|
309
|
-
size_t len_val = GRPC_SLICE_LENGTH(value_slice);
|
339
|
+
wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
|
340
|
+
size_t len_val = wire_value_length(value);
|
310
341
|
uint32_t len_val_len;
|
311
342
|
GPR_ASSERT(len_val <= UINT32_MAX);
|
312
343
|
len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1);
|
313
344
|
GRPC_CHTTP2_WRITE_VARINT(key_index, 2, 0x40,
|
314
345
|
add_tiny_header_data(st, len_pfx), len_pfx);
|
315
|
-
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix,
|
346
|
+
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix,
|
316
347
|
add_tiny_header_data(st, len_val_len), len_val_len);
|
317
|
-
|
348
|
+
add_wire_value(st, value);
|
318
349
|
}
|
319
350
|
|
320
351
|
static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c,
|
321
352
|
uint32_t key_index, grpc_mdelem elem,
|
322
353
|
framer_state *st) {
|
323
354
|
uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 4);
|
324
|
-
|
325
|
-
|
326
|
-
size_t len_val = GRPC_SLICE_LENGTH(value_slice);
|
355
|
+
wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
|
356
|
+
size_t len_val = wire_value_length(value);
|
327
357
|
uint32_t len_val_len;
|
328
358
|
GPR_ASSERT(len_val <= UINT32_MAX);
|
329
359
|
len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1);
|
330
360
|
GRPC_CHTTP2_WRITE_VARINT(key_index, 4, 0x00,
|
331
361
|
add_tiny_header_data(st, len_pfx), len_pfx);
|
332
|
-
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix,
|
362
|
+
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, value.huffman_prefix,
|
333
363
|
add_tiny_header_data(st, len_val_len), len_val_len);
|
334
|
-
|
364
|
+
add_wire_value(st, value);
|
335
365
|
}
|
336
366
|
|
337
367
|
static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor *c,
|
338
368
|
grpc_mdelem elem, framer_state *st) {
|
339
369
|
uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
|
340
|
-
|
341
|
-
|
342
|
-
uint32_t len_val = (uint32_t)GRPC_SLICE_LENGTH(value_slice);
|
370
|
+
wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
|
371
|
+
uint32_t len_val = (uint32_t)wire_value_length(value);
|
343
372
|
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
|
344
373
|
uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
|
345
374
|
GPR_ASSERT(len_key <= UINT32_MAX);
|
346
|
-
GPR_ASSERT(
|
375
|
+
GPR_ASSERT(wire_value_length(value) <= UINT32_MAX);
|
347
376
|
*add_tiny_header_data(st, 1) = 0x40;
|
348
377
|
GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
|
349
378
|
add_tiny_header_data(st, len_key_len), len_key_len);
|
350
379
|
add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem)));
|
351
|
-
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix,
|
380
|
+
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix,
|
352
381
|
add_tiny_header_data(st, len_val_len), len_val_len);
|
353
|
-
|
382
|
+
add_wire_value(st, value);
|
354
383
|
}
|
355
384
|
|
356
385
|
static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c,
|
357
386
|
grpc_mdelem elem, framer_state *st) {
|
358
387
|
uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
|
359
|
-
|
360
|
-
|
361
|
-
uint32_t len_val = (uint32_t)GRPC_SLICE_LENGTH(value_slice);
|
388
|
+
wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
|
389
|
+
uint32_t len_val = (uint32_t)wire_value_length(value);
|
362
390
|
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
|
363
391
|
uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
|
364
392
|
GPR_ASSERT(len_key <= UINT32_MAX);
|
365
|
-
GPR_ASSERT(
|
393
|
+
GPR_ASSERT(wire_value_length(value) <= UINT32_MAX);
|
366
394
|
*add_tiny_header_data(st, 1) = 0x00;
|
367
395
|
GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
|
368
396
|
add_tiny_header_data(st, len_key_len), len_key_len);
|
369
397
|
add_header_data(st, grpc_slice_ref_internal(GRPC_MDKEY(elem)));
|
370
|
-
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix,
|
398
|
+
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, value.huffman_prefix,
|
371
399
|
add_tiny_header_data(st, len_val_len), len_val_len);
|
372
|
-
|
400
|
+
add_wire_value(st, value);
|
373
401
|
}
|
374
402
|
|
375
403
|
static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor *c,
|
@@ -595,23 +623,22 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
|
|
595
623
|
|
596
624
|
void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx,
|
597
625
|
grpc_chttp2_hpack_compressor *c,
|
598
|
-
|
599
|
-
|
600
|
-
size_t max_frame_size,
|
601
|
-
grpc_transport_one_way_stats *stats,
|
626
|
+
grpc_metadata_batch *metadata,
|
627
|
+
const grpc_encode_header_options *options,
|
602
628
|
grpc_slice_buffer *outbuf) {
|
603
629
|
framer_state st;
|
604
630
|
grpc_linked_mdelem *l;
|
605
631
|
gpr_timespec deadline;
|
606
632
|
|
607
|
-
GPR_ASSERT(stream_id != 0);
|
633
|
+
GPR_ASSERT(options->stream_id != 0);
|
608
634
|
|
609
635
|
st.seen_regular_header = 0;
|
610
|
-
st.stream_id = stream_id;
|
636
|
+
st.stream_id = options->stream_id;
|
611
637
|
st.output = outbuf;
|
612
638
|
st.is_first_frame = 1;
|
613
|
-
st.stats = stats;
|
614
|
-
st.max_frame_size = max_frame_size;
|
639
|
+
st.stats = options->stats;
|
640
|
+
st.max_frame_size = options->max_frame_size;
|
641
|
+
st.use_true_binary_metadata = options->use_true_binary_metadata;
|
615
642
|
|
616
643
|
/* Encode a metadata batch; store the returned values, representing
|
617
644
|
a metadata element that needs to be unreffed back into the metadata
|
@@ -630,5 +657,5 @@ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx,
|
|
630
657
|
deadline_enc(exec_ctx, c, deadline, &st);
|
631
658
|
}
|
632
659
|
|
633
|
-
finish_frame(&st, 1, is_eof);
|
660
|
+
finish_frame(&st, 1, options->is_eof);
|
634
661
|
}
|