grpc 1.83.1 → 1.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +21 -17
  3. data/include/grpc/credentials.h +10 -0
  4. data/include/grpc/grpc_security_constants.h +2 -0
  5. data/include/grpc/impl/channel_arg_names.h +9 -0
  6. data/src/core/call/call_filters.h +4 -2
  7. data/src/core/call/client_call.cc +20 -8
  8. data/src/core/call/client_call.h +4 -0
  9. data/src/core/call/interception_chain.cc +2 -0
  10. data/src/core/call/interception_chain.h +14 -1
  11. data/src/core/call/metadata.cc +1 -3
  12. data/src/core/call/metadata_batch.h +13 -5
  13. data/src/core/call/server_call.cc +31 -14
  14. data/src/core/call/server_call.h +4 -0
  15. data/src/core/channelz/text_encode.cc +9 -4
  16. data/src/core/channelz/v2tov1/convert.cc +2 -2
  17. data/src/core/client_channel/backup_poller.cc +1 -2
  18. data/src/core/client_channel/client_channel.cc +6 -33
  19. data/src/core/client_channel/client_channel_filter.cc +22 -55
  20. data/src/core/client_channel/client_channel_filter.h +2 -2
  21. data/src/core/client_channel/client_channel_service_config.cc +3 -19
  22. data/src/core/client_channel/direct_channel.cc +7 -1
  23. data/src/core/client_channel/direct_channel.h +2 -2
  24. data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
  25. data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
  26. data/src/core/client_channel/subchannel.cc +310 -1058
  27. data/src/core/client_channel/subchannel.h +44 -329
  28. data/src/core/client_channel/subchannel_metrics.cc +48 -0
  29. data/src/core/client_channel/subchannel_metrics.h +60 -0
  30. data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
  31. data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
  32. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
  33. data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
  34. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
  35. data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
  36. data/src/core/credentials/call/json_util.h +1 -0
  37. data/src/core/credentials/call/jwt/json_token.cc +10 -2
  38. data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
  39. data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
  40. data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
  41. data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
  42. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
  43. data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
  44. data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
  45. data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
  46. data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
  47. data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
  48. data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
  49. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
  50. data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
  51. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
  52. data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
  53. data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
  54. data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
  55. data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
  56. data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
  57. data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
  58. data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
  59. data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
  60. data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
  61. data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
  62. data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
  63. data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
  64. data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
  65. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
  66. data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
  67. data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
  68. data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
  69. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
  70. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
  71. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
  72. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +32 -67
  73. data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
  74. data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
  75. data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
  76. data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -4
  77. data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
  78. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
  79. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
  80. data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
  81. data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
  82. data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
  83. data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
  84. data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
  85. data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
  86. data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
  87. data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
  88. data/src/core/ext/transport/chttp2/transport/parsing.cc +5 -5
  89. data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
  90. data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
  91. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
  92. data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
  93. data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
  94. data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
  95. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
  96. data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
  97. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
  98. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
  99. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
  100. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
  101. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
  102. data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
  103. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
  104. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
  105. data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
  106. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
  107. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
  108. data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
  109. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
  110. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
  111. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
  112. data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
  113. data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
  114. data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
  115. data/src/core/filter/auth/server_auth_filter.cc +2 -3
  116. data/src/core/filter/composite/composite_filter.cc +45 -33
  117. data/src/core/filter/composite/composite_filter.h +5 -4
  118. data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
  119. data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
  120. data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
  121. data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
  122. data/src/core/filter/filter_args.h +13 -2
  123. data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
  124. data/src/core/handshaker/security/security_handshaker.cc +9 -6
  125. data/src/core/lib/channel/channel_stack.cc +3 -0
  126. data/src/core/lib/channel/channel_stack.h +2 -0
  127. data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
  128. data/src/core/lib/channel/promise_based_filter.cc +132 -20
  129. data/src/core/lib/channel/promise_based_filter.h +42 -12
  130. data/src/core/lib/compression/compression_internal.cc +4 -5
  131. data/src/core/lib/debug/trace_flags.cc +8 -0
  132. data/src/core/lib/debug/trace_flags.h +3 -0
  133. data/src/core/lib/event_engine/ares_resolver.cc +54 -50
  134. data/src/core/lib/event_engine/ares_resolver.h +3 -2
  135. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
  136. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
  137. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
  138. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
  139. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
  140. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
  141. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
  142. data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
  143. data/src/core/lib/experiments/experiments.cc +60 -96
  144. data/src/core/lib/experiments/experiments.h +34 -50
  145. data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
  146. data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
  147. data/src/core/lib/iomgr/error.cc +2 -6
  148. data/src/core/lib/iomgr/error_cfstream.cc +1 -1
  149. data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
  150. data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
  151. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
  152. data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
  153. data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
  154. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
  155. data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
  156. data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
  157. data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
  158. data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
  159. data/src/core/lib/iomgr/systemd_utils.cc +0 -1
  160. data/src/core/lib/iomgr/tcp_client.h +1 -1
  161. data/src/core/lib/iomgr/tcp_posix.cc +23 -15
  162. data/src/core/lib/iomgr/tcp_server.h +1 -1
  163. data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
  164. data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
  165. data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
  166. data/src/core/lib/iomgr/tcp_windows.cc +5 -10
  167. data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
  168. data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
  169. data/src/core/lib/iomgr/vsock.h +3 -1
  170. data/src/core/lib/resource_quota/memory_quota.cc +1 -1
  171. data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
  172. data/src/core/lib/security/authorization/rbac_policy.h +21 -3
  173. data/src/core/lib/surface/call.cc +3 -9
  174. data/src/core/lib/surface/call_utils.h +113 -0
  175. data/src/core/lib/surface/channel_create.cc +1 -1
  176. data/src/core/lib/surface/channel_create.h +0 -2
  177. data/src/core/lib/surface/channel_init.cc +77 -38
  178. data/src/core/lib/surface/channel_init.h +30 -16
  179. data/src/core/lib/surface/filter_stack_call.cc +5 -10
  180. data/src/core/lib/surface/init.cc +13 -27
  181. data/src/core/lib/surface/version.cc +1 -1
  182. data/src/core/lib/transport/error_utils.cc +0 -27
  183. data/src/core/lib/transport/error_utils.h +0 -16
  184. data/src/core/lib/transport/transport.h +7 -5
  185. data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
  186. data/src/core/load_balancing/rls/rls.cc +28 -11
  187. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
  188. data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
  189. data/src/core/load_balancing/xds/cds.cc +3 -1
  190. data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
  191. data/src/core/mitigation_engine/mitigation.h +14 -5
  192. data/src/core/mitigation_engine/mitigation_engine.h +7 -3
  193. data/src/core/mitigation_engine/mitigation_provider.h +2 -1
  194. data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
  195. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
  196. data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
  197. data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
  198. data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
  199. data/src/core/resolver/endpoint_addresses.h +3 -0
  200. data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
  201. data/src/core/resolver/xds/xds_resolver.cc +35 -9
  202. data/src/core/server/server.cc +2 -6
  203. data/src/core/server/server_config_selector.h +18 -3
  204. data/src/core/server/server_config_selector_filter.cc +178 -91
  205. data/src/core/server/server_config_selector_filter.h +58 -3
  206. data/src/core/server/xds_server_config_fetcher.cc +196 -129
  207. data/src/core/server/xds_server_config_fetcher.h +49 -0
  208. data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
  209. data/src/core/telemetry/histogram.h +94 -14
  210. data/src/core/telemetry/instrument.cc +179 -74
  211. data/src/core/telemetry/instrument.h +78 -30
  212. data/src/core/telemetry/metrics.h +5 -0
  213. data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
  214. data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
  215. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
  216. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
  217. data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
  218. data/src/core/tsi/ssl_telemetry_utils.h +12 -2
  219. data/src/core/tsi/ssl_transport_security.cc +238 -80
  220. data/src/core/tsi/ssl_transport_security.h +63 -33
  221. data/src/core/tsi/tls_telemetry.cc +31 -0
  222. data/src/core/tsi/tls_telemetry.h +47 -0
  223. data/src/core/tsi/transport_security.cc +2 -2
  224. data/src/core/tsi/transport_security.h +1 -1
  225. data/src/core/tsi/transport_security_interface.h +1 -1
  226. data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
  227. data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
  228. data/src/core/util/http_client/httpcli.cc +16 -53
  229. data/src/core/util/http_client/httpcli.h +0 -7
  230. data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
  231. data/src/core/util/linux/cpu.cc +1 -1
  232. data/src/core/util/load_file.cc +3 -9
  233. data/src/core/util/load_file.h +3 -4
  234. data/src/core/util/matchers.h +8 -0
  235. data/src/core/util/posix/cpu.cc +1 -1
  236. data/src/core/util/status_helper.cc +0 -20
  237. data/src/core/util/status_helper.h +3 -14
  238. data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
  239. data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
  240. data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
  241. data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
  242. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
  243. data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
  244. data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
  245. data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
  246. data/src/core/xds/grpc/xds_client_grpc.h +0 -4
  247. data/src/core/xds/grpc/xds_cluster.h +1 -0
  248. data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
  249. data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
  250. data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
  251. data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
  252. data/src/core/xds/grpc/xds_common_types.cc +0 -91
  253. data/src/core/xds/grpc/xds_common_types.h +1 -47
  254. data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
  255. data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
  256. data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
  257. data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
  258. data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
  259. data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
  260. data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
  261. data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
  262. data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
  263. data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
  264. data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
  265. data/src/core/xds/grpc/xds_http_filter.cc +2 -1
  266. data/src/core/xds/grpc/xds_http_filter.h +6 -5
  267. data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
  268. data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
  269. data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
  270. data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
  271. data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
  272. data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
  273. data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
  274. data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
  275. data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
  276. data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
  277. data/src/core/xds/grpc/xds_listener.cc +2 -0
  278. data/src/core/xds/grpc/xds_listener.h +5 -0
  279. data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
  280. data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
  281. data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
  282. data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
  283. data/src/core/xds/grpc/xds_route_config.cc +2 -0
  284. data/src/core/xds/grpc/xds_route_config.h +3 -1
  285. data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
  286. data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
  287. data/src/core/xds/grpc/xds_routing.cc +116 -69
  288. data/src/core/xds/grpc/xds_routing.h +19 -8
  289. data/src/core/xds/grpc/xds_tls_context.cc +117 -0
  290. data/src/core/xds/grpc/xds_tls_context.h +76 -0
  291. data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
  292. data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
  293. data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
  294. data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
  295. data/src/ruby/ext/grpc/rb_call.c +26 -15
  296. data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
  297. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  298. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  299. data/src/ruby/lib/grpc/version.rb +1 -1
  300. data/src/ruby/pb/test/client.rb +5 -4
  301. data/src/ruby/spec/call_spec.rb +14 -0
  302. data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
  303. metadata +50 -35
  304. data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
  305. data/src/core/lib/iomgr/resolve_address.cc +0 -59
  306. data/src/core/lib/iomgr/resolve_address.h +0 -125
  307. data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
  308. data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
  309. data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
  310. data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
  311. data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
  312. data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
  313. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
  314. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
  315. data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
  316. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
  317. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
  318. data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
  319. data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
  320. data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
  321. data/src/core/util/json/json_util.cc +0 -101
  322. data/src/core/util/json/json_util.h +0 -163
