grpc 1.56.2 → 1.57.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (383) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +29 -22
  3. data/include/grpc/event_engine/event_engine.h +22 -32
  4. data/include/grpc/impl/grpc_types.h +3 -0
  5. data/include/grpc/support/port_platform.h +29 -23
  6. data/src/core/ext/filters/client_channel/client_channel.cc +44 -8
  7. data/src/core/ext/filters/client_channel/dynamic_filters.h +3 -3
  8. data/src/core/ext/filters/client_channel/http_proxy.cc +5 -0
  9. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +21 -52
  10. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +19 -7
  11. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +25 -35
  12. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +78 -132
  13. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_balancer_addresses.cc +2 -1
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +4 -3
  15. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +3 -1
  16. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +38 -15
  17. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +3 -5
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +22 -6
  19. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric_internal.h +2 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +97 -71
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +2 -16
  22. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +56 -11
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +25 -0
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +6 -32
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +4 -6
  26. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +20 -79
  27. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +1 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -19
  29. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +1 -1
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +7 -41
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +3 -67
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +8 -0
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +31 -74
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +7 -51
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +16 -87
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +16 -50
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -74
  38. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -4
  39. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +69 -59
  40. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +7 -2
  41. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +1 -0
  42. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +25 -13
  43. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +366 -311
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +17 -1
  45. data/src/core/ext/filters/client_channel/retry_filter.cc +39 -2498
  46. data/src/core/ext/filters/client_channel/retry_filter.h +91 -1
  47. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.cc +2052 -0
  48. data/src/core/ext/filters/client_channel/retry_filter_legacy_call_data.h +442 -0
  49. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +38 -58
  50. data/src/core/ext/filters/client_channel/subchannel.h +3 -3
  51. data/src/core/ext/filters/client_channel/subchannel_interface_internal.h +3 -0
  52. data/src/core/ext/filters/rbac/rbac_filter.cc +40 -111
  53. data/src/core/ext/filters/rbac/rbac_filter.h +12 -30
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +162 -86
  55. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +0 -6
  56. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +7 -4
  57. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +131 -186
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +6569 -174
  59. data/src/core/ext/transport/chttp2/transport/decode_huff.h +2278 -441
  60. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +2 -3
  61. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +4 -3
  62. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -8
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +4 -4
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +3 -2
  65. data/src/core/ext/transport/chttp2/transport/internal.h +8 -4
  66. data/src/core/ext/transport/chttp2/transport/parsing.cc +15 -3
  67. data/src/core/ext/transport/chttp2/transport/writing.cc +2 -3
  68. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -6
  69. data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +143 -0
  70. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -9
  71. data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +0 -39
  72. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +13 -8
  73. data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +35 -6
  74. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +17 -13
  75. data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +85 -20
  76. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +26 -7
  77. data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +45 -3
  78. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.c +4 -3
  79. data/src/core/ext/upb-generated/envoy/config/metrics/v3/metrics_service.upb.h +21 -0
  80. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +30 -6
  81. data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +180 -0
  82. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.c +558 -0
  83. data/src/core/ext/upb-generated/envoy/data/accesslog/v3/accesslog.upb.h +2710 -0
  84. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +30 -11
  85. data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +53 -24
  86. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +30 -5
  87. data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +110 -0
  88. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +41 -15
  89. data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +150 -27
  90. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.c +1 -0
  91. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.c +47 -0
  92. data/src/core/ext/upb-generated/envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h +93 -0
  93. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +88 -76
  94. data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.h +5 -0
  95. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +11 -12
  96. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.h +0 -5
  97. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/grpc_service.upbdefs.c +162 -160
  98. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +129 -118
  99. data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +141 -135
  100. data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/metrics_service.upbdefs.c +19 -12
  101. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +38 -30
  102. data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +5 -0
  103. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.c +402 -0
  104. data/src/core/ext/upbdefs-generated/envoy/data/accesslog/v3/accesslog.upbdefs.h +111 -0
  105. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +80 -74
  106. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +63 -47
  107. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +5 -0
  108. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +315 -293
  109. data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
  110. data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/regex.upbdefs.c +29 -29
  111. data/src/core/ext/xds/xds_bootstrap_grpc.cc +33 -30
  112. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -13
  113. data/src/core/ext/xds/xds_client_grpc.cc +11 -6
  114. data/src/core/ext/xds/xds_client_grpc.h +16 -2
  115. data/src/core/ext/xds/xds_client_stats.h +10 -0
  116. data/src/core/ext/xds/xds_cluster.cc +26 -16
  117. data/src/core/ext/xds/xds_endpoint.cc +4 -7
  118. data/src/core/ext/xds/xds_health_status.cc +0 -17
  119. data/src/core/ext/xds/xds_health_status.h +5 -25
  120. data/src/core/ext/xds/xds_lb_policy_registry.cc +39 -0
  121. data/src/core/ext/xds/xds_route_config.cc +4 -0
  122. data/src/core/ext/xds/xds_transport_grpc.cc +1 -3
  123. data/src/core/lib/address_utils/parse_address.cc +63 -1
  124. data/src/core/lib/address_utils/parse_address.h +8 -0
  125. data/src/core/lib/address_utils/sockaddr_utils.cc +46 -1
  126. data/src/core/lib/address_utils/sockaddr_utils.h +2 -2
  127. data/src/core/lib/channel/channel_args.cc +21 -10
  128. data/src/core/lib/channel/channel_args.h +3 -0
  129. data/src/core/lib/channel/connected_channel.cc +4 -1
  130. data/src/core/lib/channel/promise_based_filter.h +1 -0
  131. data/src/core/lib/debug/trace.cc +1 -4
  132. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +2 -1
  133. data/src/core/lib/event_engine/cf_engine/cf_engine.h +1 -1
  134. data/src/core/lib/event_engine/event_engine.cc +0 -12
  135. data/src/core/lib/event_engine/forkable.cc +47 -42
  136. data/src/core/lib/event_engine/handle_containers.h +0 -4
  137. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +4 -6
  138. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -6
  139. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +25 -11
  140. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +3 -1
  141. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -1
  142. data/src/core/lib/event_engine/posix_engine/posix_engine.h +8 -12
  143. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +37 -27
  144. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +2 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +4 -2
  146. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +42 -2
  147. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +6 -0
  148. data/src/core/lib/event_engine/posix_engine/timer.h +10 -37
  149. data/src/core/lib/event_engine/tcp_socket_utils.cc +67 -7
  150. data/src/core/lib/event_engine/tcp_socket_utils.h +3 -0
  151. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +90 -37
  152. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +32 -12
  153. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +12 -21
  154. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +8 -12
  155. data/src/core/lib/event_engine/windows/windows_endpoint.cc +55 -54
  156. data/src/core/lib/event_engine/windows/windows_endpoint.h +15 -12
  157. data/src/core/lib/event_engine/windows/windows_engine.cc +2 -1
  158. data/src/core/lib/event_engine/windows/windows_engine.h +8 -12
  159. data/src/core/lib/experiments/config.cc +60 -22
  160. data/src/core/lib/experiments/config.h +20 -8
  161. data/src/core/lib/experiments/experiments.cc +278 -0
  162. data/src/core/lib/experiments/experiments.h +59 -1
  163. data/src/core/lib/gprpp/dual_ref_counted.h +9 -9
  164. data/src/core/lib/gprpp/fork.cc +8 -9
  165. data/src/core/lib/gprpp/fork.h +6 -5
  166. data/src/core/lib/gprpp/if_list.h +4530 -0
  167. data/src/core/lib/gprpp/orphanable.h +3 -3
  168. data/src/core/lib/gprpp/ref_counted.h +6 -6
  169. data/src/core/lib/gprpp/sorted_pack.h +3 -12
  170. data/src/core/lib/gprpp/status_helper.h +16 -15
  171. data/src/core/lib/gprpp/time.h +12 -0
  172. data/src/core/lib/gprpp/type_list.h +32 -0
  173. data/src/core/lib/http/httpcli.h +6 -9
  174. data/src/core/lib/iomgr/error.cc +32 -2
  175. data/src/core/lib/iomgr/error.h +9 -10
  176. data/src/core/lib/iomgr/ev_epoll1_linux.cc +5 -7
  177. data/src/core/lib/iomgr/ev_poll_posix.cc +6 -5
  178. data/src/core/lib/iomgr/exec_ctx.h +11 -0
  179. data/src/core/lib/iomgr/pollset.h +4 -5
  180. data/src/core/lib/iomgr/port.h +10 -0
  181. data/src/core/lib/iomgr/resolve_address.cc +13 -1
  182. data/src/core/lib/iomgr/resolve_address.h +17 -3
  183. data/src/core/lib/iomgr/sockaddr_posix.h +7 -0
  184. data/src/core/lib/iomgr/socket_utils_common_posix.cc +29 -0
  185. data/src/core/lib/iomgr/socket_utils_posix.cc +2 -0
  186. data/src/core/lib/iomgr/socket_utils_posix.h +6 -0
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -1
  188. data/src/core/lib/iomgr/tcp_posix.cc +21 -4
  189. data/src/core/lib/iomgr/tcp_server_posix.cc +3 -2
  190. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +5 -2
  191. data/src/core/lib/iomgr/tcp_windows.cc +1 -3
  192. data/src/core/lib/iomgr/vsock.cc +59 -0
  193. data/src/core/lib/iomgr/vsock.h +38 -0
  194. data/src/core/lib/iomgr/wakeup_fd_posix.h +3 -6
  195. data/src/core/lib/load_balancing/delegating_helper.h +115 -0
  196. data/src/core/lib/load_balancing/lb_policy.h +20 -0
  197. data/src/core/lib/load_balancing/subchannel_interface.h +6 -0
  198. data/src/core/lib/promise/party.h +1 -1
  199. data/src/core/lib/resolver/resolver_factory.h +3 -2
  200. data/src/core/lib/resolver/server_address.cc +9 -94
  201. data/src/core/lib/resolver/server_address.h +10 -64
  202. data/src/core/lib/resource_quota/memory_quota.h +1 -1
  203. data/src/core/lib/security/credentials/channel_creds_registry.h +51 -27
  204. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +169 -9
  205. data/src/core/lib/security/credentials/composite/composite_credentials.cc +1 -1
  206. data/src/core/lib/security/credentials/composite/composite_credentials.h +3 -1
  207. data/src/core/lib/security/credentials/external/external_account_credentials.cc +40 -1
  208. data/src/core/lib/security/credentials/external/external_account_credentials.h +6 -0
  209. data/src/core/lib/security/credentials/fake/fake_credentials.cc +30 -38
  210. data/src/core/lib/security/credentials/fake/fake_credentials.h +28 -0
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
  212. data/src/core/lib/security/credentials/tls/tls_credentials.h +3 -1
  213. data/src/core/lib/service_config/service_config_call_data.h +5 -0
  214. data/src/core/lib/slice/slice.h +16 -0
  215. data/src/core/lib/surface/call.cc +31 -29
  216. data/src/core/lib/surface/server.h +2 -2
  217. data/src/core/lib/surface/version.cc +2 -2
  218. data/src/core/lib/transport/metadata_batch.cc +7 -7
  219. data/src/core/lib/transport/metadata_batch.h +86 -48
  220. data/src/core/lib/transport/parsed_metadata.h +34 -20
  221. data/src/core/lib/transport/simple_slice_based_metadata.h +9 -2
  222. data/src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.cc +4 -6
  223. data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +1 -2
  224. data/src/core/tsi/ssl_transport_security.cc +28 -7
  225. data/src/ruby/bin/math_pb.rb +24 -18
  226. data/src/ruby/ext/grpc/extconf.rb +19 -18
  227. data/src/ruby/ext/grpc/rb_call.c +62 -39
  228. data/src/ruby/ext/grpc/rb_call_credentials.c +0 -1
  229. data/src/ruby/ext/grpc/rb_channel.c +126 -49
  230. data/src/ruby/ext/grpc/rb_channel.h +1 -0
  231. data/src/ruby/ext/grpc/rb_channel_args.c +16 -2
  232. data/src/ruby/ext/grpc/rb_channel_args.h +4 -0
  233. data/src/ruby/ext/grpc/rb_channel_credentials.c +0 -1
  234. data/src/ruby/ext/grpc/rb_compression_options.c +0 -1
  235. data/src/ruby/ext/grpc/rb_event_thread.c +22 -6
  236. data/src/ruby/ext/grpc/rb_event_thread.h +1 -0
  237. data/src/ruby/ext/grpc/rb_grpc.c +192 -30
  238. data/src/ruby/ext/grpc/rb_grpc.h +8 -2
  239. data/src/ruby/ext/grpc/rb_server.c +62 -45
  240. data/src/ruby/ext/grpc/rb_server_credentials.c +0 -1
  241. data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +0 -1
  242. data/src/ruby/ext/grpc/rb_xds_server_credentials.c +0 -1
  243. data/src/ruby/lib/grpc/generic/bidi_call.rb +2 -0
  244. data/src/ruby/lib/grpc/version.rb +1 -1
  245. data/src/ruby/pb/grpc/health/v1/health_pb.rb +24 -13
  246. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +24 -3
  247. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +25 -111
  248. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +25 -2
  249. data/third_party/boringssl-with-bazel/err_data.c +552 -552
  250. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +5 -5
  251. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_time.c +34 -1
  252. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +4 -1
  253. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +3 -3
  254. data/third_party/boringssl-with-bazel/src/crypto/bio/bio_mem.c +7 -8
  255. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +2 -2
  256. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -2
  257. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +8 -8
  258. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
  259. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +2 -2
  260. data/third_party/boringssl-with-bazel/src/crypto/chacha/chacha.c +19 -1
  261. data/third_party/boringssl-with-bazel/src/crypto/chacha/internal.h +8 -1
  262. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +28 -185
  263. data/third_party/boringssl-with-bazel/src/crypto/conf/conf_def.h +3 -7
  264. data/third_party/boringssl-with-bazel/src/crypto/conf/internal.h +8 -0
  265. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +3 -0
  266. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +49 -46
  267. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_64_adx.c +18 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +2809 -7417
  269. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +27 -5
  270. data/third_party/boringssl-with-bazel/src/crypto/dsa/internal.h +20 -0
  271. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +110 -72
  272. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_derive.c +4 -3
  273. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +15 -14
  274. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +13 -10
  275. data/third_party/boringssl-with-bazel/src/crypto/evp/evp.c +35 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec.c +2 -4
  277. data/third_party/boringssl-with-bazel/src/crypto/evp/p_ec_asn1.c +3 -7
  278. data/third_party/boringssl-with-bazel/src/crypto/evp/pbkdf.c +3 -3
  279. data/third_party/boringssl-with-bazel/src/crypto/evp/print.c +7 -6
  280. data/third_party/boringssl-with-bazel/src/crypto/ex_data.c +34 -72
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +12 -5
  283. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/gcd.c +5 -6
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +12 -6
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery.c +17 -18
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/montgomery_inv.c +51 -15
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/rsaz_exp.c +7 -7
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/delocate.h +5 -6
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +2 -0
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/builtin_curves.h +277 -0
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +180 -404
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +3 -3
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +24 -57
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/felem.c +17 -13
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +33 -71
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +18 -17
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +5 -7
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +15 -18
  299. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +9 -11
  300. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/scalar.c +24 -24
  301. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +11 -27
  302. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +8 -8
  303. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +4 -4
  304. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +9 -3
  305. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/hkdf/hkdf.c +1 -1
  306. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/fork_detect.c +40 -26
  307. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +21 -7
  308. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +38 -19
  309. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +2 -29
  310. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +55 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +33 -52
  312. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +3 -8
  313. data/third_party/boringssl-with-bazel/src/crypto/internal.h +198 -79
  314. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +5 -4
  315. data/third_party/boringssl-with-bazel/src/crypto/mem.c +7 -8
  316. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +19 -23
  317. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/internal.h +3 -3
  318. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/p5_pbev2.c +3 -3
  319. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8.c +7 -7
  320. data/third_party/boringssl-with-bazel/src/crypto/pkcs8/pkcs8_x509.c +8 -5
  321. data/third_party/boringssl-with-bazel/src/crypto/pool/internal.h +1 -0
  322. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/deterministic.c +7 -6
  323. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/forkunsafe.c +6 -12
  324. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +48 -0
  325. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/{fuchsia.c → ios.c} +8 -8
  326. data/third_party/boringssl-with-bazel/src/crypto/{refcount_no_threads.c → rand_extra/trusty.c} +15 -19
  327. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/windows.c +41 -19
  328. data/third_party/boringssl-with-bazel/src/crypto/{refcount_c11.c → refcount.c} +11 -17
  329. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +147 -72
  330. data/third_party/boringssl-with-bazel/src/crypto/thread_none.c +0 -8
  331. data/third_party/boringssl-with-bazel/src/crypto/thread_pthread.c +6 -35
  332. data/third_party/boringssl-with-bazel/src/crypto/thread_win.c +5 -26
  333. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +14 -18
  334. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +54 -143
  335. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +7 -13
  336. data/third_party/boringssl-with-bazel/src/crypto/x509/internal.h +1 -1
  337. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +1 -1
  338. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_lu.c +2 -4
  339. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +2 -2
  340. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_trs.c +1 -1
  341. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +8 -12
  342. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_vfy.c +19 -20
  343. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -15
  344. data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +5 -5
  345. data/third_party/boringssl-with-bazel/src/crypto/x509/x_name.c +1 -1
  346. data/third_party/boringssl-with-bazel/src/crypto/x509/x_pubkey.c +7 -7
  347. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +2 -3
  348. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_purp.c +4 -6
  349. data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +4 -119
  350. data/third_party/boringssl-with-bazel/src/include/openssl/asm_base.h +207 -0
  351. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +5 -0
  352. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +2 -116
  353. data/third_party/boringssl-with-bazel/src/include/openssl/bn.h +0 -2
  354. data/third_party/boringssl-with-bazel/src/include/openssl/chacha.h +6 -0
  355. data/third_party/boringssl-with-bazel/src/include/openssl/conf.h +5 -1
  356. data/third_party/boringssl-with-bazel/src/include/openssl/dsa.h +0 -21
  357. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +21 -2
  358. data/third_party/boringssl-with-bazel/src/include/openssl/ec_key.h +19 -6
  359. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +11 -7
  360. data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +13 -14
  361. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +0 -61
  362. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +127 -81
  363. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +224 -209
  364. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +154 -0
  365. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +1 -29
  366. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +4 -4
  367. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +3 -2
  368. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +9 -65
  369. data/third_party/boringssl-with-bazel/src/ssl/handoff.cc +20 -20
  370. data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +1 -1
  371. data/third_party/boringssl-with-bazel/src/ssl/internal.h +4 -11
  372. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +24 -18
  373. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +37 -30
  374. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +125 -26
  375. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -3
  376. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_adx.h +691 -0
  377. data/third_party/upb/upb/collections/map.c +3 -3
  378. metadata +27 -12
  379. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.cc +0 -42
  380. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_attributes.h +0 -64
  381. data/src/core/ext/transport/chttp2/transport/stream_map.cc +0 -177
  382. data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -68
  383. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +0 -89
