grpc 1.55.0 → 1.56.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (395) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +102 -68
  3. data/include/grpc/event_engine/event_engine.h +4 -3
  4. data/include/grpc/grpc_audit_logging.h +96 -0
  5. data/include/grpc/grpc_security.h +19 -0
  6. data/include/grpc/module.modulemap +2 -0
  7. data/include/grpc/support/json.h +218 -0
  8. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +5 -0
  9. data/src/core/ext/filters/client_channel/backend_metric.cc +2 -0
  10. data/src/core/ext/filters/client_channel/channel_connectivity.cc +4 -4
  11. data/src/core/ext/filters/client_channel/client_channel.cc +86 -104
  12. data/src/core/ext/filters/client_channel/client_channel.h +6 -0
  13. data/src/core/ext/filters/client_channel/client_channel_channelz.cc +19 -18
  14. data/src/core/ext/filters/client_channel/client_channel_internal.h +16 -21
  15. data/src/core/ext/filters/client_channel/config_selector.h +9 -24
  16. data/src/core/ext/filters/client_channel/lb_policy/backend_metric_data.h +3 -0
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +5 -4
  18. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +455 -0
  19. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.h +54 -0
  20. data/src/core/ext/filters/client_channel/lb_policy/health_check_client_internal.h +186 -0
  21. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +2 -7
  22. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +53 -21
  23. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +23 -2
  24. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +19 -6
  25. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +1 -9
  26. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +16 -7
  27. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +18 -1
  28. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +12 -9
  29. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +6 -4
  30. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +36 -13
  31. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/static_stride_scheduler.cc +76 -6
  32. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +42 -40
  33. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +4 -10
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +52 -47
  35. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +1 -9
  36. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +14 -16
  37. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +40 -43
  38. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +7 -12
  39. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +12 -19
  40. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +35 -33
  41. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +29 -4
  42. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/service_config_helper.cc +1 -1
  43. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +28 -27
  44. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +163 -46
  45. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.h +16 -1
  46. data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -0
  47. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +10 -40
  48. data/src/core/ext/filters/client_channel/subchannel.cc +10 -196
  49. data/src/core/ext/filters/client_channel/subchannel.h +3 -43
  50. data/src/core/ext/filters/http/message_compress/compression_filter.cc +5 -5
  51. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +100 -6
  52. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +6 -8
  53. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +3 -3
  54. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +16 -1
  55. data/src/core/ext/transport/chttp2/transport/flow_control.cc +46 -95
  56. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.cc +176 -0
  57. data/src/core/ext/transport/chttp2/transport/hpack_parse_result.h +325 -0
  58. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +567 -543
  59. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +150 -9
  60. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +46 -32
  61. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +18 -5
  62. data/src/core/ext/transport/chttp2/transport/internal.h +1 -15
  63. data/src/core/ext/transport/chttp2/transport/parsing.cc +12 -12
  64. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.c +11 -2
  65. data/src/core/ext/upb-generated/xds/data/orca/v3/orca_load_report.upb.h +15 -0
  66. data/src/core/ext/xds/certificate_provider_store.cc +4 -9
  67. data/src/core/ext/xds/certificate_provider_store.h +1 -1
  68. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +30 -42
  69. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +14 -9
  70. data/src/core/ext/xds/xds_api.cc +9 -6
  71. data/src/core/ext/xds/xds_api.h +3 -2
  72. data/src/core/ext/xds/xds_audit_logger_registry.cc +122 -0
  73. data/src/core/ext/xds/xds_audit_logger_registry.h +68 -0
  74. data/src/core/ext/xds/xds_bootstrap_grpc.cc +21 -9
  75. data/src/core/ext/xds/xds_bootstrap_grpc.h +5 -0
  76. data/src/core/ext/xds/xds_client.cc +5 -4
  77. data/src/core/ext/xds/xds_client_stats.h +1 -1
  78. data/src/core/ext/xds/xds_cluster.cc +20 -19
  79. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +11 -8
  80. data/src/core/ext/xds/xds_common_types.cc +3 -1
  81. data/src/core/ext/xds/xds_http_fault_filter.cc +16 -13
  82. data/src/core/ext/xds/xds_http_fault_filter.h +2 -1
  83. data/src/core/ext/xds/xds_http_filters.h +4 -2
  84. data/src/core/ext/xds/xds_http_rbac_filter.cc +154 -67
  85. data/src/core/ext/xds/xds_http_rbac_filter.h +2 -1
  86. data/src/core/ext/xds/xds_http_stateful_session_filter.cc +15 -11
  87. data/src/core/ext/xds/xds_http_stateful_session_filter.h +2 -1
  88. data/src/core/ext/xds/xds_lb_policy_registry.cc +22 -16
  89. data/src/core/ext/xds/xds_listener.cc +1 -0
  90. data/src/core/ext/xds/xds_route_config.cc +40 -3
  91. data/src/core/ext/xds/xds_routing.cc +2 -2
  92. data/src/core/ext/xds/xds_transport_grpc.cc +3 -1
  93. data/src/core/lib/avl/avl.h +5 -0
  94. data/src/core/lib/backoff/random_early_detection.h +5 -0
  95. data/src/core/lib/channel/channel_args.cc +80 -22
  96. data/src/core/lib/channel/channel_args.h +34 -1
  97. data/src/core/lib/channel/channel_trace.cc +16 -12
  98. data/src/core/lib/channel/channelz.cc +159 -132
  99. data/src/core/lib/channel/channelz.h +42 -35
  100. data/src/core/lib/channel/channelz_registry.cc +23 -20
  101. data/src/core/lib/channel/connected_channel.cc +17 -6
  102. data/src/core/lib/channel/promise_based_filter.cc +0 -4
  103. data/src/core/lib/channel/promise_based_filter.h +2 -0
  104. data/src/core/lib/compression/compression_internal.cc +2 -5
  105. data/src/core/lib/config/config_vars.cc +20 -18
  106. data/src/core/lib/config/config_vars.h +4 -4
  107. data/src/core/lib/config/load_config.cc +13 -0
  108. data/src/core/lib/config/load_config.h +6 -0
  109. data/src/core/lib/debug/event_log.h +1 -1
  110. data/src/core/lib/debug/stats_data.h +1 -1
  111. data/src/core/lib/debug/trace.cc +24 -55
  112. data/src/core/lib/debug/trace.h +3 -1
  113. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +211 -0
  114. data/src/core/lib/event_engine/cf_engine/cf_engine.h +86 -0
  115. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +354 -0
  116. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.h +146 -0
  117. data/src/core/lib/event_engine/cf_engine/cftype_unique_ref.h +79 -0
  118. data/src/core/lib/event_engine/default_event_engine.cc +13 -1
  119. data/src/core/lib/event_engine/default_event_engine_factory.cc +14 -2
  120. data/src/core/lib/event_engine/poller.h +2 -2
  121. data/src/core/lib/event_engine/posix.h +4 -0
  122. data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +1 -1
  123. data/src/core/lib/event_engine/posix_engine/lockfree_event.cc +7 -18
  124. data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +9 -0
  125. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +33 -19
  126. data/src/core/lib/event_engine/posix_engine/posix_engine.h +2 -1
  127. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +33 -4
  128. data/src/core/lib/event_engine/posix_engine/posix_engine_listener.h +10 -8
  129. data/src/core/lib/event_engine/posix_engine/timer_manager.h +1 -1
  130. data/src/core/lib/event_engine/shim.cc +7 -1
  131. data/src/core/lib/event_engine/{thread_pool.cc → thread_pool/original_thread_pool.cc} +28 -25
  132. data/src/core/lib/event_engine/{thread_pool.h → thread_pool/original_thread_pool.h} +11 -15
  133. data/src/core/lib/event_engine/thread_pool/thread_pool.h +50 -0
  134. data/src/core/lib/event_engine/{executor/executor.h → thread_pool/thread_pool_factory.cc} +17 -15
  135. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +489 -0
  136. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +249 -0
  137. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.cc +166 -0
  138. data/src/core/lib/event_engine/thready_event_engine/thready_event_engine.h +108 -0
  139. data/src/core/lib/event_engine/windows/iocp.cc +4 -3
  140. data/src/core/lib/event_engine/windows/iocp.h +3 -3
  141. data/src/core/lib/event_engine/windows/win_socket.cc +6 -6
  142. data/src/core/lib/event_engine/windows/win_socket.h +4 -4
  143. data/src/core/lib/event_engine/windows/windows_endpoint.cc +11 -10
  144. data/src/core/lib/event_engine/windows/windows_endpoint.h +3 -2
  145. data/src/core/lib/event_engine/windows/windows_engine.cc +19 -17
  146. data/src/core/lib/event_engine/windows/windows_engine.h +6 -6
  147. data/src/core/lib/event_engine/windows/windows_listener.cc +3 -3
  148. data/src/core/lib/event_engine/windows/windows_listener.h +3 -2
  149. data/src/core/lib/event_engine/work_queue/basic_work_queue.cc +63 -0
  150. data/src/core/lib/event_engine/work_queue/basic_work_queue.h +71 -0
  151. data/src/core/lib/event_engine/work_queue/work_queue.h +62 -0
  152. data/src/core/lib/experiments/config.cc +38 -7
  153. data/src/core/lib/experiments/config.h +16 -0
  154. data/src/core/lib/experiments/experiments.cc +67 -20
  155. data/src/core/lib/experiments/experiments.h +27 -21
  156. data/src/core/lib/gpr/log_internal.h +55 -0
  157. data/src/core/lib/gprpp/crash.cc +10 -0
  158. data/src/core/lib/gprpp/crash.h +3 -0
  159. data/src/core/lib/gprpp/per_cpu.cc +33 -0
  160. data/src/core/lib/gprpp/per_cpu.h +29 -6
  161. data/src/core/lib/gprpp/time.cc +1 -0
  162. data/src/core/lib/iomgr/cfstream_handle.cc +1 -1
  163. data/src/core/lib/iomgr/endpoint_cfstream.cc +10 -8
  164. data/src/core/lib/iomgr/ev_apple.cc +12 -12
  165. data/src/core/lib/iomgr/ev_epoll1_linux.cc +10 -3
  166. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +15 -1
  167. data/src/core/lib/iomgr/iocp_windows.cc +24 -3
  168. data/src/core/lib/iomgr/iocp_windows.h +11 -0
  169. data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +1 -1
  170. data/src/core/lib/iomgr/socket_utils_common_posix.cc +4 -2
  171. data/src/core/lib/iomgr/socket_windows.cc +61 -7
  172. data/src/core/lib/iomgr/socket_windows.h +9 -2
  173. data/src/core/lib/iomgr/tcp_client_cfstream.cc +14 -3
  174. data/src/core/lib/iomgr/tcp_server_posix.cc +182 -119
  175. data/src/core/lib/iomgr/tcp_server_utils_posix.h +13 -1
  176. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +21 -0
  177. data/src/core/lib/iomgr/tcp_server_windows.cc +1 -1
  178. data/src/core/lib/json/json.h +2 -166
  179. data/src/core/lib/json/json_object_loader.cc +8 -9
  180. data/src/core/lib/json/json_object_loader.h +25 -18
  181. data/src/core/lib/json/json_reader.cc +13 -6
  182. data/src/core/lib/json/json_util.cc +6 -11
  183. data/src/core/lib/json/json_writer.cc +7 -8
  184. data/src/core/lib/load_balancing/lb_policy.h +13 -0
  185. data/src/core/lib/load_balancing/lb_policy_registry.cc +2 -1
  186. data/src/core/lib/matchers/matchers.cc +3 -4
  187. data/src/core/lib/matchers/matchers.h +2 -1
  188. data/src/core/lib/promise/activity.cc +5 -0
  189. data/src/core/lib/promise/activity.h +10 -0
  190. data/src/core/lib/promise/detail/promise_factory.h +1 -1
  191. data/src/core/lib/promise/party.cc +31 -13
  192. data/src/core/lib/promise/party.h +11 -2
  193. data/src/core/lib/promise/pipe.h +9 -2
  194. data/src/core/lib/promise/prioritized_race.h +95 -0
  195. data/src/core/lib/promise/sleep.cc +2 -1
  196. data/src/core/lib/resolver/server_address.cc +0 -8
  197. data/src/core/lib/resolver/server_address.h +0 -6
  198. data/src/core/lib/resource_quota/memory_quota.cc +7 -7
  199. data/src/core/lib/resource_quota/memory_quota.h +1 -2
  200. data/src/core/lib/security/authorization/audit_logging.cc +98 -0
  201. data/src/core/lib/security/authorization/audit_logging.h +73 -0
  202. data/src/core/lib/security/authorization/grpc_authorization_engine.cc +47 -2
  203. data/src/core/lib/security/authorization/grpc_authorization_engine.h +18 -1
  204. data/src/core/lib/security/authorization/rbac_policy.cc +36 -4
  205. data/src/core/lib/security/authorization/rbac_policy.h +19 -2
  206. data/src/core/lib/security/authorization/stdout_logger.cc +75 -0
  207. data/src/core/lib/security/authorization/stdout_logger.h +61 -0
  208. data/src/core/lib/security/certificate_provider/certificate_provider_factory.h +8 -4
  209. data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +8 -18
  210. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +14 -8
  211. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +19 -12
  212. data/src/core/lib/security/credentials/external/external_account_credentials.cc +4 -2
  213. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +1 -0
  214. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -0
  215. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -0
  216. data/src/core/lib/security/credentials/jwt/json_token.cc +15 -14
  217. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +4 -2
  218. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +1 -0
  219. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -0
  220. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +8 -0
  221. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +5 -1
  222. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -5
  223. data/src/core/lib/security/security_connector/ssl_utils.cc +2 -1
  224. data/src/core/lib/security/security_connector/ssl_utils.h +1 -1
  225. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +1 -1
  226. data/src/core/lib/security/util/json_util.cc +1 -0
  227. data/src/core/lib/service_config/service_config_call_data.h +49 -20
  228. data/src/core/lib/service_config/service_config_impl.cc +2 -1
  229. data/src/core/lib/surface/call.cc +38 -23
  230. data/src/core/lib/surface/completion_queue.cc +6 -2
  231. data/src/core/lib/surface/validate_metadata.cc +37 -22
  232. data/src/core/lib/surface/validate_metadata.h +13 -3
  233. data/src/core/lib/surface/version.cc +2 -2
  234. data/src/core/lib/transport/batch_builder.cc +15 -12
  235. data/src/core/lib/transport/batch_builder.h +39 -35
  236. data/src/core/plugin_registry/grpc_plugin_registry.cc +0 -2
  237. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +2 -0
  238. data/src/core/tsi/ssl_transport_security.cc +5 -2
  239. data/src/core/tsi/ssl_transport_security.h +13 -1
  240. data/src/ruby/ext/grpc/extconf.rb +8 -9
  241. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
  242. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
  243. data/src/ruby/lib/grpc/version.rb +1 -1
  244. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_mbstr.c +9 -8
  245. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strnid.c +1 -1
  246. data/third_party/boringssl-with-bazel/src/crypto/asn1/internal.h +3 -3
  247. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +10 -6
  248. data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +7 -4
  249. data/third_party/boringssl-with-bazel/src/crypto/bio/bio.c +6 -4
  250. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +2 -1
  251. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +5 -9
  252. data/third_party/boringssl-with-bazel/src/crypto/bio/pair.c +4 -2
  253. data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +31 -22
  254. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_tls.c +29 -26
  255. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +8 -0
  256. data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/tls_cbc.c +189 -13
  257. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.c +62 -0
  258. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_openbsd.c +31 -0
  259. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519.c +6 -4
  260. data/third_party/boringssl-with-bazel/src/crypto/curve25519/curve25519_tables.h +795 -795
  261. data/third_party/boringssl-with-bazel/src/crypto/curve25519/internal.h +1 -5
  262. data/third_party/boringssl-with-bazel/src/crypto/dsa/dsa.c +4 -0
  263. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +18 -6
  264. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +15 -7
  265. data/third_party/boringssl-with-bazel/src/crypto/ecdh_extra/ecdh_extra.c +1 -1
  266. data/third_party/boringssl-with-bazel/src/crypto/evp/p_rsa.c +1 -1
  267. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +1 -0
  268. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.c +3 -0
  269. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +24 -24
  270. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +1 -1
  271. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_montgomery.c +7 -7
  272. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/internal.h +74 -74
  273. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/oct.c +1 -2
  274. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p224-64.c +11 -11
  275. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256-nistz.c +12 -12
  276. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256.c +14 -15
  277. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/p256_table.h +1 -1
  278. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple.c +10 -10
  279. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/simple_mul.c +23 -23
  280. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/wnaf.c +13 -13
  281. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdh/ecdh.c +1 -1
  282. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ecdsa/ecdsa.c +2 -2
  283. data/third_party/boringssl-with-bazel/src/crypto/{hkdf → fipsmodule/hkdf}/hkdf.c +1 -1
  284. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/cbc.c +2 -10
  285. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ctr.c +1 -4
  286. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm.c +115 -133
  287. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/gcm_nohw.c +12 -14
  288. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/internal.h +57 -47
  289. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/ofb.c +1 -8
  290. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/modes/polyval.c +27 -28
  291. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +11 -23
  292. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/internal.h +21 -16
  293. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/padding.c +5 -288
  294. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa.c +143 -83
  295. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +95 -183
  296. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +71 -0
  297. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h +8 -0
  298. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c +33 -0
  299. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +162 -6
  300. data/third_party/boringssl-with-bazel/src/crypto/internal.h +18 -0
  301. data/third_party/boringssl-with-bazel/src/crypto/kyber/kyber.c +18 -11
  302. data/third_party/boringssl-with-bazel/src/crypto/obj/obj_dat.h +6 -13
  303. data/third_party/boringssl-with-bazel/src/crypto/pem/pem_lib.c +18 -14
  304. data/third_party/boringssl-with-bazel/src/crypto/{refcount_lock.c → refcount_no_threads.c} +3 -13
  305. data/third_party/boringssl-with-bazel/src/crypto/refcount_win.c +89 -0
  306. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/internal.h +77 -0
  307. data/third_party/boringssl-with-bazel/src/crypto/rsa_extra/rsa_crypt.c +568 -0
  308. data/third_party/boringssl-with-bazel/src/crypto/trust_token/internal.h +62 -0
  309. data/third_party/boringssl-with-bazel/src/crypto/trust_token/pmbtoken.c +218 -44
  310. data/third_party/boringssl-with-bazel/src/crypto/trust_token/trust_token.c +35 -0
  311. data/third_party/boringssl-with-bazel/src/crypto/trust_token/voprf.c +588 -39
  312. data/third_party/boringssl-with-bazel/src/crypto/x509/a_sign.c +27 -18
  313. data/third_party/boringssl-with-bazel/src/crypto/x509/asn1_gen.c +1 -1
  314. data/third_party/boringssl-with-bazel/src/crypto/x509/name_print.c +17 -39
  315. data/third_party/boringssl-with-bazel/src/crypto/x509/t_x509.c +39 -48
  316. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_att.c +0 -140
  317. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_req.c +72 -23
  318. data/third_party/boringssl-with-bazel/src/crypto/x509/x509name.c +11 -14
  319. data/third_party/boringssl-with-bazel/src/crypto/x509/x509spki.c +1 -1
  320. data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
  321. data/third_party/boringssl-with-bazel/src/crypto/x509v3/internal.h +1 -1
  322. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +33 -46
  323. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +1 -0
  324. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_info.c +3 -5
  325. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +14 -46
  326. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +14 -26
  327. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +17 -10
  328. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +1 -1
  329. data/third_party/boringssl-with-bazel/src/include/openssl/aead.h +5 -7
  330. data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +6 -4
  331. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +32 -1
  332. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +0 -4
  333. data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +1 -4
  334. data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +3 -3
  335. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +28 -0
  336. data/third_party/boringssl-with-bazel/src/include/openssl/nid.h +2 -11
  337. data/third_party/boringssl-with-bazel/src/include/openssl/pem.h +0 -3
  338. data/third_party/boringssl-with-bazel/src/include/openssl/rsa.h +91 -1
  339. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +5 -0
  340. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +149 -20
  341. data/third_party/boringssl-with-bazel/src/include/openssl/thread.h +4 -0
  342. data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +4 -0
  343. data/third_party/boringssl-with-bazel/src/include/openssl/trust_token.h +8 -0
  344. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +774 -615
  345. data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +42 -10
  346. data/third_party/boringssl-with-bazel/src/ssl/encrypted_client_hello.cc +11 -6
  347. data/third_party/boringssl-with-bazel/src/ssl/extensions.cc +2 -4
  348. data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +24 -16
  349. data/third_party/boringssl-with-bazel/src/ssl/internal.h +65 -18
  350. data/third_party/boringssl-with-bazel/src/ssl/s3_both.cc +37 -18
  351. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +187 -193
  352. data/third_party/boringssl-with-bazel/src/ssl/ssl_key_share.cc +13 -129
  353. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +85 -10
  354. data/third_party/boringssl-with-bazel/src/ssl/ssl_privkey.cc +17 -4
  355. data/third_party/boringssl-with-bazel/src/ssl/ssl_versions.cc +27 -19
  356. data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +1 -1
  357. data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +5 -21
  358. data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +5 -2
  359. data/third_party/boringssl-with-bazel/src/third_party/fiat/curve25519_64_msvc.h +1281 -0
  360. data/third_party/boringssl-with-bazel/src/third_party/fiat/p256_64_msvc.h +2002 -0
  361. data/third_party/cares/cares/include/ares.h +23 -1
  362. data/third_party/cares/cares/{src/lib → include}/ares_nameser.h +9 -7
  363. data/third_party/cares/cares/include/ares_rules.h +2 -2
  364. data/third_party/cares/cares/include/ares_version.h +3 -3
  365. data/third_party/cares/cares/src/lib/ares__addrinfo2hostent.c +266 -0
  366. data/third_party/cares/cares/src/lib/ares__addrinfo_localhost.c +240 -0
  367. data/third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c +49 -80
  368. data/third_party/cares/cares/src/lib/ares__readaddrinfo.c +37 -43
  369. data/third_party/cares/cares/src/lib/ares__sortaddrinfo.c +12 -4
  370. data/third_party/cares/cares/src/lib/ares_data.c +16 -0
  371. data/third_party/cares/cares/src/lib/ares_data.h +7 -0
  372. data/third_party/cares/cares/src/lib/ares_destroy.c +8 -0
  373. data/third_party/cares/cares/src/lib/ares_expand_name.c +17 -6
  374. data/third_party/cares/cares/src/lib/ares_freeaddrinfo.c +1 -0
  375. data/third_party/cares/cares/src/lib/ares_getaddrinfo.c +156 -78
  376. data/third_party/cares/cares/src/lib/ares_gethostbyname.c +130 -326
  377. data/third_party/cares/cares/src/lib/ares_init.c +97 -485
  378. data/third_party/cares/cares/src/lib/ares_library_init.c +2 -89
  379. data/third_party/cares/cares/src/lib/ares_parse_a_reply.c +23 -142
  380. data/third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c +22 -142
  381. data/third_party/cares/cares/src/lib/ares_parse_uri_reply.c +184 -0
  382. data/third_party/cares/cares/src/lib/ares_private.h +30 -16
  383. data/third_party/cares/cares/src/lib/ares_process.c +55 -16
  384. data/third_party/cares/cares/src/lib/ares_query.c +1 -35
  385. data/third_party/cares/cares/src/lib/ares_rand.c +279 -0
  386. data/third_party/cares/cares/src/lib/ares_send.c +5 -7
  387. data/third_party/cares/cares/src/lib/ares_strdup.c +12 -19
  388. data/third_party/cares/cares/src/lib/ares_strsplit.c +44 -128
  389. data/third_party/cares/cares/src/lib/ares_strsplit.h +9 -10
  390. data/third_party/cares/cares/src/lib/inet_net_pton.c +78 -116
  391. data/third_party/cares/cares/src/tools/ares_getopt.h +53 -0
  392. metadata +50 -12
  393. data/src/core/ext/filters/client_channel/health/health_check_client.cc +0 -175
  394. data/src/core/ext/filters/client_channel/health/health_check_client.h +0 -43
  395. data/third_party/cares/cares/src/lib/ares_library_init.h +0 -43