@@ -63,9 +63,6 @@
63
63
 
64
64
  namespace tsi {
65
65
  using RootCertInfo = std::variant<std::string, grpc_core::SpiffeBundleMap>;
66
-
67
- using PrivateKey =
68
- std::variant<std::string, std::shared_ptr<grpc_core::PrivateKeySigner>>;
69
66
  } // namespace tsi
70
67
 
71
68
  // --- tsi_ssl_root_certs_store object ---
@@ -74,10 +71,10 @@ using PrivateKey =
74
71
  // context.
75
72
  typedef struct tsi_ssl_root_certs_store tsi_ssl_root_certs_store;
76
73
 
77
- // Given a NULL-terminated string containing the PEM encoding of the root
78
- // certificates, creates a tsi_ssl_root_certs_store object.
74
+ // Given a string containing the PEM encoding of the root certificates,
75
+ // creates a tsi_ssl_root_certs_store object.
79
76
  tsi_ssl_root_certs_store* tsi_ssl_root_certs_store_create(
80
- const char* pem_roots);
77
+ absl::string_view pem_roots);
81
78
 
82
79
  // Destroys the tsi_ssl_root_certs_store object.
83
80
  void tsi_ssl_root_certs_store_destroy(tsi_ssl_root_certs_store* self);
@@ -119,19 +116,54 @@ typedef struct tsi_ssl_client_handshaker_factory
119
116
  tsi_ssl_client_handshaker_factory;