@@ -41,8 +41,10 @@
41
41
 
42
42
  #include "src/core/lib/compression/compression_internal.h"
43
43
  #include "src/core/lib/gprpp/chunked_vector.h"
44
+ #include "src/core/lib/gprpp/if_list.h"
44
45
  #include "src/core/lib/gprpp/packed_table.h"
45
46
  #include "src/core/lib/gprpp/time.h"
47
+ #include "src/core/lib/gprpp/type_list.h"
46
48
  #include "src/core/lib/resource_quota/arena.h"
47
49
  #include "src/core/lib/slice/slice.h"
48
50
  #include "src/core/lib/transport/custom_metadata.h"
@@ -78,7 +80,9 @@ struct GrpcTimeoutMetadata {
78
80
  using MementoType = Duration;
79
81
  using CompressionTraits = TimeoutCompressor;
80
82
  static absl::string_view key() { return "grpc-timeout"; }
81
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
83
+ static MementoType ParseMemento(Slice value,
84
+ bool will_keep_past_request_lifetime,
85
+ MetadataParseErrorFn on_error);
82
86
  static ValueType MementoToValue(MementoType timeout);
83
87
  static Slice Encode(ValueType x);
84
88
  static std::string DisplayValue(ValueType x) { return x.ToString(); }
@@ -98,7 +102,9 @@ struct TeMetadata {
98
102
  using MementoType = ValueType;
99
103
  using CompressionTraits = KnownValueCompressor<ValueType, kTrailers>;
100
104
  static absl::string_view key() { return "te"; }
101
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
105
+ static MementoType ParseMemento(Slice value,
106
+ bool will_keep_past_request_lifetime,
107
+ MetadataParseErrorFn on_error);
102
108
  static ValueType MementoToValue(MementoType te) { return te; }
103
109
  static StaticSlice Encode(ValueType x) {
104
110
  GPR_ASSERT(x == kTrailers);
@@ -126,7 +132,9 @@ struct ContentTypeMetadata {
126
132
  using MementoType = ValueType;
127
133
  using CompressionTraits = KnownValueCompressor<ValueType, kApplicationGrpc>;
128
134
  static absl::string_view key() { return "content-type"; }
129
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
135
+ static MementoType ParseMemento(Slice value,
136
+ bool will_keep_past_request_lifetime,
137
+ MetadataParseErrorFn on_error);
130
138
  static ValueType MementoToValue(MementoType content_type) {
131
139
  return content_type;
132
140
  }
@@ -149,7 +157,8 @@ struct HttpSchemeMetadata {
149
157
  using MementoType = ValueType;
150
158
  using CompressionTraits = HttpSchemeCompressor;
151
159
  static absl::string_view key() { return ":scheme"; }
152
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
160
+ static MementoType ParseMemento(Slice value, bool,
161
+ MetadataParseErrorFn on_error) {
153
162
  return Parse(value.as_string_view(), on_error);
154
163
  }
155
164
  static ValueType Parse(absl::string_view value,
@@ -178,7 +187,9 @@ struct HttpMethodMetadata {
178
187
  using MementoType = ValueType;
179
188
  using CompressionTraits = HttpMethodCompressor;
180
189
  static absl::string_view key() { return ":method"; }
181
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
190
+ static MementoType ParseMemento(Slice value,
191
+ bool will_keep_past_request_lifetime,
192
+ MetadataParseErrorFn on_error);
182
193
  static ValueType MementoToValue(MementoType content_type) {
183
194
  return content_type;
184
195
  }
@@ -194,7 +205,9 @@ struct HttpMethodMetadata {
194
205
  struct CompressionAlgorithmBasedMetadata {
195
206
  using ValueType = grpc_compression_algorithm;
196
207
  using MementoType = ValueType;
197
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
208
+ static MementoType ParseMemento(Slice value,
209
+ bool will_keep_past_request_lifetime,
210
+ MetadataParseErrorFn on_error);
198
211
  static ValueType MementoToValue(MementoType x) { return x; }
199
212
  static Slice Encode(ValueType x) {
200
213
  GPR_ASSERT(x != GRPC_COMPRESS_ALGORITHMS_COUNT);
@@ -232,7 +245,7 @@ struct GrpcAcceptEncodingMetadata {
232
245
  using ValueType = CompressionAlgorithmSet;
233
246
  using MementoType = ValueType;
234
247
  using CompressionTraits = StableValueCompressor;
235
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
248
+ static MementoType ParseMemento(Slice value, bool, MetadataParseErrorFn) {
236
249
  return CompressionAlgorithmSet::FromString(value.as_string_view());
237
250
  }
238
251
  static ValueType MementoToValue(MementoType x) { return x; }
@@ -322,7 +335,7 @@ struct SimpleIntBasedMetadataBase {
322
335
  template <typename Int, Int kInvalidValue>
323
336
  struct SimpleIntBasedMetadata : public SimpleIntBasedMetadataBase<Int> {
324
337
  static constexpr Int invalid_value() { return kInvalidValue; }
325
- static Int ParseMemento(Slice value, MetadataParseErrorFn on_error) {
338
+ static Int ParseMemento(Slice value, bool, MetadataParseErrorFn on_error) {
326
339
  Int out;
327
340
  if (!absl::SimpleAtoi(value.as_string_view(), &out)) {
328
341
  on_error("not an integer", value);
@@ -359,7 +372,9 @@ struct GrpcRetryPushbackMsMetadata {
359
372
  static Slice Encode(Duration x) { return Slice::FromInt64(x.millis()); }
360
373
  static int64_t DisplayValue(Duration x) { return x.millis(); }
361
374
  static int64_t DisplayMemento(Duration x) { return DisplayValue(x); }
362
- static Duration ParseMemento(Slice value, MetadataParseErrorFn on_error);
375
+ static Duration ParseMemento(Slice value,
376
+ bool will_keep_past_request_lifetime,
377
+ MetadataParseErrorFn on_error);
363
378
  };
364
379
 
365
380
  // :status metadata trait.
@@ -386,7 +401,7 @@ struct GrpcLbClientStatsMetadata {
386
401
  static const char* DisplayMemento(MementoType) {
387
402
  return "<internal-lb-stats>";
388
403
  }
389
- static MementoType ParseMemento(Slice, MetadataParseErrorFn) {
404
+ static MementoType ParseMemento(Slice, bool, MetadataParseErrorFn) {
390
405
  return nullptr;
391
406
  }
392
407
  };
@@ -417,7 +432,9 @@ struct LbCostBinMetadata {
417
432
  static Slice Encode(const ValueType& x);
418
433
  static std::string DisplayValue(ValueType x);
419
434
  static std::string DisplayMemento(MementoType x) { return DisplayValue(x); }
420
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
435
+ static MementoType ParseMemento(Slice value,
436
+ bool will_keep_past_request_lifetime,
437
+ MetadataParseErrorFn on_error);
421
438
  };
422
439
 
423
440
  // Annotation added by a transport to note whether a failed request was never
@@ -517,44 +534,53 @@ struct IsEncodableTrait<Trait, absl::void_t<decltype(Trait::key())>> {
517
534
  static const bool value = true;
518
535
  };
519
536
 
520
- // Helper type - maps a string name to a trait.
521
537
  template <typename MustBeVoid, typename... Traits>
522
- struct NameLookup;
538
+ struct EncodableTraits;
523
539
 
524
540
  template <typename Trait, typename... Traits>
525
- struct NameLookup<absl::enable_if_t<IsEncodableTrait<Trait>::value, void>,
526
- Trait, Traits...> {
527
- // Call op->Found(Trait()) if op->name == Trait::key() for some Trait in
528
- // Traits. If not found, call op->NotFound().
529
- template <typename Op>
530
- static auto Lookup(absl::string_view key, Op* op)
531
- -> decltype(op->Found(Trait())) {
532
- if (key == Trait::key()) {
533
- return op->Found(Trait());
534
- }
535
- return NameLookup<void, Traits...>::Lookup(key, op);
536
- }
541
+ struct EncodableTraits<absl::enable_if_t<IsEncodableTrait<Trait>::value, void>,
542
+ Trait, Traits...> {
543
+ using List =
544
+ typename EncodableTraits<void,
545
+ Traits...>::List::template PushFront<Trait>;
537
546
  };
538
547
 
539
548
  template <typename Trait, typename... Traits>
540
- struct NameLookup<absl::enable_if_t<!IsEncodableTrait<Trait>::value, void>,
541
- Trait, Traits...> {
542
- template <typename Op>
543
- static auto Lookup(absl::string_view key, Op* op)
544
- -> decltype(NameLookup<void, Traits...>::Lookup(key, op)) {
545
- return NameLookup<void, Traits...>::Lookup(key, op);
546
- }
549
+ struct EncodableTraits<absl::enable_if_t<!IsEncodableTrait<Trait>::value, void>,
550
+ Trait, Traits...> {
551
+ using List = typename EncodableTraits<void, Traits...>::List;
547
552
  };
548
553
 
549
554
  template <>
550
- struct NameLookup<void> {
555
+ struct EncodableTraits<void> {
556
+ using List = Typelist<>;
557
+ };
558
+
559
+ template <typename Trait>
560
+ struct EncodableNameLookupKeyComparison {
561
+ bool operator()(absl::string_view key) { return key == Trait::key(); }
562
+ };
563
+
564
+ template <typename Trait, typename Op>
565
+ struct EncodableNameLookupOnFound {
566
+ auto operator()(Op* op) { return op->Found(Trait()); }
567
+ };
568
+
569
+ template <typename... Traits>
570
+ struct EncodableNameLookup {
551
571
  template <typename Op>
552
- static auto Lookup(absl::string_view key, Op* op)
553
- -> decltype(op->NotFound(key)) {
554
- return op->NotFound(key);
572
+ static auto Lookup(absl::string_view key, Op* op) {
573
+ return IfList(
574
+ key, op, [key](Op* op) { return op->NotFound(key); },
575
+ EncodableNameLookupKeyComparison<Traits>()...,
576
+ EncodableNameLookupOnFound<Traits, Op>()...);
555
577
  }
556
578
  };
557
579
 
580
+ template <typename... Traits>
581
+ using NameLookup = typename EncodableTraits<
582
+ void, Traits...>::List::template Instantiate<EncodableNameLookup>;
583
+
558
584
  // Helper to take a slice to a memento to a value.
559
585
  // By splitting this part out we can scale code size as the number of
560
586
  // (memento, value) types, rather than as the number of traits.
@@ -563,9 +589,9 @@ struct ParseValue {
563
589
  template <ParseMementoFn parse_memento, MementoToValueFn memento_to_value>
564
590
  static GPR_ATTRIBUTE_NOINLINE auto Parse(Slice* value,
565
591
  MetadataParseErrorFn on_error)
566
- -> decltype(memento_to_value(parse_memento(std::move(*value),
592
+ -> decltype(memento_to_value(parse_memento(std::move(*value), false,
567
593
  on_error))) {
568
- return memento_to_value(parse_memento(std::move(*value), on_error));
594
+ return memento_to_value(parse_memento(std::move(*value), false, on_error));
569
595
  }
570
596
  };
571
597
 
@@ -575,8 +601,10 @@ struct ParseValue {
575
601
  template <typename Container>
576
602
  class ParseHelper {
577
603
  public:
578
- ParseHelper(Slice value, MetadataParseErrorFn on_error, size_t transport_size)
604
+ ParseHelper(Slice value, bool will_keep_past_request_lifetime,
605
+ MetadataParseErrorFn on_error, size_t transport_size)
579
606
  : value_(std::move(value)),
607
+ will_keep_past_request_lifetime_(will_keep_past_request_lifetime),
580
608
  on_error_(on_error),
581
609
  transport_size_(transport_size) {}
582
610
 
@@ -596,12 +624,14 @@ class ParseHelper {
596
624
  }
597
625
 
598
626
  private:
599
- template <typename T, T (*parse_memento)(Slice, MetadataParseErrorFn)>
627
+ template <typename T, T (*parse_memento)(Slice, bool, MetadataParseErrorFn)>
600
628
  GPR_ATTRIBUTE_NOINLINE T ParseValueToMemento() {
601
- return parse_memento(std::move(value_), on_error_);
629
+ return parse_memento(std::move(value_), will_keep_past_request_lifetime_,
630
+ on_error_);
602
631
  }
603
632
 
604
633
  Slice value_;
634
+ const bool will_keep_past_request_lifetime_;
605
635
  MetadataParseErrorFn on_error_;
606
636
  const size_t transport_size_;
607
637
  };
@@ -1096,8 +1126,14 @@ MetadataValueAsSlice(typename Which::ValueType value) {
1096
1126
  // static absl::string_view key() { return "grpc-xyz"; }
1097
1127
  // // Parse a memento from a slice
1098
1128
  // // Takes ownership of value
1129
+ // // If will_keep_past_request_lifetime is true, expect that the returned
1130
+ // // memento will be kept for a long time, and so try not to keep a ref to
1131
+ // // the input slice.
1099
1132
  // // Calls fn in the case of an error that should be reported to the user
1100
- // static MementoType ParseMemento(Slice value, MementoParseErrorFn fn) {
1133
+ // static MementoType ParseMemento(
1134
+ // Slice value,
1135
+ // bool will_keep_past_request_lifetime,
1136
+ // MementoParseErrorFn fn) {
1101
1137
  // ...
1102
1138
  // }
1103
1139
  // // Convert a memento to a value
@@ -1277,7 +1313,7 @@ class MetadataMap {
1277
1313
  // Remove some metadata by name
1278
1314
  void Remove(absl::string_view key) {
1279
1315
  metadata_detail::RemoveHelper<Derived> helper(static_cast<Derived*>(this));
1280
- metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
1316
+ metadata_detail::NameLookup<Traits...>::Lookup(key, &helper);
1281
1317
  }
1282
1318
 
1283
1319
  void Remove(const char* key) { Remove(absl::string_view(key)); }
@@ -1287,7 +1323,7 @@ class MetadataMap {
1287
1323
  std::string* buffer) const {
1288
1324
  metadata_detail::GetStringValueHelper<Derived> helper(
1289
1325
  static_cast<const Derived*>(this), buffer);
1290
- return metadata_detail::NameLookup<void, Traits...>::Lookup(name, &helper);
1326
+ return metadata_detail::NameLookup<Traits...>::Lookup(name, &helper);
1291
1327
  }
1292
1328
 
1293
1329
  // Extract a piece of known metadata.
@@ -1324,11 +1360,13 @@ class MetadataMap {
1324
1360
  // Parse metadata from a key/value pair, and return an object representing
1325
1361
  // that result.
1326
1362
  static ParsedMetadata<Derived> Parse(absl::string_view key, Slice value,
1363
+ bool will_keep_past_request_lifetime,
1327
1364
  uint32_t transport_size,
1328
1365
  MetadataParseErrorFn on_error) {
1329
- metadata_detail::ParseHelper<Derived> helper(value.TakeOwned(), on_error,
1330
- transport_size);
1331
- return metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
1366
+ metadata_detail::ParseHelper<Derived> helper(
1367
+ value.TakeOwned(), will_keep_past_request_lifetime, on_error,
1368
+ transport_size);
1369
+ return metadata_detail::NameLookup<Traits...>::Lookup(key, &helper);
1332
1370
  }
1333
1371
 
1334
1372
  // Set a value from a parsed metadata object.
@@ -1341,7 +1379,7 @@ class MetadataMap {
1341
1379
  MetadataParseErrorFn on_error) {
1342
1380
  metadata_detail::AppendHelper<Derived> helper(static_cast<Derived*>(this),
1343
1381
  value.TakeOwned(), on_error);
1344
- metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
1382
+ metadata_detail::NameLookup<Traits...>::Lookup(key, &helper);
1345
1383
  }
1346
1384
 
1347
1385
  void Clear();
@@ -33,6 +33,7 @@
33
33
 
34
34
  #include <grpc/slice.h>
35
35
 
36
+ #include "src/core/lib/experiments/experiments.h"
36
37
  #include "src/core/lib/gprpp/time.h"
37
38
  #include "src/core/lib/slice/slice.h"
38
39
 
@@ -193,14 +194,16 @@ class ParsedMetadata {
193
194
  // HTTP2 defined storage size of this metadatum.
194
195
  uint32_t transport_size() const { return transport_size_; }
195
196
  // Create a new parsed metadata with the same key but a different value.
196
- ParsedMetadata WithNewValue(Slice value, uint32_t value_wire_size,
197
+ ParsedMetadata WithNewValue(Slice value, bool will_keep_past_request_lifetime,
198
+ uint32_t value_wire_size,
197
199
  MetadataParseErrorFn on_error) const {
198
200
  ParsedMetadata result;
199
201
  result.vtable_ = vtable_;
200
202
  result.value_ = value_;
201
203
  result.transport_size_ =
202
204
  TransportSize(static_cast<uint32_t>(key().length()), value_wire_size);
203
- vtable_->with_new_value(&value, on_error, &result);
205
+ vtable_->with_new_value(&value, will_keep_past_request_lifetime, on_error,
206
+ &result);
204
207
  return result;
205
208
  }
206
209
  std::string DebugString() const { return vtable_->debug_string(value_); }
@@ -224,6 +227,7 @@ class ParsedMetadata {
224
227
  void (*const set)(const Buffer& value, MetadataContainer* container);
225
228
  // result is a bitwise copy of the originating ParsedMetadata.
226
229
  void (*const with_new_value)(Slice* new_value,
230
+ bool will_keep_past_request_lifetime,
227
231
  MetadataParseErrorFn on_error,
228
232
  ParsedMetadata* result);
229
233
  std::string (*const debug_string)(const Buffer& value);
@@ -241,17 +245,22 @@ class ParsedMetadata {
241
245
  template <typename Which>
242
246
  static const VTable* SliceTraitVTable();
243
247
 
244
- template <Slice (*ParseMemento)(Slice, MetadataParseErrorFn)>
248
+ template <Slice (*ParseMemento)(Slice, bool, MetadataParseErrorFn)>
245
249
  GPR_ATTRIBUTE_NOINLINE static void WithNewValueSetSlice(
246
- Slice* slice, MetadataParseErrorFn on_error, ParsedMetadata* result) {
250
+ Slice* slice, bool will_keep_past_request_lifetime,
251
+ MetadataParseErrorFn on_error, ParsedMetadata* result) {
247
252
  result->value_.slice =
248
- ParseMemento(std::move(*slice), on_error).TakeCSlice();
253
+ ParseMemento(std::move(*slice), will_keep_past_request_lifetime,
254
+ on_error)
255
+ .TakeCSlice();
249
256
  }
250
257
 
251
- template <typename T, T (*ParseMemento)(Slice, MetadataParseErrorFn)>
258
+ template <typename T, T (*ParseMemento)(Slice, bool, MetadataParseErrorFn)>
252
259
  GPR_ATTRIBUTE_NOINLINE static void WithNewValueSetTrivial(
253
- Slice* slice, MetadataParseErrorFn on_error, ParsedMetadata* result) {
254
- T memento = ParseMemento(std::move(*slice), on_error);
260
+ Slice* slice, bool will_keep_past_request_lifetime,
261
+ MetadataParseErrorFn on_error, ParsedMetadata* result) {
262
+ T memento = ParseMemento(std::move(*slice), will_keep_past_request_lifetime,
263
+ on_error);
255
264
  memcpy(result->value_.trivial, &memento, sizeof(memento));
256
265
  }
257
266
 
@@ -272,7 +281,7 @@ ParsedMetadata<MetadataContainer>::EmptyVTable() {
272
281
  // set
273
282
  [](const Buffer&, MetadataContainer*) {},
274
283
  // with_new_value
275
- [](Slice*, MetadataParseErrorFn, ParsedMetadata*) {},
284
+ [](Slice*, bool, MetadataParseErrorFn, ParsedMetadata*) {},
276
285
  // debug_string
277
286
  [](const Buffer&) -> std::string { return "empty"; },
278
287
  // key
@@ -330,9 +339,11 @@ ParsedMetadata<MetadataContainer>::NonTrivialTraitVTable() {
330
339
  map->Set(Which(), Which::MementoToValue(*p));
331
340
  },
332
341
  // with_new_value
333
- [](Slice* value, MetadataParseErrorFn on_error, ParsedMetadata* result) {
334
- result->value_.pointer = new typename Which::MementoType(
335
- Which::ParseMemento(std::move(*value), on_error));
342
+ [](Slice* value, bool will_keep_past_request_lifetime,
343
+ MetadataParseErrorFn on_error, ParsedMetadata* result) {
344
+ result->value_.pointer =
345
+ new typename Which::MementoType(Which::ParseMemento(
346
+ std::move(*value), will_keep_past_request_lifetime, on_error));
336
347
  },
337
348
  // debug_string
338
349
  [](const Buffer& value) {
@@ -387,14 +398,17 @@ ParsedMetadata<MetadataContainer>::KeyValueVTable(absl::string_view key) {
387
398
  auto* p = static_cast<KV*>(value.pointer);
388
399
  map->unknown_.Append(p->first.as_string_view(), p->second.Ref());
389
400
  };
390
- static const auto with_new_value = [](Slice* value, MetadataParseErrorFn,
391
- ParsedMetadata* result) {
392
- auto* p = new KV{
393
- static_cast<KV*>(result->value_.pointer)->first.Ref(),
394
- std::move(*value),
395
- };
396
- result->value_.pointer = p;
397
- };
401
+ static const auto with_new_value =
402
+ [](Slice* value, bool will_keep_past_request_lifetime,
403
+ MetadataParseErrorFn, ParsedMetadata* result) {
404
+ auto* p = new KV{
405
+ static_cast<KV*>(result->value_.pointer)->first.Ref(),
406
+ will_keep_past_request_lifetime && IsUniqueMetadataStringsEnabled()
407
+ ? value->TakeUniquelyOwned()
408
+ : std::move(*value),
409
+ };
410
+ result->value_.pointer = p;
411
+ };
398
412
  static const auto debug_string = [](const Buffer& value) {
399
413
  auto* p = static_cast<KV*>(value.pointer);
400
414
  return absl::StrCat(p->first.as_string_view(), ": ",
@@ -19,6 +19,7 @@
19
19
 
20
20
  #include "absl/strings/string_view.h"
21
21
 
22
+ #include "src/core/lib/experiments/experiments.h"
22
23
  #include "src/core/lib/slice/slice.h"
23
24
  #include "src/core/lib/transport/parsed_metadata.h"
24
25
 
@@ -30,8 +31,14 @@ namespace grpc_core {
30
31
  struct SimpleSliceBasedMetadata {
31
32
  using ValueType = Slice;
32
33
  using MementoType = Slice;
33
- static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
34
- return value.TakeOwned();
34
+ static MementoType ParseMemento(Slice value,
35
+ bool will_keep_past_request_lifetime,
36
+ MetadataParseErrorFn) {
37
+ if (will_keep_past_request_lifetime && IsUniqueMetadataStringsEnabled()) {
38
+ return value.TakeUniquelyOwned();
39
+ } else {
40
+ return value.TakeOwned();
41
+ }
35
42
  }
36
43
  static ValueType MementoToValue(MementoType value) { return value; }
37
44
  static Slice Encode(const ValueType& x) { return x.Ref(); }
@@ -124,9 +124,8 @@ tsi_result alts_grpc_record_protocol_init(alts_grpc_record_protocol* rp,
124
124
  tsi_result alts_grpc_record_protocol_protect(
125
125
  alts_grpc_record_protocol* self, grpc_slice_buffer* unprotected_slices,
126
126
  grpc_slice_buffer* protected_slices) {
127
- if (grpc_core::ExecCtx::Get() == nullptr || self == nullptr ||
128
- self->vtable == nullptr || unprotected_slices == nullptr ||
129
- protected_slices == nullptr) {
127
+ if (self == nullptr || self->vtable == nullptr ||
128
+ unprotected_slices == nullptr || protected_slices == nullptr) {
130
129
  return TSI_INVALID_ARGUMENT;
131
130
  }
132
131
  if (self->vtable->protect == nullptr) {
@@ -138,9 +137,8 @@ tsi_result alts_grpc_record_protocol_protect(
138
137
  tsi_result alts_grpc_record_protocol_unprotect(
139
138
  alts_grpc_record_protocol* self, grpc_slice_buffer* protected_slices,
140
139
  grpc_slice_buffer* unprotected_slices) {
141
- if (grpc_core::ExecCtx::Get() == nullptr || self == nullptr ||
142
- self->vtable == nullptr || protected_slices == nullptr ||
143
- unprotected_slices == nullptr) {
140
+ if (self == nullptr || self->vtable == nullptr ||
141
+ protected_slices == nullptr || unprotected_slices == nullptr) {
144
142
  return TSI_INVALID_ARGUMENT;
145
143
  }
146
144
  if (self->vtable->unprotect == nullptr) {
@@ -263,8 +263,7 @@ tsi_result alts_zero_copy_grpc_protector_create(
263
263
  bool is_integrity_only, bool enable_extra_copy,
264
264
  size_t* max_protected_frame_size,
265
265
  tsi_zero_copy_grpc_protector** protector) {
266
- if (grpc_core::ExecCtx::Get() == nullptr || key == nullptr ||
267
- protector == nullptr) {
266
+ if (key == nullptr || protector == nullptr) {
268
267
  gpr_log(
269
268
  GPR_ERROR,
270
269
  "Invalid nullptr arguments to alts_zero_copy_grpc_protector create.");
@@ -65,6 +65,7 @@
65
65
 
66
66
  // --- Constants. ---
67
67
 
68
+ #define TSI_SSL_MAX_BIO_WRITE_ATTEMPTS 100
68
69
  #define TSI_SSL_MAX_PROTECTED_FRAME_SIZE_UPPER_BOUND 16384
69
70
  #define TSI_SSL_MAX_PROTECTED_FRAME_SIZE_LOWER_BOUND 1024
70
71
  #define TSI_SSL_HANDSHAKER_OUTGOING_BUFFER_INITIAL_SIZE 1024
@@ -1538,15 +1539,35 @@ static tsi_result ssl_handshaker_next(tsi_handshaker* self,
1538
1539
  // If there are received bytes, process them first.
1539
1540
  tsi_ssl_handshaker* impl = reinterpret_cast<tsi_ssl_handshaker*>(self);
1540
1541
  tsi_result status = TSI_OK;
1541
- size_t bytes_consumed = received_bytes_size;
1542
1542
  size_t bytes_written = 0;
1543
1543
  if (received_bytes_size > 0) {
1544
- status = ssl_handshaker_process_bytes_from_peer(impl, received_bytes,
1545
- &bytes_consumed, error);
1546
- while (status == TSI_DRAIN_BUFFER) {
1547
- status = ssl_handshaker_write_output_buffer(self, &bytes_written, error);
1548
- if (status != TSI_OK) return status;
1549
- status = ssl_handshaker_do_handshake(impl, error);
1544
+ unsigned char* remaining_bytes_to_write_to_openssl =
1545
+ const_cast<unsigned char*>(received_bytes);
1546
+ size_t remaining_bytes_to_write_to_openssl_size = received_bytes_size;
1547
+ size_t number_bio_write_attempts = 0;
1548
+ while (remaining_bytes_to_write_to_openssl_size > 0 &&
1549
+ (status == TSI_OK || status == TSI_INCOMPLETE_DATA) &&
1550
+ number_bio_write_attempts < TSI_SSL_MAX_BIO_WRITE_ATTEMPTS) {
1551
+ ++number_bio_write_attempts;
1552
+ // Try to write all of the remaining bytes to the BIO.
1553
+ size_t bytes_written_to_openssl =
1554
+ remaining_bytes_to_write_to_openssl_size;
1555
+ status = ssl_handshaker_process_bytes_from_peer(
1556
+ impl, remaining_bytes_to_write_to_openssl, &bytes_written_to_openssl,
1557
+ error);
1558
+ // As long as the BIO is full, drive the SSL handshake to consume bytes
1559
+ // from the BIO. If the SSL handshake returns any bytes, write them to the
1560
+ // peer.
1561
+ while (status == TSI_DRAIN_BUFFER) {
1562
+ status =
1563
+ ssl_handshaker_write_output_buffer(self, &bytes_written, error);
1564
+ if (status != TSI_OK) return status;
1565
+ status = ssl_handshaker_do_handshake(impl, error);
1566
+ }
1567
+ // Move the pointer to the first byte not yet successfully written to the
1568
+ // BIO.
1569
+ remaining_bytes_to_write_to_openssl_size -= bytes_written_to_openssl;
1570
+ remaining_bytes_to_write_to_openssl += bytes_written_to_openssl;
1550
1571
  }
1551
1572
  }
1552
1573
  if (status != TSI_OK) return status;
@@ -1,28 +1,34 @@
1
+ # frozen_string_literal: true
1
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
3
  # source: math.proto
3
4
 
4
5
  require 'google/protobuf'
5
6
 
6
- Google::Protobuf::DescriptorPool.generated_pool.build do
7
- add_file("math.proto", :syntax => :proto3) do
8
- add_message "math.DivArgs" do
9
- optional :dividend, :int64, 1
10
- optional :divisor, :int64, 2
11
- end
12
- add_message "math.DivReply" do
13
- optional :quotient, :int64, 1
14
- optional :remainder, :int64, 2
15
- end
16
- add_message "math.FibArgs" do
17
- optional :limit, :int64, 1
18
- end
19
- add_message "math.Num" do
20
- optional :num, :int64, 1
21
- end
22
- add_message "math.FibReply" do
23
- optional :count, :int64, 1
7
+
8
+ descriptor_data = "\n\nmath.proto\x12\x04math\",\n\x07\x44ivArgs\x12\x10\n\x08\x64ividend\x18\x01 \x01(\x03\x12\x0f\n\x07\x64ivisor\x18\x02 \x01(\x03\"/\n\x08\x44ivReply\x12\x10\n\x08quotient\x18\x01 \x01(\x03\x12\x11\n\tremainder\x18\x02 \x01(\x03\"\x18\n\x07\x46ibArgs\x12\r\n\x05limit\x18\x01 \x01(\x03\"\x12\n\x03Num\x12\x0b\n\x03num\x18\x01 \x01(\x03\"\x19\n\x08\x46ibReply\x12\r\n\x05\x63ount\x18\x01 \x01(\x03\x32\xa4\x01\n\x04Math\x12&\n\x03\x44iv\x12\r.math.DivArgs\x1a\x0e.math.DivReply\"\x00\x12.\n\x07\x44ivMany\x12\r.math.DivArgs\x1a\x0e.math.DivReply\"\x00(\x01\x30\x01\x12#\n\x03\x46ib\x12\r.math.FibArgs\x1a\t.math.Num\"\x00\x30\x01\x12\x1f\n\x03Sum\x12\t.math.Num\x1a\t.math.Num\"\x00(\x01\x62\x06proto3"
9
+
10
+ pool = Google::Protobuf::DescriptorPool.generated_pool
11
+
12
+ begin
13
+ pool.add_serialized_file(descriptor_data)
14
+ rescue TypeError => e
15
+ # Compatibility code: will be removed in the next major version.
16
+ require 'google/protobuf/descriptor_pb'
17
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
18
+ parsed.clear_dependency
19
+ serialized = parsed.class.encode(parsed)
20
+ file = pool.add_serialized_file(serialized)
21
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
22
+ imports = [
23
+ ]
24
+ imports.each do |type_name, expected_filename|
25
+ import_file = pool.lookup(type_name).file_descriptor
26
+ if import_file.name != expected_filename
27
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
24
28
  end
25
29
  end
30
+ warn "Each proto file must use a consistent fully-qualified name."
31
+ warn "This will become an error in the next major version."
26
32
  end
27
33
 
28
34
  module Math
@@ -88,11 +88,15 @@ env_append 'CPPFLAGS', '-DGRPC_XDS_USER_AGENT_NAME_SUFFIX="\"RUBY\""'
88
88
 
89
89
  require_relative '../../lib/grpc/version'
90
90
  env_append 'CPPFLAGS', '-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX="\"' + GRPC::VERSION + '\""'
91
+ env_append 'CPPFLAGS', '-DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1'
91
92
 
92
93
  output_dir = File.expand_path(RbConfig::CONFIG['topdir'])
93
94
  grpc_lib_dir = File.join(output_dir, 'libs', grpc_config)
94
95
  ENV['BUILDDIR'] = output_dir
95
96
 
97
+ strip_tool = RbConfig::CONFIG['STRIP']
98
+ strip_tool += ' -x' if apple_toolchain
99
+
96
100
  unless windows
97
101
  puts 'Building internal gRPC into ' + grpc_lib_dir
98
102
  nproc = 4
@@ -107,6 +111,17 @@ unless windows
107
111
  puts "Building grpc native library: #{cmd}"
108
112
  system(cmd)
109
113
  exit 1 unless $? == 0
114
+
115
+ if grpc_config == 'opt'
116
+ rm_obj_cmd = "rm -rf #{File.join(output_dir, 'objs')}"
117
+ puts "Removing grpc object files: #{rm_obj_cmd}"
118
+ system(rm_obj_cmd)
119
+ exit 1 unless $? == 0
120
+ strip_cmd = "#{strip_tool} #{grpc_lib_dir}/*.a"
121
+ puts "Stripping grpc native library: #{strip_cmd}"
122
+ system(strip_cmd)
123
+ exit 1 unless $? == 0
124
+ end
110
125
  end
111
126
 
112
127
  $CFLAGS << ' -DGRPC_RUBY_WINDOWS_UCRT' if windows_ucrt
@@ -141,7 +156,10 @@ end
141
156
 
142
157
  ext_export_file = File.join(grpc_root, 'src', 'ruby', 'ext', 'grpc', ext_export_filename())
143
158
  $LDFLAGS << ' -Wl,--version-script="' + ext_export_file + '.gcc"' if linux
144
- $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"' if apple_toolchain
159
+ if apple_toolchain
160
+ $LDFLAGS << ' -weak_framework CoreFoundation' if RUBY_PLATFORM =~ /arm64/
161
+ $LDFLAGS << ' -Wl,-exported_symbols_list,"' + ext_export_file + '.clang"'
162
+ end
145
163
 
146
164
  $LDFLAGS << ' ' + File.join(grpc_lib_dir, 'libgrpc.a') unless windows
147
165
  if grpc_config == 'gcov'
@@ -169,23 +187,6 @@ output = File.join('grpc', 'grpc_c')
169
187
  puts 'Generating Makefile for ' + output
170
188
  create_makefile(output)
171
189
 
172
- strip_tool = RbConfig::CONFIG['STRIP']
173
- strip_tool += ' -x' if apple_toolchain
174
-
175
- if grpc_config == 'opt'
176
- File.open('Makefile.new', 'w') do |o|
177
- o.puts 'hijack: all strip'
178
- o.puts
179
- File.foreach('Makefile') do |i|
180
- o.puts i
181
- end
182
- o.puts
183
- o.puts 'strip: $(DLLIB)'
184
- o.puts "\t$(ECHO) Stripping $(DLLIB)"
185
- o.puts "\t$(Q) #{strip_tool} $(DLLIB)"
186
- end
187
- File.rename('Makefile.new', 'Makefile')
188
- end
189
190
  if ENV['GRPC_RUBY_TEST_ONLY_WORKAROUND_MAKE_INSTALL_BUG']
190
191
  # Note: this env var setting is intended to work around a problem observed
191
192
  # with the ginstall command on grpc's macos automated test infrastructure,