@@ -21,16 +21,28 @@
21
21
 
22
22
  #include <grpc/support/port_platform.h>
23
23
 
24
+ #include <stddef.h>
24
25
  #include <stdint.h>
25
26
 
27
+ #include <string>
28
+ #include <utility>
26
29
  #include <vector>
27
30
 
31
+ #include "absl/strings/str_cat.h"
32
+ #include "absl/strings/string_view.h"
33
+ #include "absl/types/optional.h"
34
+ #include "absl/types/span.h"
35
+ #include "absl/types/variant.h"
36
+
28
37
  #include <grpc/slice.h>
29
38
 
30
39
  #include "src/core/ext/transport/chttp2/transport/frame.h"
40
+ #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h"
31
41
  #include "src/core/ext/transport/chttp2/transport/hpack_parser_table.h"
32
42
  #include "src/core/lib/backoff/random_early_detection.h"
33
43
  #include "src/core/lib/iomgr/error.h"
44
+ #include "src/core/lib/slice/slice.h"
45
+ #include "src/core/lib/slice/slice_refcount.h"
34
46
  #include "src/core/lib/transport/metadata_batch.h"
35
47
 
36
48
  // IWYU pragma: no_include <type_traits>
@@ -92,17 +104,150 @@ class HPackParser {
92
104
  void FinishFrame();
93
105
 
94
106
  // Retrieve the associated hpack table (for tests, debugging)
95
- HPackTable* hpack_table() { return &table_; }
107
+ HPackTable* hpack_table() { return &state_.hpack_table; }
96
108
  // Is the current frame a boundary of some sort
97
109
  bool is_boundary() const { return boundary_ != Boundary::None; }
98
110
  // Is the current frame the end of a stream
99
111
  bool is_eof() const { return boundary_ == Boundary::EndOfStream; }
100
112
 
113
+ // How many bytes are buffered (for tests to assert on)
114
+ size_t buffered_bytes() const { return unparsed_bytes_.size(); }
115
+
101
116
  private:
102
117
  // Helper classes: see implementation
103
118
  class Parser;
104
119
  class Input;
105
- class String;
120
+
121
+ // Helper to parse a string and turn it into a slice with appropriate memory
122
+ // management characteristics
123
+ class String {
124
+ public:
125
+ // StringResult carries both a HpackParseStatus and the parsed string
126
+ struct StringResult;
127
+
128
+ String() : value_(absl::Span<const uint8_t>()) {}
129
+ String(const String&) = delete;
130
+ String& operator=(const String&) = delete;
131
+ String(String&& other) noexcept : value_(std::move(other.value_)) {
132
+ other.value_ = absl::Span<const uint8_t>();
133
+ }
134
+ String& operator=(String&& other) noexcept {
135
+ value_ = std::move(other.value_);
136
+ other.value_ = absl::Span<const uint8_t>();
137
+ return *this;
138
+ }
139
+
140
+ // Take the value and leave this empty
141
+ Slice Take();
142
+
143
+ // Return a reference to the value as a string view
144
+ absl::string_view string_view() const;
145
+
146
+ // Parse a non-binary string
147
+ static StringResult Parse(Input* input, bool is_huff, size_t length);
148
+
149
+ // Parse a binary string
150
+ static StringResult ParseBinary(Input* input, bool is_huff, size_t length);
151
+
152
+ private:
153
+ void AppendBytes(const uint8_t* data, size_t length);
154
+ explicit String(std::vector<uint8_t> v) : value_(std::move(v)) {}
155
+ explicit String(absl::Span<const uint8_t> v) : value_(v) {}
156
+ String(grpc_slice_refcount* r, const uint8_t* begin, const uint8_t* end)
157
+ : value_(Slice::FromRefcountAndBytes(r, begin, end)) {}
158
+
159
+ // Parse some huffman encoded bytes, using output(uint8_t b) to emit each
160
+ // decoded byte.
161
+ template <typename Out>
162
+ static HpackParseStatus ParseHuff(Input* input, uint32_t length,
163
+ Out output);
164
+
165
+ // Parse some uncompressed string bytes.
166
+ static StringResult ParseUncompressed(Input* input, uint32_t length,
167
+ uint32_t wire_size);
168
+
169
+ // Turn base64 encoded bytes into not base64 encoded bytes.
170
+ static StringResult Unbase64(String s);
171
+
172
+ // Main loop for Unbase64
173
+ static absl::optional<std::vector<uint8_t>> Unbase64Loop(
174
+ const uint8_t* cur, const uint8_t* end);
175
+
176
+ absl::variant<Slice, absl::Span<const uint8_t>, std::vector<uint8_t>>
177
+ value_;
178
+ };
179
+
180
+ // Prefix for a string
181
+ struct StringPrefix {
182
+ // Number of bytes in input for string
183
+ uint32_t length;
184
+ // Is it huffman compressed
185
+ bool huff;
186
+
187
+ std::string ToString() const {
188
+ return absl::StrCat(length, " bytes ",
189
+ huff ? "huffman compressed" : "uncompressed");
190
+ }
191
+ };
192
+
193
+ // Current parse state
194
+ // ┌───┐
195
+ // │Top│
196
+ // └┬─┬┘
197
+ // │┌▽────────────────┐
198
+ // ││ParsingKeyLength │
199
+ // │└┬───────────────┬┘
200
+ // │┌▽─────────────┐┌▽──────────────┐
201
+ // ││ParsingKeyBody││SkippingKeyBody│
202
+ // │└┬─────────────┘└───┬───────────┘
203
+ // ┌▽─▽────────────────┐┌▽──────────────────┐
204
+ // │ParsingValueLength ││SkippingValueLength│
205
+ // └┬─────────────────┬┘└┬──────────────────┘
206
+ // ┌▽───────────────┐┌▽──▽─────────────┐
207
+ // │ParsingValueBody││SkippingValueBody│
208
+ // └────────────────┘└─────────────────┘
209
+ enum class ParseState : uint8_t {
210
+ // Start of one opcode
211
+ kTop,
212
+ // Parsing a literal keys length
213
+ kParsingKeyLength,
214
+ // Parsing a literal key
215
+ kParsingKeyBody,
216
+ // Skipping a literal key
217
+ kSkippingKeyBody,
218
+ // Parsing a literal value length
219
+ kParsingValueLength,
220
+ // Parsing a literal value
221
+ kParsingValueBody,
222
+ // Reading a literal value length (so we can skip it)
223
+ kSkippingValueLength,
224
+ // Skipping a literal value
225
+ kSkippingValueBody,
226
+ };
227
+
228
+ // Shared state for Parser instances between slices.
229
+ struct InterSliceState {
230
+ HPackTable hpack_table;
231
+ // Error so far for this frame (set by class Input)
232
+ HpackParseResult frame_error;
233
+ // Length of frame so far.
234
+ uint32_t frame_length = 0;
235
+ // Length of the string being parsed
236
+ uint32_t string_length;
237
+ // How many more dynamic table updates are allowed
238
+ uint8_t dynamic_table_updates_allowed;
239
+ // Current parse state
240
+ ParseState parse_state = ParseState::kTop;
241
+ // RED for overly large metadata sets
242
+ RandomEarlyDetection metadata_early_detection;
243
+ // Should the current header be added to the hpack table?
244
+ bool add_to_table;
245
+ // Is the string being parsed huffman compressed?
246
+ bool is_string_huff_compressed;
247
+ // Is the value being parsed binary?
248
+ bool is_binary_header;
249
+ absl::variant<const HPackTable::Memento*, Slice> key;
250
+ };
106
251
 
107
252
  grpc_error_handle ParseInput(Input input, bool is_last);
108
253
  void ParseInputInner(Input* input);
@@ -114,6 +259,8 @@ class HPackParser {
114
259
 
115
260
  // Bytes that could not be parsed last parsing round
116
261
  std::vector<uint8_t> unparsed_bytes_;
262
+ // How many bytes would be needed before progress could be made?
263
+ size_t min_progress_size_ = 0;
117
264
  // Buffer kind of boundary
118
265
  // TODO(ctiller): see if we can move this argument to Parse, and avoid
119
266
  // buffering.
@@ -122,15 +269,9 @@ class HPackParser {
122
269
  // TODO(ctiller): see if we can move this argument to Parse, and avoid
123
270
  // buffering.
124
271
  Priority priority_;
125
- uint8_t dynamic_table_updates_allowed_;
126
- // Length of frame so far.
127
- uint32_t frame_length_;
128
- RandomEarlyDetection metadata_early_detection_;
129
272
  // Information for logging
130
273
  LogInfo log_info_;
131
-
132
- // hpack table
133
- HPackTable table_;
274
+ InterSliceState state_;
134
275
  };
135
276
 
136
277
  } // namespace grpc_core
@@ -25,16 +25,16 @@
25
25
  #include <algorithm>
26
26
  #include <cstddef>
27
27
  #include <cstring>
28
- #include <initializer_list>
29
28
  #include <utility>
30
29
 
31
30
  #include "absl/status/status.h"
32
- #include "absl/strings/str_format.h"
31
+ #include "absl/strings/str_cat.h"
33
32
  #include "absl/strings/string_view.h"
34
33
 
35
34
  #include <grpc/support/log.h>
36
35
 
37
36
  #include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
37
+ #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h"
38
38
  #include "src/core/ext/transport/chttp2/transport/http_trace.h"
39
39
  #include "src/core/lib/debug/trace.h"
40
40
  #include "src/core/lib/slice/slice.h"
@@ -80,6 +80,14 @@ void HPackTable::MementoRingBuffer::Rebuild(uint32_t max_entries) {
80
80
  entries_.swap(entries);
81
81
  }
82
82
 
83
+ void HPackTable::MementoRingBuffer::ForEach(
84
+ absl::FunctionRef<void(uint32_t, const Memento&)> f) const {
85
+ uint32_t index = 0;
86
+ while (auto* m = Lookup(index++)) {
87
+ f(index, *m);
88
+ }
89
+ }
90
+
83
91
  // Evict one element from the table
84
92
  void HPackTable::EvictOne() {
85
93
  auto first_entry = entries_.PopOne();
@@ -100,15 +108,9 @@ void HPackTable::SetMaxBytes(uint32_t max_bytes) {
100
108
  max_bytes_ = max_bytes;
101
109
  }
102
110
 
103
- grpc_error_handle HPackTable::SetCurrentTableSize(uint32_t bytes) {
104
- if (current_table_bytes_ == bytes) {
105
- return absl::OkStatus();
106
- }
107
- if (bytes > max_bytes_) {
108
- return absl::InternalError(absl::StrFormat(
109
- "Attempt to make hpack table %d bytes when max is %d bytes", bytes,
110
- max_bytes_));
111
- }
111
+ bool HPackTable::SetCurrentTableSize(uint32_t bytes) {
112
+ if (current_table_bytes_ == bytes) return true;
113
+ if (bytes > max_bytes_) return false;
112
114
  if (GRPC_TRACE_FLAG_ENABLED(grpc_http_trace)) {
113
115
  gpr_log(GPR_INFO, "Update hpack parser table size to %d", bytes);
114
116
  }
@@ -119,30 +121,16 @@ grpc_error_handle HPackTable::SetCurrentTableSize(uint32_t bytes) {
119
121
  uint32_t new_cap = std::max(hpack_constants::EntriesForBytes(bytes),
120
122
  hpack_constants::kInitialTableEntries);
121
123
  entries_.Rebuild(new_cap);
122
- return absl::OkStatus();
124
+ return true;
123
125
  }
124
126
 
125
- grpc_error_handle HPackTable::Add(Memento md) {
126
- if (current_table_bytes_ > max_bytes_) {
127
- return GRPC_ERROR_CREATE(absl::StrFormat(
128
- "HPACK max table size reduced to %d but not reflected by hpack "
129
- "stream (still at %d)",
130
- max_bytes_, current_table_bytes_));
131
- }
127
+ bool HPackTable::Add(Memento md) {
128
+ if (current_table_bytes_ > max_bytes_) return false;
132
129
 
133
130
  // we can't add elements bigger than the max table size
134
131
  if (md.md.transport_size() > current_table_bytes_) {
135
- // HPACK draft 10 section 4.4 states:
136
- // If the size of the new entry is less than or equal to the maximum
137
- // size, that entry is added to the table. It is not an error to
138
- // attempt to add an entry that is larger than the maximum size; an
139
- // attempt to add an entry larger than the entire table causes
140
- // the table to be emptied of all existing entries, and results in an
141
- // empty table.
142
- while (entries_.num_entries()) {
143
- EvictOne();
144
- }
145
- return absl::OkStatus();
132
+ AddLargerThanCurrentTableSize();
133
+ return true;
146
134
  }
147
135
 
148
136
  // evict entries to ensure no overflow
@@ -154,7 +142,33 @@ grpc_error_handle HPackTable::Add(Memento md) {
154
142
  // copy the finalized entry in
155
143
  mem_used_ += md.md.transport_size();
156
144
  entries_.Put(std::move(md));
157
- return absl::OkStatus();
145
+ return true;
146
+ }
147
+
148
+ void HPackTable::AddLargerThanCurrentTableSize() {
149
+ // HPACK draft 10 section 4.4 states:
150
+ // If the size of the new entry is less than or equal to the maximum
151
+ // size, that entry is added to the table. It is not an error to
152
+ // attempt to add an entry that is larger than the maximum size; an
153
+ // attempt to add an entry larger than the entire table causes
154
+ // the table to be emptied of all existing entries, and results in an
155
+ // empty table.
156
+ while (entries_.num_entries()) {
157
+ EvictOne();
158
+ }
159
+ }
160
+
161
+ std::string HPackTable::TestOnlyDynamicTableAsString() const {
162
+ std::string out;
163
+ entries_.ForEach([&out](uint32_t i, const Memento& m) {
164
+ if (m.parse_status.ok()) {
165
+ absl::StrAppend(&out, i, ": ", m.md.DebugString(), "\n");
166
+ } else {
167
+ absl::StrAppend(&out, i, ": ", m.parse_status.Materialize().ToString(),
168
+ "\n");
169
+ }
170
+ });
171
+ return out;
158
172
  }
159
173
 
160
174
  namespace {
@@ -236,7 +250,7 @@ HPackTable::Memento MakeMemento(size_t i) {
236
250
  [](absl::string_view, const Slice&) {
237
251
  abort(); // not expecting to see this
238
252
  }),
239
- absl::OkStatus()};
253
+ HpackParseResult()};
240
254
  }
241
255
 
242
256
  } // namespace
@@ -23,13 +23,14 @@
23
23
 
24
24
  #include <stdint.h>
25
25
 
26
+ #include <string>
26
27
  #include <vector>
27
28
 
28
- #include "absl/status/status.h"
29
+ #include "absl/functional/function_ref.h"
29
30
 
30
31
  #include "src/core/ext/transport/chttp2/transport/hpack_constants.h"
32
+ #include "src/core/ext/transport/chttp2/transport/hpack_parse_result.h"
31
33
  #include "src/core/lib/gprpp/no_destruct.h"
32
- #include "src/core/lib/iomgr/error.h"
33
34
  #include "src/core/lib/transport/metadata_batch.h"
34
35
  #include "src/core/lib/transport/parsed_metadata.h"
35
36
 
@@ -45,11 +46,12 @@ class HPackTable {
45
46
  HPackTable& operator=(const HPackTable&) = delete;
46
47
 
47
48
  void SetMaxBytes(uint32_t max_bytes);
48
- grpc_error_handle SetCurrentTableSize(uint32_t bytes);
49
+ bool SetCurrentTableSize(uint32_t bytes);
50
+ uint32_t current_table_size() { return current_table_bytes_; }
49
51
 
50
52
  struct Memento {
51
53
  ParsedMetadata<grpc_metadata_batch> md;
52
- absl::Status parse_status;
54
+ HpackParseResult parse_status;
53
55
  };
54
56
 
55
57
  // Lookup, but don't ref.
@@ -68,7 +70,8 @@ class HPackTable {
68
70
  }
69
71
 
70
72
  // add a table entry to the index
71
- grpc_error_handle Add(Memento md) GRPC_MUST_USE_RESULT;
73
+ bool Add(Memento md) GRPC_MUST_USE_RESULT;
74
+ void AddLargerThanCurrentTableSize();
72
75
 
73
76
  // Current entry count in the table.
74
77
  uint32_t num_entries() const { return entries_.num_entries(); }
@@ -76,6 +79,13 @@ class HPackTable {
76
79
  // Current size of the table.
77
80
  uint32_t test_only_table_size() const { return mem_used_; }
78
81
 
82
+ // Maximum allowed size of the table currently
83
+ uint32_t max_bytes() const { return max_bytes_; }
84
+ uint32_t current_table_bytes() const { return current_table_bytes_; }
85
+
86
+ // Dynamic table entries, stringified
87
+ std::string TestOnlyDynamicTableAsString() const;
88
+
79
89
  private:
80
90
  struct StaticMementos {
81
91
  StaticMementos();
@@ -98,6 +108,9 @@ class HPackTable {
98
108
  // Lookup the entry at index, or return nullptr if none exists.
99
109
  const Memento* Lookup(uint32_t index) const;
100
110
 
111
+ void ForEach(absl::FunctionRef<void(uint32_t dynamic_index, const Memento&)>
112
+ f) const;
113
+
101
114
  uint32_t max_entries() const { return max_entries_; }
102
115
  uint32_t num_entries() const { return num_entries_; }
103
116
 
@@ -244,21 +244,7 @@ typedef enum {
244
244
  GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED,
245
245
  } grpc_chttp2_keepalive_state;
246
246
 
247
- struct grpc_chttp2_transport
248
- // TODO(ctiller): #31319 fixed a crash on Linux & Mac whereby iomgr was
249
- // accessed after shutdown by chttp2. We've not seen similar behavior on
250
- // Windows afaik, but this fix has exposed another refcounting bug whereby
251
- // transports leak on Windows and prevent test shutdown.
252
- // This hack attempts to compromise between two things that are blocking our CI
253
- // from giving us a good quality signal, but are unlikely to be problems for
254
- // most customers. We should continue tracking down what's causing the failure,
255
- // but this gives us some runway to do so - and given that we're actively
256
- // working on removing the problematic code paths, it may be that effort brings
257
- // the result we need.
258
- #ifndef GPR_WINDOWS
259
- : public grpc_core::KeepsGrpcInitialized
260
- #endif
261
- {
247
+ struct grpc_chttp2_transport : public grpc_core::KeepsGrpcInitialized {
262
248
  grpc_chttp2_transport(const grpc_core::ChannelArgs& channel_args,
263
249
  grpc_endpoint* ep, bool is_client);
264
250
  ~grpc_chttp2_transport();
@@ -23,7 +23,6 @@
23
23
 
24
24
  #include <initializer_list>
25
25
  #include <string>
26
- #include <utility>
27
26
 
28
27
  #include "absl/base/attributes.h"
29
28
  #include "absl/status/status.h"
@@ -470,8 +469,8 @@ static HPackParser::LogInfo hpack_parser_log_info(
470
469
  }
471
470
 
472
471
  static grpc_error_handle init_header_skip_frame_parser(
473
- grpc_chttp2_transport* t, HPackParser::Priority priority_type) {
474
- bool is_eoh = t->expect_continuation_stream_id != 0;
472
+ grpc_chttp2_transport* t, HPackParser::Priority priority_type,
473
+ bool is_eoh) {
475
474
  t->parser = grpc_chttp2_transport::Parser{
476
475
  "header", grpc_chttp2_header_parser_parse, &t->hpack_parser};
477
476
  t->hpack_parser.BeginFrame(
@@ -595,7 +594,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
595
594
  GRPC_CHTTP2_IF_TRACING(
596
595
  gpr_log(GPR_ERROR,
597
596
  "grpc_chttp2_stream disbanded before CONTINUATION received"));
598
- return init_header_skip_frame_parser(t, priority_type);
597
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
599
598
  }
600
599
  if (t->is_client) {
601
600
  if (GPR_LIKELY((t->incoming_stream_id & 1) &&
@@ -605,7 +604,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
605
604
  GRPC_CHTTP2_IF_TRACING(gpr_log(
606
605
  GPR_ERROR, "ignoring new grpc_chttp2_stream creation on client"));
607
606
  }
608
- return init_header_skip_frame_parser(t, priority_type);
607
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
609
608
  } else if (GPR_UNLIKELY(t->last_new_stream_id >= t->incoming_stream_id)) {
610
609
  GRPC_CHTTP2_IF_TRACING(gpr_log(
611
610
  GPR_ERROR,
@@ -613,13 +612,13 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
613
612
  "last grpc_chttp2_stream "
614
613
  "id=%d, new grpc_chttp2_stream id=%d",
615
614
  t->last_new_stream_id, t->incoming_stream_id));
616
- return init_header_skip_frame_parser(t, priority_type);
615
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
617
616
  } else if (GPR_UNLIKELY((t->incoming_stream_id & 1) == 0)) {
618
617
  GRPC_CHTTP2_IF_TRACING(gpr_log(
619
618
  GPR_ERROR,
620
619
  "ignoring grpc_chttp2_stream with non-client generated index %d",
621
620
  t->incoming_stream_id));
622
- return init_header_skip_frame_parser(t, priority_type);
621
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
623
622
  } else if (GPR_UNLIKELY(
624
623
  grpc_chttp2_stream_map_size(&t->stream_map) >=
625
624
  t->settings[GRPC_ACKED_SETTINGS]
@@ -632,7 +631,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
632
631
  "grpc_chttp2_stream request id=%d, last grpc_chttp2_stream id=%d",
633
632
  t, std::string(t->peer_string.as_string_view()).c_str(),
634
633
  t->incoming_stream_id, t->last_new_stream_id));
635
- return init_header_skip_frame_parser(t, priority_type);
634
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
636
635
  }
637
636
  t->last_new_stream_id = t->incoming_stream_id;
638
637
  s = t->incoming_stream =
@@ -640,7 +639,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
640
639
  if (GPR_UNLIKELY(s == nullptr)) {
641
640
  GRPC_CHTTP2_IF_TRACING(
642
641
  gpr_log(GPR_ERROR, "grpc_chttp2_stream not accepted"));
643
- return init_header_skip_frame_parser(t, priority_type);
642
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
644
643
  }
645
644
  if (t->channelz_socket != nullptr) {
646
645
  t->channelz_socket->RecordStreamStartedFromRemote();
@@ -654,7 +653,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
654
653
  GRPC_CHTTP2_IF_TRACING(gpr_log(
655
654
  GPR_ERROR, "skipping already closed grpc_chttp2_stream header"));
656
655
  t->incoming_stream = nullptr;
657
- return init_header_skip_frame_parser(t, priority_type);
656
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
658
657
  }
659
658
  t->parser = grpc_chttp2_transport::Parser{
660
659
  "header", grpc_chttp2_header_parser_parse, &t->hpack_parser};
@@ -687,7 +686,7 @@ static grpc_error_handle init_header_frame_parser(grpc_chttp2_transport* t,
687
686
  break;
688
687
  case 2:
689
688
  gpr_log(GPR_ERROR, "too many header frames received");
690
- return init_header_skip_frame_parser(t, priority_type);
689
+ return init_header_skip_frame_parser(t, priority_type, is_eoh);
691
690
  }
692
691
  if (frame_type == HPackParser::LogInfo::kTrailers && !t->header_eof) {
693
692
  return GRPC_ERROR_CREATE(
@@ -815,8 +814,9 @@ static grpc_error_handle parse_frame_slice(grpc_chttp2_transport* t,
815
814
  &unused)) {
816
815
  grpc_chttp2_parsing_become_skip_parser(t);
817
816
  if (s) {
818
- grpc_chttp2_cancel_stream(t, s, std::exchange(err, absl::OkStatus()));
817
+ grpc_chttp2_cancel_stream(t, s, err);
819
818
  }
819
+ return absl::OkStatus();
820
820
  }
821
821
  return err;
822
822
  }
@@ -22,7 +22,7 @@ static const upb_MiniTableSub xds_data_orca_v3_OrcaLoadReport_submsgs[3] = {
22
22
  {.submsg = &xds_data_orca_v3_OrcaLoadReport_NamedMetricsEntry_msg_init},
23
23
  };
24
24
 
25
- static const upb_MiniTableField xds_data_orca_v3_OrcaLoadReport__fields[8] = {
25
+ static const upb_MiniTableField xds_data_orca_v3_OrcaLoadReport__fields[9] = {
26
26
  {1, UPB_SIZE(16, 0), 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
27
27
  {2, UPB_SIZE(24, 8), 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
28
28
  {3, UPB_SIZE(32, 16), 0, kUpb_NoSub, 4, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
@@ -31,12 +31,13 @@ static const upb_MiniTableField xds_data_orca_v3_OrcaLoadReport__fields[8] = {
31
31
  {6, 40, 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
32
32
  {7, 48, 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
33
33
  {8, UPB_SIZE(8, 56), 0, 2, 11, kUpb_FieldMode_Map | (UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
34
+ {9, UPB_SIZE(56, 64), 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)},
34
35
  };
35
36
 
36
37
  const upb_MiniTable xds_data_orca_v3_OrcaLoadReport_msg_init = {
37
38
  &xds_data_orca_v3_OrcaLoadReport_submsgs[0],
38
39
  &xds_data_orca_v3_OrcaLoadReport__fields[0],
39
- UPB_SIZE(56, 64), 8, kUpb_ExtMode_NonExtendable, 8, UPB_FASTTABLE_MASK(56), 0,
40
+ UPB_SIZE(64, 72), 9, kUpb_ExtMode_NonExtendable, 9, UPB_FASTTABLE_MASK(120), 0,
40
41
  UPB_FASTTABLE_INIT({
41
42
  {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
42
43
  {0x000000003f000009, &upb_psf8_1bt},
@@ -46,6 +47,14 @@ const upb_MiniTable xds_data_orca_v3_OrcaLoadReport_msg_init = {
46
47
  {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
47
48
  {0x002800003f000031, &upb_psf8_1bt},
48
49
  {0x003000003f000039, &upb_psf8_1bt},
50
+ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
51
+ {0x004000003f000049, &upb_psf8_1bt},
52
+ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
53
+ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
54
+ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
55
+ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
56
+ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
57
+ {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
49
58
  })
50
59
  };
51
60
 
@@ -189,6 +189,17 @@ UPB_INLINE const xds_data_orca_v3_OrcaLoadReport_NamedMetricsEntry* xds_data_orc
189
189
  if (!map) return NULL;
190
190
  return (const xds_data_orca_v3_OrcaLoadReport_NamedMetricsEntry*)_upb_map_next(map, iter);
191
191
  }
192
+ UPB_INLINE void xds_data_orca_v3_OrcaLoadReport_clear_application_utilization(xds_data_orca_v3_OrcaLoadReport* msg) {
193
+ const upb_MiniTableField field = {9, UPB_SIZE(56, 64), 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
194
+ _upb_Message_ClearNonExtensionField(msg, &field);
195
+ }
196
+ UPB_INLINE double xds_data_orca_v3_OrcaLoadReport_application_utilization(const xds_data_orca_v3_OrcaLoadReport* msg) {
197
+ double default_val = 0;
198
+ double ret;
199
+ const upb_MiniTableField field = {9, UPB_SIZE(56, 64), 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
200
+ _upb_Message_GetNonExtensionField(msg, &field, &default_val, &ret);
201
+ return ret;
202
+ }
192
203
 
193
204
  UPB_INLINE void xds_data_orca_v3_OrcaLoadReport_set_cpu_utilization(xds_data_orca_v3_OrcaLoadReport *msg, double value) {
194
205
  const upb_MiniTableField field = {1, UPB_SIZE(16, 0), 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
@@ -282,6 +293,10 @@ UPB_INLINE xds_data_orca_v3_OrcaLoadReport_NamedMetricsEntry* xds_data_orca_v3_O
282
293
  if (!map) return NULL;
283
294
  return (xds_data_orca_v3_OrcaLoadReport_NamedMetricsEntry*)_upb_map_next(map, iter);
284
295
  }
296
+ UPB_INLINE void xds_data_orca_v3_OrcaLoadReport_set_application_utilization(xds_data_orca_v3_OrcaLoadReport *msg, double value) {
297
+ const upb_MiniTableField field = {9, UPB_SIZE(56, 64), 0, kUpb_NoSub, 1, kUpb_FieldMode_Scalar | (kUpb_FieldRep_8Byte << kUpb_FieldRep_Shift)};
298
+ _upb_Message_SetNonExtensionField(msg, &field, &value);
299
+ }
285
300
 
286
301
  /* xds.data.orca.v3.OrcaLoadReport.RequestCostEntry */
287
302
 
@@ -22,11 +22,10 @@
22
22
 
23
23
  #include "absl/strings/str_cat.h"
24
24
 
25
+ #include <grpc/support/json.h>
25
26
  #include <grpc/support/log.h>
26
27
 
27
28
  #include "src/core/lib/config/core_configuration.h"
28
- #include "src/core/lib/gprpp/status_helper.h"
29
- #include "src/core/lib/iomgr/error.h"
30
29
  #include "src/core/lib/security/certificate_provider/certificate_provider_registry.h"
31
30
 
32
31
  namespace grpc_core {
@@ -45,7 +44,7 @@ CertificateProviderStore::PluginDefinition::JsonLoader(const JsonArgs&) {
45
44
  }
46
45
 
47
46
  void CertificateProviderStore::PluginDefinition::JsonPostLoad(
48
- const Json& json, const JsonArgs&, ValidationErrors* errors) {
47
+ const Json& json, const JsonArgs& args, ValidationErrors* errors) {
49
48
  // Check that plugin is supported.
50
49
  CertificateProviderFactory* factory = nullptr;
51
50
  if (!plugin_name.empty()) {
@@ -75,12 +74,8 @@ void CertificateProviderStore::PluginDefinition::JsonPostLoad(
75
74
  }
76
75
  if (factory == nullptr) return;
77
76
  // Use plugin to validate and parse config.
78
- grpc_error_handle parse_error;
79
- config =
80
- factory->CreateCertificateProviderConfig(config_json, &parse_error);
81
- if (!parse_error.ok()) {
82
- errors->AddError(StatusToString(parse_error));
83
- }
77
+ config = factory->CreateCertificateProviderConfig(
78
+ Json::FromObject(std::move(config_json)), args, errors);
84
79
  }
85
80
  }
86
81
 
@@ -55,7 +55,7 @@ class CertificateProviderStore
55
55
  RefCountedPtr<CertificateProviderFactory::Config> config;
56
56
 
57
57
  static const JsonLoaderInterface* JsonLoader(const JsonArgs&);
58
- void JsonPostLoad(const Json& json, const JsonArgs&,
58
+ void JsonPostLoad(const Json& json, const JsonArgs& args,
59
59
  ValidationErrors* errors);
60
60
  };
61
61