120
117
 
121
118
  // Object that holds a private key / certificate chain pair in PEM format.
122
- struct tsi_ssl_pem_key_cert_pair {
123
- // private_key is either the string containing the PEM encoding of
124
- // the client's private key or an implementation of PrivateKeySigner.
125
- tsi::PrivateKey private_key;
126
-
127
- // cert_chain is the string containing the PEM encoding of
128
- // the client's certificate chain.
129
- std::string cert_chain;
130
-
131
- tsi_ssl_pem_key_cert_pair() = default;
132
- tsi_ssl_pem_key_cert_pair(tsi::PrivateKey pk, std::string cert_chain_pem)
133
- : private_key(std::move(pk)), cert_chain(std::move(cert_chain_pem)) {}
119
+ namespace grpc_core {
120
+
121
+ using PrivateKey = std::variant<std::string, std::shared_ptr<PrivateKeySigner>>;
122
+
123
+ class PemKeyCertPair {
124
+ public:
125
+ PemKeyCertPair() = default;
126
+ PemKeyCertPair(PrivateKey private_key, absl::string_view cert_chain)
127
+ : private_key_(std::move(private_key)), cert_chain_(cert_chain) {}
128
+
129
+ // Movable.
130
+ PemKeyCertPair(PemKeyCertPair&& other) noexcept {
131
+ private_key_ = std::move(other.private_key_);
132
+ cert_chain_ = std::move(other.cert_chain_);
133
+ }
134
+ PemKeyCertPair& operator=(PemKeyCertPair&& other) noexcept {
135
+ private_key_ = std::move(other.private_key_);
136
+ cert_chain_ = std::move(other.cert_chain_);
137
+ return *this;
138
+ }
139
+
140
+ // Copyable.
141
+ PemKeyCertPair(const PemKeyCertPair& other)
142
+ : private_key_(other.private_key()), cert_chain_(other.cert_chain()) {}
143
+ PemKeyCertPair& operator=(const PemKeyCertPair& other) {
144
+ private_key_ = other.private_key();
145
+ cert_chain_ = other.cert_chain();
146
+ return *this;
147
+ }
148
+
149
+ bool operator==(const PemKeyCertPair& other) const {
150
+ return this->private_key() == other.private_key() &&
151
+ this->cert_chain() == other.cert_chain();
152
+ }
153
+
154
+ const PrivateKey& private_key() const { return private_key_; }
155
+ const std::string& cert_chain() const { return cert_chain_; }
156
+
157
+ private:
158
+ PrivateKey private_key_;
159
+ std::string cert_chain_;
134
160
  };
161
+
162
+ using PemKeyCertPairList = std::vector<PemKeyCertPair>;
163
+ using KeyCertPairsOrSelector =
164
+ std::variant<PemKeyCertPairList, std::shared_ptr<CertificateSelector>>;
165
+
166
+ } // namespace grpc_core
135
167
  // TO BE DEPRECATED.
136
168
  // Creates a client handshaker factory.
137
169
  // - pem_key_cert_pair is a pointer to the object containing client's private
@@ -154,7 +186,7 @@ struct tsi_ssl_pem_key_cert_pair {
154
186
  // - This method returns TSI_OK on success or TSI_INVALID_PARAMETER in the case
155
187
  // where a parameter is invalid.
156
188
  tsi_result tsi_create_ssl_client_handshaker_factory(
157
- const tsi_ssl_pem_key_cert_pair* pem_key_cert_pair,
189
+ const grpc_core::PemKeyCertPair* pem_key_cert_pair,
158
190
  const char* pem_root_certs, const char* cipher_suites,
159
191
  const char** alpn_protocols, uint16_t num_alpn_protocols,
160
192
  tsi_ssl_client_handshaker_factory** factory);
@@ -163,7 +195,7 @@ struct tsi_ssl_client_handshaker_options {
163
195
  // pem_key_cert_pair is a pointer to the object containing client's private
164
196
  // key and certificate chain. This parameter can be NULL if the client does
165
197
  // not have such a key/cert pair.
166
- const tsi_ssl_pem_key_cert_pair* pem_key_cert_pair;
198
+ const grpc_core::PemKeyCertPair* pem_key_cert_pair;
167
199
  // root_store is a pointer to the ssl_root_certs_store object. If root_store
168
200
  // is not nullptr and SSL implementation permits, root_store will be used as
169
201
  // root certificates. Otherwise, pem_roots_cert will be used to load server
@@ -263,6 +295,7 @@ tsi_result tsi_ssl_client_handshaker_factory_create_handshaker(
263
295
  size_t ssl_bio_buf_size,
264
296
  std::optional<std::string> alpn_preferred_protocol_list,
265
297
  grpc_core::RefCountedPtr<grpc_core::CollectionScope> collection_scope,
298
+ std::string target, std::string locality, std::string backend_service,
266
299
  tsi_handshaker** handshaker);
267
300
 
268
301
  // Increments reference count of the client handshaker factory.
@@ -282,14 +315,10 @@ void tsi_ssl_client_handshaker_factory_unref(
282
315
  typedef struct tsi_ssl_server_handshaker_factory
283
316
  tsi_ssl_server_handshaker_factory;
284
317
 
285
- typedef std::variant<std::vector<tsi_ssl_pem_key_cert_pair>,
286
- std::shared_ptr<grpc_core::CertificateSelector>>
287
- tsi_ssl_key_cert_pairs;
288
-
289
318
  // TO BE DEPRECATED.
290
319
  // Creates a server handshaker factory.
291
- // - pem_key_cert_pairs is an array private key / certificate chains of the
292
- // server.
320
+ // - key_cert_pairs_or_selector is an array private key / certificate chains of
321
+ // the server.
293
322
  // - pem_root_certs is the NULL-terminated string containing the PEM encoding
294
323
  // of the client root certificates. This parameter may be NULL if the server
295
324
  // does not want the client to be authenticated with SSL.
@@ -308,7 +337,7 @@ typedef std::variant<std::vector<tsi_ssl_pem_key_cert_pair>,
308
337
  // - This method returns TSI_OK on success or TSI_INVALID_PARAMETER in the case
309
338
  // where a parameter is invalid.
310
339
  tsi_result tsi_create_ssl_server_handshaker_factory(
311
- tsi_ssl_key_cert_pairs pem_key_cert_pairs,
340
+ grpc_core::KeyCertPairsOrSelector key_cert_pairs_or_selector,
312
341
  const char* pem_client_root_certs, int force_client_auth,
313
342
  const char* cipher_suites, const char** alpn_protocols,
314
343
  uint16_t num_alpn_protocols, tsi_ssl_server_handshaker_factory** factory);
@@ -321,17 +350,18 @@ tsi_result tsi_create_ssl_server_handshaker_factory(
321
350
  // authenticate with an SSL cert. Note that this option is ignored if
322
351
  // pem_client_root_certs is NULL or pem_client_roots_certs_size is 0
323
352
  tsi_result tsi_create_ssl_server_handshaker_factory_ex(
324
- tsi_ssl_key_cert_pairs pem_key_cert, const char* pem_client_root_certs,
353
+ grpc_core::KeyCertPairsOrSelector key_cert_pairs_or_selector,
354
+ const char* pem_client_root_certs,
325
355
  tsi_client_certificate_request_type client_certificate_request,
326
356
  const char* cipher_suites, const char** alpn_protocols,
327
357
  uint16_t num_alpn_protocols, tsi_ssl_server_handshaker_factory** factory);
328
358
 
329
359
  struct tsi_ssl_server_handshaker_options {
330
- // pem_key_cert_pairs is an array private key / certificate chains of the
331
- // server, or a certificate selector. The array of key / certificate chains is
332
- // to support SNI. The certificate selector will be in charge of this. So they
333
- // are mutually exclusive.
334
- tsi_ssl_key_cert_pairs pem_key_cert_pairs;
360
+ // key_cert_pairs_or_selector is an array of pem private key / certificate
361
+ // chains of the server, or a certificate selector. The array of key /
362
+ // certificate chains is to support SNI. The certificate selector will be in
363
+ // charge of this. So they are mutually exclusive.
364
+ grpc_core::KeyCertPairsOrSelector key_cert_pairs_or_selector;
335
365
  // client_certificate_request, if set to non-zero will force the client to
336
366
  // authenticate with an SSL cert. Note that this option is ignored if
337
367
  // root_cert_info is NULL
@@ -0,0 +1,31 @@
1
+ // Copyright 2026 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #include "src/core/tsi/tls_telemetry.h"
16
+
17
+ #include "src/core/telemetry/instrument.h"
18
+
19
+ namespace grpc_core {
20
+
21
+ TlsClientHandshakeTelemetryDomain::CounterHandle
22
+ TlsClientHandshakeTelemetryDomain::kHandshakes = RegisterCounter(
23
+ "grpc.client.tls.handshakes",
24
+ "Total number of client-side TLS handshakes", "{handshake}");
25
+
26
+ TlsServerHandshakeTelemetryDomain::CounterHandle
27
+ TlsServerHandshakeTelemetryDomain::kHandshakes = RegisterCounter(
28
+ "grpc.server.tls.handshakes",
29
+ "Total number of server-side TLS handshakes", "{handshake}");
30
+
31
+ } // namespace grpc_core
@@ -0,0 +1,47 @@
1
+ // Copyright 2026 gRPC authors.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ #ifndef GRPC_SRC_CORE_TSI_TLS_TELEMETRY_H
16
+ #define GRPC_SRC_CORE_TSI_TLS_TELEMETRY_H
17
+
18
+ #include "src/core/telemetry/instrument.h"
19
+
20
+ namespace grpc_core {
21
+
22
+ class TlsClientHandshakeTelemetryDomain final
23
+ : public InstrumentDomain<TlsClientHandshakeTelemetryDomain> {
24
+ public:
25
+ GRPC_INSTRUMENT_DOMAIN_LABELS("grpc.tls.handshake.result", "grpc.target",
26
+ "grpc.tls.handshake.resumed",
27
+ "grpc.lb.locality", "grpc.lb.backend_service");
28
+ using Backend = LowContentionBackend;
29
+ static constexpr absl::string_view kName = "tls_client_security_handshaker";
30
+
31
+ static CounterHandle kHandshakes;
32
+ };
33
+
34
+ class TlsServerHandshakeTelemetryDomain final
35
+ : public InstrumentDomain<TlsServerHandshakeTelemetryDomain> {
36
+ public:
37
+ GRPC_INSTRUMENT_DOMAIN_LABELS("grpc.tls.handshake.result",
38
+ "grpc.tls.handshake.resumed");
39
+ using Backend = LowContentionBackend;
40
+ static constexpr absl::string_view kName = "tls_server_security_handshaker";
41
+
42
+ static CounterHandle kHandshakes;
43
+ };
44
+
45
+ } // namespace grpc_core
46
+
47
+ #endif // GRPC_SRC_CORE_TSI_TLS_TELEMETRY_H
@@ -232,10 +232,10 @@ tsi_result tsi_handshaker_next(
232
232
  handshaker_result, cb, user_data, error);
233
233
  }
234
234
 
235
- void tsi_handshaker_shutdown(tsi_handshaker* self) {
235
+ void tsi_handshaker_shutdown(tsi_handshaker* self, bool peer_closed) {
236
236
  if (self == nullptr || self->vtable == nullptr) return;
237
237
  if (self->vtable->shutdown != nullptr) {
238
- self->vtable->shutdown(self);
238
+ self->vtable->shutdown(self, peer_closed);
239
239
  }
240
240
  self->handshake_shutdown = true;
241
241
  }
@@ -80,7 +80,7 @@ struct tsi_handshaker_vtable {
80
80
  tsi_handshaker_result** handshaker_result,
81
81
  tsi_handshaker_on_next_done_cb cb, void* user_data,
82
82
  std::string* error);
83
- void (*shutdown)(tsi_handshaker* self);
83
+ void (*shutdown)(tsi_handshaker* self, bool peer_closed);
84
84
  };
85
85
  struct tsi_handshaker {
86
86
  tsi_handshaker() = default;
@@ -505,7 +505,7 @@ tsi_result tsi_handshaker_next(tsi_handshaker* self,
505
505
  // This method will be invoked when TSI handshake should be terminated before
506
506
  // being finished in order to free any resources being used.
507
507
  //
508
- void tsi_handshaker_shutdown(tsi_handshaker* self);
508
+ void tsi_handshaker_shutdown(tsi_handshaker* self, bool peer_closed = false);
509
509
 
510
510
  // This method releases the tsi_handshaker object. After this method is called,
511
511
  // no other method can be called on the object.
@@ -1,4 +1,6 @@
1
- // Copyright 2022 The gRPC Authors
1
+ //
2
+ //
3
+ // Copyright 2026 gRPC authors.
2
4
  //
3
5
  // Licensed under the Apache License, Version 2.0 (the "License");
4
6
  // you may not use this file except in compliance with the License.
@@ -11,14 +13,25 @@
11
13
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
14
  // See the License for the specific language governing permissions and
13
15
  // limitations under the License.
14
- #ifndef GRPC_SRC_CORE_RESOLVER_DNS_NATIVE_DNS_RESOLVER_H
15
- #define GRPC_SRC_CORE_RESOLVER_DNS_NATIVE_DNS_RESOLVER_H
16
- #include <grpc/support/port_platform.h>
16
+ //
17
+ //
18
+
19
+ #include "src/core/util/address_sorting_init.h"
20
+
21
+ #include <address_sorting/address_sorting.h>
17
22
 
18
- #include "src/core/config/core_configuration.h"
23
+ #include "absl/base/call_once.h"
19
24
 
20
25
  namespace grpc_core {
21
- void RegisterNativeDnsResolver(CoreConfiguration::Builder* builder);
22
- } // namespace grpc_core
23
26
 
24
- #endif // GRPC_SRC_CORE_RESOLVER_DNS_NATIVE_DNS_RESOLVER_H
27
+ namespace {
28
+
29
+ absl::once_flag init_flag;
30
+
31
+ } // namespace
32
+
33
+ void AddressSortingInitOnce() {
34
+ absl::call_once(init_flag, []() { address_sorting_init(); });
35
+ }
36
+
37
+ } // namespace grpc_core
@@ -1,6 +1,6 @@
1
1
  //
2
2
  //
3
- // Copyright 2016 gRPC authors.
3
+ // Copyright 2026 gRPC authors.
4
4
  //
5
5
  // Licensed under the Apache License, Version 2.0 (the "License");
6
6
  // you may not use this file except in compliance with the License.
@@ -16,14 +16,13 @@
16
16
  //
17
17
  //
18
18
 
19
- #include <grpc/support/port_platform.h>
19
+ #ifndef GRPC_SRC_CORE_UTIL_ADDRESS_SORTING_INIT_H
20
+ #define GRPC_SRC_CORE_UTIL_ADDRESS_SORTING_INIT_H
20
21
 
21
- #include "src/core/lib/iomgr/port.h"
22
- #if GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET_ARES_EV_DRIVER)
22
+ namespace grpc_core {
23
23
 
24
- #include "src/core/lib/iomgr/socket_utils_posix.h"
25
- #include "src/core/resolver/dns/c_ares/grpc_ares_wrapper.h"
24
+ void AddressSortingInitOnce();
26
25
 
27
- bool grpc_ares_query_ipv6() { return grpc_ipv6_loopback_available(); }
26
+ } // namespace grpc_core
28
27
 
29
- #endif // GRPC_ARES == 1 && defined(GRPC_POSIX_SOCKET_ARES_EV_DRIVER)
28
+ #endif // GRPC_SRC_CORE_UTIL_ADDRESS_SORTING_INIT_H
@@ -41,7 +41,6 @@
41
41
  #include "src/core/lib/iomgr/endpoint.h"
42
42
  #include "src/core/lib/iomgr/iomgr_internal.h"
43
43
  #include "src/core/lib/iomgr/pollset_set.h"
44
- #include "src/core/lib/iomgr/resolve_address.h"
45
44
  #include "src/core/lib/resource_quota/api.h"
46
45
  #include "src/core/lib/slice/slice.h"
47
46
  #include "src/core/lib/transport/error_utils.h"
@@ -176,15 +175,10 @@ HttpRequest::HttpRequest(
176
175
  pollent_(pollent),
177
176
  pollset_set_(grpc_pollset_set_create()),
178
177
  test_only_generate_response_(std::move(test_only_generate_response)),
179
- use_event_engine_dns_resolver_(IsEventEngineDnsNonClientChannelEnabled()),
180
- resolver_(!use_event_engine_dns_resolver_ ? GetDNSResolver() : nullptr),
181
178
  ee_resolver_(
182
- use_event_engine_dns_resolver_
183
- ? ChannelArgs::FromC(channel_args_)
184
- .GetObjectRef<EventEngine>()
185
- ->GetDNSResolver(
186
- EventEngine::DNSResolver::ResolverOptions())
187
- : absl::InternalError("EventEngine DNS is not enabled")) {
179
+ ChannelArgs::FromC(channel_args_)
180
+ .GetObjectRef<EventEngine>()
181
+ ->GetDNSResolver(EventEngine::DNSResolver::ResolverOptions())) {
188
182
  grpc_http_parser_init(&parser_, GRPC_HTTP_RESPONSE, response);
189
183
  grpc_slice_buffer_init(&incoming_);
190
184
  grpc_slice_buffer_init(&outgoing_);
@@ -219,38 +213,19 @@ void HttpRequest::Start() {
219
213
  if (test_only_generate_response_.has_value()) {
220
214
  if (test_only_generate_response_.value()()) return;
221
215
  }
222
- if (use_event_engine_dns_resolver_ && !ee_resolver_.ok()) {
216
+ if (!ee_resolver_.ok()) {
223
217
  Finish(ee_resolver_.status());
224
218
  return;
225
219
  }
226
220
  Ref().release(); // ref held by pending DNS resolution
227
- if (use_event_engine_dns_resolver_) {
228
- (*ee_resolver_)
229
- ->LookupHostname(
230
- [this](absl::StatusOr<std::vector<EventEngine::ResolvedAddress>>
231
- addresses_or) {
232
- ExecCtx exec_ctx;
233
- OnResolved(addresses_or);
234
- },
235
- uri_.authority(), uri_.scheme());
236
- } else {
237
- dns_request_handle_ = resolver_->LookupHostname(
238
- [this](absl::StatusOr<std::vector<grpc_resolved_address>> addresses) {
239
- if (addresses.ok()) {
240
- std::vector<EventEngine::ResolvedAddress> ee_addresses;
241
- for (const auto& addr : *addresses) {
242
- ee_addresses.push_back(
243
- grpc_event_engine::experimental::CreateResolvedAddress(addr));
244
- }
245
- OnResolved(ee_addresses);
246
- } else {
247
- OnResolved(addresses.status());
248
- }
249
- },
250
- uri_.authority(), uri_.scheme(), kDefaultDNSRequestTimeout,
251
- pollset_set_,
252
- /*name_server=*/"");
253
- }
221
+ (*ee_resolver_)
222
+ ->LookupHostname(
223
+ [this](absl::StatusOr<std::vector<EventEngine::ResolvedAddress>>
224
+ addresses_or) {
225
+ ExecCtx exec_ctx;
226
+ OnResolved(addresses_or);
227
+ },
228
+ uri_.authority(), uri_.scheme());
254
229
  }
255
230
 
256
231
  void HttpRequest::Orphan() {
@@ -259,16 +234,8 @@ void HttpRequest::Orphan() {
259
234
  GRPC_CHECK(!cancelled_);
260
235
  cancelled_ = true;
261
236
  // cancel potentially pending DNS resolution.
262
- if (use_event_engine_dns_resolver_) {
263
- if (*ee_resolver_ != nullptr) {
264
- ee_resolver_->reset();
265
- }
266
- } else {
267
- if (dns_request_handle_.has_value() &&
268
- resolver_->Cancel(dns_request_handle_.value())) {
269
- Finish(GRPC_ERROR_CREATE("cancelled during DNS resolution"));
270
- Unref();
271
- }
237
+ if (*ee_resolver_ != nullptr) {
238
+ ee_resolver_->reset();
272
239
  }
273
240
  if (handshake_mgr_ != nullptr) {
274
241
  // Shutdown will cancel any ongoing tcp connect.
@@ -410,17 +377,13 @@ void HttpRequest::OnResolved(
410
377
  absl::StatusOr<std::vector<EventEngine::ResolvedAddress>> addresses_or) {
411
378
  RefCountedPtr<HttpRequest> unreffer(this);
412
379
  MutexLock lock(&mu_);
413
- if (use_event_engine_dns_resolver_) {
414
- ee_resolver_->reset();
415
- } else {
416
- dns_request_handle_.reset();
417
- }
380
+ ee_resolver_->reset();
418
381
  if (cancelled_) {
419
382
  Finish(GRPC_ERROR_CREATE("cancelled during DNS resolution"));
420
383
  return;
421
384
  }
422
385
  if (!addresses_or.ok()) {
423
- Finish(absl_status_to_grpc_error(addresses_or.status()));
386
+ Finish(addresses_or.status());
424
387
  return;
425
388
  }
426
389
  addresses_ = std::move(*addresses_or);
@@ -39,7 +39,6 @@
39
39
  #include "src/core/lib/iomgr/iomgr_fwd.h"
40
40
  #include "src/core/lib/iomgr/iomgr_internal.h"
41
41
  #include "src/core/lib/iomgr/polling_entity.h"
42
- #include "src/core/lib/iomgr/resolve_address.h"
43
42
  #include "src/core/lib/resource_quota/resource_quota.h"
44
43
  #include "src/core/util/debug_location.h"
45
44
  #include "src/core/util/http_client/parser.h"
@@ -266,12 +265,6 @@ class HttpRequest : public InternallyRefCounted<HttpRequest> {
266
265
  grpc_slice_buffer incoming_ ABSL_GUARDED_BY(mu_);
267
266
  grpc_slice_buffer outgoing_ ABSL_GUARDED_BY(mu_);
268
267
  grpc_error_handle overall_error_ ABSL_GUARDED_BY(mu_) = absl::OkStatus();
269
- // TODO(yijiem): remove these once event_engine_dns_non_client_channel
270
- // experiment is fully enabled.
271
- bool use_event_engine_dns_resolver_;
272
- std::shared_ptr<DNSResolver> resolver_;
273
- std::optional<DNSResolver::TaskHandle> dns_request_handle_
274
- ABSL_GUARDED_BY(mu_) = DNSResolver::kNullHandle;
275
268
  absl::StatusOr<std::unique_ptr<
276
269
  grpc_event_engine::experimental::EventEngine::DNSResolver>>
277
270
  ee_resolver_;
@@ -74,12 +74,12 @@ class grpc_httpcli_ssl_channel_security_connector final
74
74
  }
75
75
  }
76
76
 
77
- tsi_result InitHandshakerFactory(const char* pem_root_certs,
77
+ tsi_result InitHandshakerFactory(absl::string_view pem_root_certs,
78
78
  const tsi_ssl_root_certs_store* root_store) {
79
79
  tsi_ssl_client_handshaker_options options;
80
- if (pem_root_certs != nullptr) {
80
+ if (!pem_root_certs.empty()) {
81
81
  options.root_cert_info =
82
- std::make_shared<tsi::RootCertInfo>(pem_root_certs);
82
+ std::make_shared<tsi::RootCertInfo>(std::string(pem_root_certs));
83
83
  }
84
84
  options.root_store = root_store;
85
85
  return tsi_create_ssl_client_handshaker_factory_with_options(
@@ -95,7 +95,8 @@ class grpc_httpcli_ssl_channel_security_connector final
95
95
  handshaker_factory_, secure_peer_name_, /*network_bio_buf_size=*/0,
96
96
  /*ssl_bio_buf_size=*/0,
97
97
  args.GetOwnedString(GRPC_ARG_TRANSPORT_PROTOCOLS),
98
- /*collection_scope=*/nullptr, &handshaker);
98
+ /*collection_scope=*/nullptr, /*target=*/secure_peer_name_,
99
+ /*locality=*/"", /*backend_service=*/"", &handshaker);
99
100
  if (result != TSI_OK) {
100
101
  LOG(ERROR) << "Handshaker creation failed with error "
101
102
  << tsi_result_to_string(result);
@@ -139,6 +140,10 @@ class grpc_httpcli_ssl_channel_security_connector final
139
140
  return ImmediateOkStatus();
140
141
  }
141
142
 
143
+ UniqueTypeName type() const override {
144
+ return GRPC_UNIQUE_TYPE_NAME_HERE("httpcli_ssl");
145
+ }
146
+
142
147
  const char* secure_peer_name() const { return secure_peer_name_; }
143
148
 
144
149
  private:
@@ -148,9 +153,9 @@ class grpc_httpcli_ssl_channel_security_connector final
148
153
 
149
154
  RefCountedPtr<grpc_channel_security_connector>
150
155
  httpcli_ssl_channel_security_connector_create(
151
- const char* pem_root_certs, const tsi_ssl_root_certs_store* root_store,
152
- const char* secure_peer_name) {
153
- if (secure_peer_name != nullptr && pem_root_certs == nullptr) {
156
+ absl::string_view pem_root_certs,
157
+ const tsi_ssl_root_certs_store* root_store, const char* secure_peer_name) {
158
+ if (secure_peer_name != nullptr && pem_root_certs.empty()) {
154
159
  LOG(ERROR) << "Cannot assert a secure peer name without a trust root.";
155
160
  return nullptr;
156
161
  }
@@ -171,7 +176,7 @@ class HttpRequestSSLCredentials : public grpc_channel_credentials {
171
176
  RefCountedPtr<grpc_channel_security_connector> create_security_connector(
172
177
  RefCountedPtr<grpc_call_credentials> /*call_creds*/, const char* target,
173
178
  ChannelArgs* args) override {
174
- const char* pem_root_certs = DefaultSslRootStore::GetPemRootCerts();
179
+ absl::string_view pem_root_certs = DefaultSslRootStore::GetPemRootCerts();
175
180
  const tsi_ssl_root_certs_store* root_store =
176
181
  DefaultSslRootStore::GetRootStore();
177
182
  if (root_store == nullptr) {
@@ -48,7 +48,7 @@ static void init_num_cpus() {
48
48
  #endif
49
49
  // This must be signed. sysconf returns -1 when the number cannot be
50
50
  // determined
51
- ncpus = static_cast<int>(sysconf(_SC_NPROCESSORS_CONF));
51
+ ncpus = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
52
52
  if (ncpus < 1) {
53
53
  LOG(ERROR) << "Cannot determine number of CPUs: assuming 1";
54
54
  ncpus = 1;
@@ -28,13 +28,11 @@
28
28
 
29
29
  namespace grpc_core {
30
30
 
31
- // Loads the content of a file into a slice. add_null_terminator will add a NULL
32
- // terminator if true.
31
+ // Loads the content of a file into a slice.
33
32
  // This API is NOT thread-safe and requires proper synchronization when used by
34
33
  // multiple threads, especially when they can happen to be reading from the same
35
34
  // file.
36
- absl::StatusOr<Slice> LoadFile(const std::string& filename,
37
- bool add_null_terminator) {
35
+ absl::StatusOr<Slice> LoadFile(const std::string& filename) {
38
36
  unsigned char* contents = nullptr;
39
37
  long contents_size = 0;
40
38
  FILE* file;
@@ -66,8 +64,7 @@ absl::StatusOr<Slice> LoadFile(const std::string& filename,
66
64
  absl::StrCat("Failed to load file: ", filename,
67
65
  " due to error(fseek): ", StrError(errno)));
68
66
  }
69
- contents = static_cast<unsigned char*>(
70
- gpr_malloc(contents_size + (add_null_terminator ? 1 : 0)));
67
+ contents = static_cast<unsigned char*>(gpr_malloc(contents_size));
71
68
  bytes_read = fread(contents, 1, contents_size, file);
72
69
  static_assert(LONG_MAX <= SIZE_MAX,
73
70
  "size_t max should be more than long max");
@@ -77,9 +74,6 @@ absl::StatusOr<Slice> LoadFile(const std::string& filename,
77
74
  absl::StrCat("Failed to load file: ", filename,
78
75
  " due to error(fread): ", StrError(errno)));
79
76
  }
80
- if (add_null_terminator) {
81
- contents[contents_size++] = 0;
82
- }
83
77
  return Slice(
84
78
  grpc_slice_new(contents, static_cast<size_t>(contents_size), gpr_free));
85
79
  }
@@ -24,10 +24,9 @@
24
24
 
25
25
  namespace grpc_core {
26
26
 
27
- // Loads the content of a file into a slice. add_null_terminator will add a NULL
28
- // terminator if true.
29
- absl::StatusOr<Slice> LoadFile(const std::string& filename,
30
- bool add_null_terminator);
27
+ // Loads the content of a file into a slice.
28
+ absl::StatusOr<Slice> LoadFile(const std::string& filename);
29
+
31
30
  } // namespace grpc_core
32
31
 
33
32
  #endif // GRPC_SRC_CORE_UTIL_LOAD_FILE_H
@@ -49,7 +49,11 @@ class StringMatcher {
49
49
  StringMatcher& operator=(const StringMatcher& other);
50
50
  StringMatcher(StringMatcher&& other) noexcept;
51
51
  StringMatcher& operator=(StringMatcher&& other) noexcept;
52
+
52
53
  bool operator==(const StringMatcher& other) const;
54
+ bool operator!=(const StringMatcher& other) const {
55
+ return !(*this == other);
56
+ }
53
57
 
54
58
  bool Match(absl::string_view value) const;
55
59
 
@@ -120,7 +124,11 @@ class HeaderMatcher {
120
124
  HeaderMatcher& operator=(const HeaderMatcher& other);
121
125
  HeaderMatcher(HeaderMatcher&& other) noexcept;
122
126
  HeaderMatcher& operator=(HeaderMatcher&& other) noexcept;
127
+
123
128
  bool operator==(const HeaderMatcher& other) const;
129
+ bool operator!=(const HeaderMatcher& other) const {
130
+ return !(*this == other);
131
+ }
124
132
 
125
133
  const std::string& name() const { return name_; }
126
134
 
@@ -36,7 +36,7 @@ static long ncpus = 0;
36
36
  static pthread_key_t thread_id_key;
37
37
 
38
38
  static void init_ncpus() {
39
- ncpus = sysconf(_SC_NPROCESSORS_CONF);
39
+ ncpus = sysconf(_SC_NPROCESSORS_ONLN);
40
40
  if (ncpus < 1 || ncpus > INT32_MAX) {
41
41
  LOG(ERROR) << "Cannot determine number of CPUs: assuming 1";
42
42
  ncpus = 1;