wearefair-grpc 1.3.1.pre.a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1161) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +1 -0
  3. data/Makefile +19484 -0
  4. data/etc/roots.pem +5288 -0
  5. data/include/grpc/byte_buffer.h +102 -0
  6. data/include/grpc/byte_buffer_reader.h +39 -0
  7. data/include/grpc/census.h +484 -0
  8. data/include/grpc/compression.h +85 -0
  9. data/include/grpc/grpc.h +509 -0
  10. data/include/grpc/grpc_cronet.h +51 -0
  11. data/include/grpc/grpc_posix.h +81 -0
  12. data/include/grpc/grpc_security.h +390 -0
  13. data/include/grpc/grpc_security_constants.h +114 -0
  14. data/include/grpc/impl/codegen/atm.h +100 -0
  15. data/include/grpc/impl/codegen/atm_gcc_atomic.h +97 -0
  16. data/include/grpc/impl/codegen/atm_gcc_sync.h +97 -0
  17. data/include/grpc/impl/codegen/atm_windows.h +140 -0
  18. data/include/grpc/impl/codegen/byte_buffer_reader.h +57 -0
  19. data/include/grpc/impl/codegen/compression_types.h +122 -0
  20. data/include/grpc/impl/codegen/connectivity_state.h +61 -0
  21. data/include/grpc/impl/codegen/exec_ctx_fwd.h +41 -0
  22. data/include/grpc/impl/codegen/gpr_slice.h +84 -0
  23. data/include/grpc/impl/codegen/gpr_types.h +75 -0
  24. data/include/grpc/impl/codegen/grpc_types.h +550 -0
  25. data/include/grpc/impl/codegen/port_platform.h +421 -0
  26. data/include/grpc/impl/codegen/propagation_bits.h +67 -0
  27. data/include/grpc/impl/codegen/slice.h +157 -0
  28. data/include/grpc/impl/codegen/status.h +163 -0
  29. data/include/grpc/impl/codegen/sync.h +75 -0
  30. data/include/grpc/impl/codegen/sync_generic.h +55 -0
  31. data/include/grpc/impl/codegen/sync_posix.h +47 -0
  32. data/include/grpc/impl/codegen/sync_windows.h +49 -0
  33. data/include/grpc/load_reporting.h +63 -0
  34. data/include/grpc/module.modulemap +13 -0
  35. data/include/grpc/slice.h +168 -0
  36. data/include/grpc/slice_buffer.h +94 -0
  37. data/include/grpc/status.h +39 -0
  38. data/include/grpc/support/alloc.h +82 -0
  39. data/include/grpc/support/atm.h +39 -0
  40. data/include/grpc/support/atm_gcc_atomic.h +39 -0
  41. data/include/grpc/support/atm_gcc_sync.h +39 -0
  42. data/include/grpc/support/atm_windows.h +39 -0
  43. data/include/grpc/support/avl.h +97 -0
  44. data/include/grpc/support/cmdline.h +103 -0
  45. data/include/grpc/support/cpu.h +59 -0
  46. data/include/grpc/support/histogram.h +79 -0
  47. data/include/grpc/support/host_port.h +66 -0
  48. data/include/grpc/support/log.h +118 -0
  49. data/include/grpc/support/log_windows.h +53 -0
  50. data/include/grpc/support/port_platform.h +39 -0
  51. data/include/grpc/support/string_util.h +64 -0
  52. data/include/grpc/support/subprocess.h +59 -0
  53. data/include/grpc/support/sync.h +295 -0
  54. data/include/grpc/support/sync_generic.h +39 -0
  55. data/include/grpc/support/sync_posix.h +39 -0
  56. data/include/grpc/support/sync_windows.h +39 -0
  57. data/include/grpc/support/thd.h +91 -0
  58. data/include/grpc/support/time.h +105 -0
  59. data/include/grpc/support/tls.h +77 -0
  60. data/include/grpc/support/tls_gcc.h +100 -0
  61. data/include/grpc/support/tls_msvc.h +56 -0
  62. data/include/grpc/support/tls_pthread.h +60 -0
  63. data/include/grpc/support/useful.h +80 -0
  64. data/src/boringssl/err_data.c +1270 -0
  65. data/src/core/ext/census/aggregation.h +66 -0
  66. data/src/core/ext/census/base_resources.c +71 -0
  67. data/src/core/ext/census/base_resources.h +39 -0
  68. data/src/core/ext/census/census_interface.h +76 -0
  69. data/src/core/ext/census/census_rpc_stats.h +101 -0
  70. data/src/core/ext/census/context.c +509 -0
  71. data/src/core/ext/census/gen/census.pb.c +176 -0
  72. data/src/core/ext/census/gen/census.pb.h +295 -0
  73. data/src/core/ext/census/gen/trace_context.pb.c +54 -0
  74. data/src/core/ext/census/gen/trace_context.pb.h +93 -0
  75. data/src/core/ext/census/grpc_context.c +53 -0
  76. data/src/core/ext/census/grpc_filter.c +213 -0
  77. data/src/core/ext/census/grpc_filter.h +44 -0
  78. data/src/core/ext/census/grpc_plugin.c +85 -0
  79. data/src/core/ext/census/initialize.c +66 -0
  80. data/src/core/ext/census/mlog.c +600 -0
  81. data/src/core/ext/census/mlog.h +95 -0
  82. data/src/core/ext/census/operation.c +63 -0
  83. data/src/core/ext/census/placeholders.c +64 -0
  84. data/src/core/ext/census/resource.c +312 -0
  85. data/src/core/ext/census/resource.h +63 -0
  86. data/src/core/ext/census/rpc_metric_id.h +51 -0
  87. data/src/core/ext/census/trace_context.c +86 -0
  88. data/src/core/ext/census/trace_context.h +71 -0
  89. data/src/core/ext/census/trace_label.h +61 -0
  90. data/src/core/ext/census/trace_propagation.h +63 -0
  91. data/src/core/ext/census/trace_status.h +45 -0
  92. data/src/core/ext/census/trace_string.h +50 -0
  93. data/src/core/ext/census/tracing.c +71 -0
  94. data/src/core/ext/census/tracing.h +124 -0
  95. data/src/core/ext/filters/client_channel/channel_connectivity.c +226 -0
  96. data/src/core/ext/filters/client_channel/client_channel.c +1410 -0
  97. data/src/core/ext/filters/client_channel/client_channel.h +64 -0
  98. data/src/core/ext/filters/client_channel/client_channel_factory.c +87 -0
  99. data/src/core/ext/filters/client_channel/client_channel_factory.h +92 -0
  100. data/src/core/ext/filters/client_channel/client_channel_plugin.c +106 -0
  101. data/src/core/ext/filters/client_channel/connector.c +55 -0
  102. data/src/core/ext/filters/client_channel/connector.h +88 -0
  103. data/src/core/ext/filters/client_channel/http_connect_handshaker.c +389 -0
  104. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +49 -0
  105. data/src/core/ext/filters/client_channel/http_proxy.c +125 -0
  106. data/src/core/ext/filters/client_channel/http_proxy.h +39 -0
  107. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +1419 -0
  108. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +44 -0
  109. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +57 -0
  110. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.c +107 -0
  111. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +249 -0
  112. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +105 -0
  113. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +88 -0
  114. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +158 -0
  115. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +476 -0
  116. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +795 -0
  117. data/src/core/ext/filters/client_channel/lb_policy.c +167 -0
  118. data/src/core/ext/filters/client_channel/lb_policy.h +209 -0
  119. data/src/core/ext/filters/client_channel/lb_policy_factory.c +163 -0
  120. data/src/core/ext/filters/client_channel/lb_policy_factory.h +134 -0
  121. data/src/core/ext/filters/client_channel/lb_policy_registry.c +85 -0
  122. data/src/core/ext/filters/client_channel/lb_policy_registry.h +55 -0
  123. data/src/core/ext/filters/client_channel/parse_address.c +170 -0
  124. data/src/core/ext/filters/client_channel/parse_address.h +54 -0
  125. data/src/core/ext/filters/client_channel/proxy_mapper.c +63 -0
  126. data/src/core/ext/filters/client_channel/proxy_mapper.h +89 -0
  127. data/src/core/ext/filters/client_channel/proxy_mapper_registry.c +139 -0
  128. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +59 -0
  129. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +350 -0
  130. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +66 -0
  131. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c +319 -0
  132. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +289 -0
  133. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +64 -0
  134. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.c +325 -0
  135. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +234 -0
  136. data/src/core/ext/filters/client_channel/resolver.c +88 -0
  137. data/src/core/ext/filters/client_channel/resolver.h +101 -0
  138. data/src/core/ext/filters/client_channel/resolver_factory.c +56 -0
  139. data/src/core/ext/filters/client_channel/resolver_factory.h +85 -0
  140. data/src/core/ext/filters/client_channel/resolver_registry.c +174 -0
  141. data/src/core/ext/filters/client_channel/resolver_registry.h +84 -0
  142. data/src/core/ext/filters/client_channel/retry_throttle.c +210 -0
  143. data/src/core/ext/filters/client_channel/retry_throttle.h +65 -0
  144. data/src/core/ext/filters/client_channel/subchannel.c +835 -0
  145. data/src/core/ext/filters/client_channel/subchannel.h +203 -0
  146. data/src/core/ext/filters/client_channel/subchannel_index.c +262 -0
  147. data/src/core/ext/filters/client_channel/subchannel_index.h +77 -0
  148. data/src/core/ext/filters/client_channel/uri_parser.c +315 -0
  149. data/src/core/ext/filters/client_channel/uri_parser.h +65 -0
  150. data/src/core/ext/filters/load_reporting/load_reporting.c +106 -0
  151. data/src/core/ext/filters/load_reporting/load_reporting.h +73 -0
  152. data/src/core/ext/filters/load_reporting/load_reporting_filter.c +218 -0
  153. data/src/core/ext/filters/load_reporting/load_reporting_filter.h +42 -0
  154. data/src/core/ext/filters/max_age/max_age_filter.c +439 -0
  155. data/src/core/ext/filters/max_age/max_age_filter.h +39 -0
  156. data/src/core/ext/transport/chttp2/alpn/alpn.c +56 -0
  157. data/src/core/ext/transport/chttp2/alpn/alpn.h +49 -0
  158. data/src/core/ext/transport/chttp2/client/chttp2_connector.c +221 -0
  159. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +41 -0
  160. data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +121 -0
  161. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c +95 -0
  162. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c +239 -0
  163. data/src/core/ext/transport/chttp2/server/chttp2_server.c +304 -0
  164. data/src/core/ext/transport/chttp2/server/chttp2_server.h +47 -0
  165. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c +59 -0
  166. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c +90 -0
  167. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c +101 -0
  168. data/src/core/ext/transport/chttp2/transport/bin_decoder.c +236 -0
  169. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +67 -0
  170. data/src/core/ext/transport/chttp2/transport/bin_encoder.c +241 -0
  171. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +54 -0
  172. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.c +43 -0
  173. data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +2847 -0
  174. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +53 -0
  175. data/src/core/ext/transport/chttp2/transport/frame.h +61 -0
  176. data/src/core/ext/transport/chttp2/transport/frame_data.c +287 -0
  177. data/src/core/ext/transport/chttp2/transport/frame_data.h +104 -0
  178. data/src/core/ext/transport/chttp2/transport/frame_goaway.c +198 -0
  179. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +78 -0
  180. data/src/core/ext/transport/chttp2/transport/frame_ping.c +145 -0
  181. data/src/core/ext/transport/chttp2/transport/frame_ping.h +59 -0
  182. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +125 -0
  183. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +58 -0
  184. data/src/core/ext/transport/chttp2/transport/frame_settings.c +239 -0
  185. data/src/core/ext/transport/chttp2/transport/frame_settings.h +76 -0
  186. data/src/core/ext/transport/chttp2/transport/frame_window_update.c +134 -0
  187. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +57 -0
  188. data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +661 -0
  189. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +107 -0
  190. data/src/core/ext/transport/chttp2/transport/hpack_parser.c +1734 -0
  191. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +129 -0
  192. data/src/core/ext/transport/chttp2/transport/hpack_table.c +383 -0
  193. data/src/core/ext/transport/chttp2/transport/hpack_table.h +112 -0
  194. data/src/core/ext/transport/chttp2/transport/http2_settings.c +75 -0
  195. data/src/core/ext/transport/chttp2/transport/http2_settings.h +74 -0
  196. data/src/core/ext/transport/chttp2/transport/huffsyms.c +105 -0
  197. data/src/core/ext/transport/chttp2/transport/huffsyms.h +48 -0
  198. data/src/core/ext/transport/chttp2/transport/incoming_metadata.c +88 -0
  199. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +63 -0
  200. data/src/core/ext/transport/chttp2/transport/internal.h +852 -0
  201. data/src/core/ext/transport/chttp2/transport/parsing.c +825 -0
  202. data/src/core/ext/transport/chttp2/transport/stream_lists.c +194 -0
  203. data/src/core/ext/transport/chttp2/transport/stream_map.c +176 -0
  204. data/src/core/ext/transport/chttp2/transport/stream_map.h +83 -0
  205. data/src/core/ext/transport/chttp2/transport/varint.c +65 -0
  206. data/src/core/ext/transport/chttp2/transport/varint.h +75 -0
  207. data/src/core/ext/transport/chttp2/transport/writing.c +429 -0
  208. data/src/core/lib/channel/channel_args.c +355 -0
  209. data/src/core/lib/channel/channel_args.h +126 -0
  210. data/src/core/lib/channel/channel_stack.c +291 -0
  211. data/src/core/lib/channel/channel_stack.h +319 -0
  212. data/src/core/lib/channel/channel_stack_builder.c +284 -0
  213. data/src/core/lib/channel/channel_stack_builder.h +170 -0
  214. data/src/core/lib/channel/compress_filter.c +353 -0
  215. data/src/core/lib/channel/compress_filter.h +67 -0
  216. data/src/core/lib/channel/connected_channel.c +188 -0
  217. data/src/core/lib/channel/connected_channel.h +48 -0
  218. data/src/core/lib/channel/context.h +64 -0
  219. data/src/core/lib/channel/deadline_filter.c +348 -0
  220. data/src/core/lib/channel/deadline_filter.h +102 -0
  221. data/src/core/lib/channel/handshaker.c +281 -0
  222. data/src/core/lib/channel/handshaker.h +182 -0
  223. data/src/core/lib/channel/handshaker_factory.c +54 -0
  224. data/src/core/lib/channel/handshaker_factory.h +66 -0
  225. data/src/core/lib/channel/handshaker_registry.c +113 -0
  226. data/src/core/lib/channel/handshaker_registry.h +63 -0
  227. data/src/core/lib/channel/http_client_filter.c +601 -0
  228. data/src/core/lib/channel/http_client_filter.h +47 -0
  229. data/src/core/lib/channel/http_server_filter.c +445 -0
  230. data/src/core/lib/channel/http_server_filter.h +42 -0
  231. data/src/core/lib/channel/message_size_filter.c +270 -0
  232. data/src/core/lib/channel/message_size_filter.h +39 -0
  233. data/src/core/lib/compression/algorithm_metadata.h +53 -0
  234. data/src/core/lib/compression/compression.c +198 -0
  235. data/src/core/lib/compression/message_compress.c +204 -0
  236. data/src/core/lib/compression/message_compress.h +54 -0
  237. data/src/core/lib/debug/trace.c +140 -0
  238. data/src/core/lib/debug/trace.h +43 -0
  239. data/src/core/lib/http/format_request.c +135 -0
  240. data/src/core/lib/http/format_request.h +47 -0
  241. data/src/core/lib/http/httpcli.c +336 -0
  242. data/src/core/lib/http/httpcli.h +141 -0
  243. data/src/core/lib/http/httpcli_security_connector.c +199 -0
  244. data/src/core/lib/http/parser.c +379 -0
  245. data/src/core/lib/http/parser.h +126 -0
  246. data/src/core/lib/iomgr/closure.c +168 -0
  247. data/src/core/lib/iomgr/closure.h +153 -0
  248. data/src/core/lib/iomgr/combiner.c +460 -0
  249. data/src/core/lib/iomgr/combiner.h +83 -0
  250. data/src/core/lib/iomgr/endpoint.c +78 -0
  251. data/src/core/lib/iomgr/endpoint.h +117 -0
  252. data/src/core/lib/iomgr/endpoint_pair.h +47 -0
  253. data/src/core/lib/iomgr/endpoint_pair_posix.c +87 -0
  254. data/src/core/lib/iomgr/endpoint_pair_uv.c +53 -0
  255. data/src/core/lib/iomgr/endpoint_pair_windows.c +101 -0
  256. data/src/core/lib/iomgr/error.c +793 -0
  257. data/src/core/lib/iomgr/error.h +218 -0
  258. data/src/core/lib/iomgr/error_internal.h +75 -0
  259. data/src/core/lib/iomgr/ev_epoll_linux.c +1965 -0
  260. data/src/core/lib/iomgr/ev_epoll_linux.h +48 -0
  261. data/src/core/lib/iomgr/ev_poll_posix.c +1593 -0
  262. data/src/core/lib/iomgr/ev_poll_posix.h +42 -0
  263. data/src/core/lib/iomgr/ev_posix.c +287 -0
  264. data/src/core/lib/iomgr/ev_posix.h +189 -0
  265. data/src/core/lib/iomgr/exec_ctx.c +117 -0
  266. data/src/core/lib/iomgr/exec_ctx.h +117 -0
  267. data/src/core/lib/iomgr/executor.c +170 -0
  268. data/src/core/lib/iomgr/executor.h +51 -0
  269. data/src/core/lib/iomgr/iocp_windows.c +168 -0
  270. data/src/core/lib/iomgr/iocp_windows.h +55 -0
  271. data/src/core/lib/iomgr/iomgr.c +183 -0
  272. data/src/core/lib/iomgr/iomgr.h +47 -0
  273. data/src/core/lib/iomgr/iomgr_internal.h +58 -0
  274. data/src/core/lib/iomgr/iomgr_posix.c +56 -0
  275. data/src/core/lib/iomgr/iomgr_posix.h +39 -0
  276. data/src/core/lib/iomgr/iomgr_uv.c +49 -0
  277. data/src/core/lib/iomgr/iomgr_windows.c +76 -0
  278. data/src/core/lib/iomgr/load_file.c +92 -0
  279. data/src/core/lib/iomgr/load_file.h +56 -0
  280. data/src/core/lib/iomgr/lockfree_event.c +238 -0
  281. data/src/core/lib/iomgr/lockfree_event.h +54 -0
  282. data/src/core/lib/iomgr/network_status_tracker.c +48 -0
  283. data/src/core/lib/iomgr/network_status_tracker.h +45 -0
  284. data/src/core/lib/iomgr/polling_entity.c +104 -0
  285. data/src/core/lib/iomgr/polling_entity.h +81 -0
  286. data/src/core/lib/iomgr/pollset.h +97 -0
  287. data/src/core/lib/iomgr/pollset_set.h +62 -0
  288. data/src/core/lib/iomgr/pollset_set_uv.c +63 -0
  289. data/src/core/lib/iomgr/pollset_set_windows.c +64 -0
  290. data/src/core/lib/iomgr/pollset_set_windows.h +39 -0
  291. data/src/core/lib/iomgr/pollset_uv.c +156 -0
  292. data/src/core/lib/iomgr/pollset_uv.h +42 -0
  293. data/src/core/lib/iomgr/pollset_windows.c +232 -0
  294. data/src/core/lib/iomgr/pollset_windows.h +78 -0
  295. data/src/core/lib/iomgr/port.h +138 -0
  296. data/src/core/lib/iomgr/resolve_address.h +70 -0
  297. data/src/core/lib/iomgr/resolve_address_posix.c +207 -0
  298. data/src/core/lib/iomgr/resolve_address_uv.c +284 -0
  299. data/src/core/lib/iomgr/resolve_address_windows.c +190 -0
  300. data/src/core/lib/iomgr/resource_quota.c +877 -0
  301. data/src/core/lib/iomgr/resource_quota.h +167 -0
  302. data/src/core/lib/iomgr/sockaddr.h +55 -0
  303. data/src/core/lib/iomgr/sockaddr_posix.h +44 -0
  304. data/src/core/lib/iomgr/sockaddr_utils.c +272 -0
  305. data/src/core/lib/iomgr/sockaddr_utils.h +93 -0
  306. data/src/core/lib/iomgr/sockaddr_windows.h +43 -0
  307. data/src/core/lib/iomgr/socket_factory_posix.c +110 -0
  308. data/src/core/lib/iomgr/socket_factory_posix.h +90 -0
  309. data/src/core/lib/iomgr/socket_mutator.c +98 -0
  310. data/src/core/lib/iomgr/socket_mutator.h +80 -0
  311. data/src/core/lib/iomgr/socket_utils.h +42 -0
  312. data/src/core/lib/iomgr/socket_utils_common_posix.c +330 -0
  313. data/src/core/lib/iomgr/socket_utils_linux.c +57 -0
  314. data/src/core/lib/iomgr/socket_utils_posix.c +73 -0
  315. data/src/core/lib/iomgr/socket_utils_posix.h +147 -0
  316. data/src/core/lib/iomgr/socket_utils_uv.c +49 -0
  317. data/src/core/lib/iomgr/socket_utils_windows.c +52 -0
  318. data/src/core/lib/iomgr/socket_windows.c +167 -0
  319. data/src/core/lib/iomgr/socket_windows.h +125 -0
  320. data/src/core/lib/iomgr/tcp_client.h +55 -0
  321. data/src/core/lib/iomgr/tcp_client_posix.c +368 -0
  322. data/src/core/lib/iomgr/tcp_client_posix.h +45 -0
  323. data/src/core/lib/iomgr/tcp_client_uv.c +192 -0
  324. data/src/core/lib/iomgr/tcp_client_windows.c +260 -0
  325. data/src/core/lib/iomgr/tcp_posix.c +677 -0
  326. data/src/core/lib/iomgr/tcp_posix.h +70 -0
  327. data/src/core/lib/iomgr/tcp_server.h +116 -0
  328. data/src/core/lib/iomgr/tcp_server_posix.c +579 -0
  329. data/src/core/lib/iomgr/tcp_server_utils_posix.h +135 -0
  330. data/src/core/lib/iomgr/tcp_server_utils_posix_common.c +221 -0
  331. data/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.c +196 -0
  332. data/src/core/lib/iomgr/tcp_server_utils_posix_noifaddrs.c +49 -0
  333. data/src/core/lib/iomgr/tcp_server_uv.c +393 -0
  334. data/src/core/lib/iomgr/tcp_server_windows.c +558 -0
  335. data/src/core/lib/iomgr/tcp_uv.c +374 -0
  336. data/src/core/lib/iomgr/tcp_uv.h +59 -0
  337. data/src/core/lib/iomgr/tcp_windows.c +462 -0
  338. data/src/core/lib/iomgr/tcp_windows.h +59 -0
  339. data/src/core/lib/iomgr/time_averaged_stats.c +77 -0
  340. data/src/core/lib/iomgr/time_averaged_stats.h +88 -0
  341. data/src/core/lib/iomgr/timer.h +111 -0
  342. data/src/core/lib/iomgr/timer_generic.c +567 -0
  343. data/src/core/lib/iomgr/timer_generic.h +49 -0
  344. data/src/core/lib/iomgr/timer_heap.c +152 -0
  345. data/src/core/lib/iomgr/timer_heap.h +57 -0
  346. data/src/core/lib/iomgr/timer_uv.c +103 -0
  347. data/src/core/lib/iomgr/timer_uv.h +47 -0
  348. data/src/core/lib/iomgr/udp_server.c +529 -0
  349. data/src/core/lib/iomgr/udp_server.h +89 -0
  350. data/src/core/lib/iomgr/unix_sockets_posix.c +108 -0
  351. data/src/core/lib/iomgr/unix_sockets_posix.h +56 -0
  352. data/src/core/lib/iomgr/unix_sockets_posix_noop.c +62 -0
  353. data/src/core/lib/iomgr/wakeup_fd_cv.c +118 -0
  354. data/src/core/lib/iomgr/wakeup_fd_cv.h +80 -0
  355. data/src/core/lib/iomgr/wakeup_fd_eventfd.c +97 -0
  356. data/src/core/lib/iomgr/wakeup_fd_nospecial.c +51 -0
  357. data/src/core/lib/iomgr/wakeup_fd_pipe.c +112 -0
  358. data/src/core/lib/iomgr/wakeup_fd_pipe.h +41 -0
  359. data/src/core/lib/iomgr/wakeup_fd_posix.c +101 -0
  360. data/src/core/lib/iomgr/wakeup_fd_posix.h +109 -0
  361. data/src/core/lib/iomgr/workqueue.h +87 -0
  362. data/src/core/lib/iomgr/workqueue_uv.c +65 -0
  363. data/src/core/lib/iomgr/workqueue_uv.h +37 -0
  364. data/src/core/lib/iomgr/workqueue_windows.c +63 -0
  365. data/src/core/lib/iomgr/workqueue_windows.h +37 -0
  366. data/src/core/lib/json/json.c +63 -0
  367. data/src/core/lib/json/json.h +88 -0
  368. data/src/core/lib/json/json_common.h +49 -0
  369. data/src/core/lib/json/json_reader.c +675 -0
  370. data/src/core/lib/json/json_reader.h +160 -0
  371. data/src/core/lib/json/json_string.c +379 -0
  372. data/src/core/lib/json/json_writer.c +258 -0
  373. data/src/core/lib/json/json_writer.h +97 -0
  374. data/src/core/lib/profiling/basic_timers.c +298 -0
  375. data/src/core/lib/profiling/stap_timers.c +65 -0
  376. data/src/core/lib/profiling/timers.h +121 -0
  377. data/src/core/lib/security/context/security_context.c +350 -0
  378. data/src/core/lib/security/context/security_context.h +134 -0
  379. data/src/core/lib/security/credentials/composite/composite_credentials.c +274 -0
  380. data/src/core/lib/security/credentials/composite/composite_credentials.h +72 -0
  381. data/src/core/lib/security/credentials/credentials.c +308 -0
  382. data/src/core/lib/security/credentials/credentials.h +268 -0
  383. data/src/core/lib/security/credentials/credentials_metadata.c +103 -0
  384. data/src/core/lib/security/credentials/fake/fake_credentials.c +141 -0
  385. data/src/core/lib/security/credentials/fake/fake_credentials.h +71 -0
  386. data/src/core/lib/security/credentials/google_default/credentials_generic.c +54 -0
  387. data/src/core/lib/security/credentials/google_default/google_default_credentials.c +337 -0
  388. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +60 -0
  389. data/src/core/lib/security/credentials/iam/iam_credentials.c +85 -0
  390. data/src/core/lib/security/credentials/iam/iam_credentials.h +44 -0
  391. data/src/core/lib/security/credentials/jwt/json_token.c +321 -0
  392. data/src/core/lib/security/credentials/jwt/json_token.h +88 -0
  393. data/src/core/lib/security/credentials/jwt/jwt_credentials.c +195 -0
  394. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +63 -0
  395. data/src/core/lib/security/credentials/jwt/jwt_verifier.c +910 -0
  396. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +140 -0
  397. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +468 -0
  398. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +109 -0
  399. data/src/core/lib/security/credentials/plugin/plugin_credentials.c +153 -0
  400. data/src/core/lib/security/credentials/plugin/plugin_credentials.h +45 -0
  401. data/src/core/lib/security/credentials/ssl/ssl_credentials.c +242 -0
  402. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +48 -0
  403. data/src/core/lib/security/transport/auth_filters.h +42 -0
  404. data/src/core/lib/security/transport/client_auth_filter.c +384 -0
  405. data/src/core/lib/security/transport/lb_targets_info.c +70 -0
  406. data/src/core/lib/security/transport/lb_targets_info.h +47 -0
  407. data/src/core/lib/security/transport/secure_endpoint.c +427 -0
  408. data/src/core/lib/security/transport/secure_endpoint.h +49 -0
  409. data/src/core/lib/security/transport/security_connector.c +909 -0
  410. data/src/core/lib/security/transport/security_connector.h +252 -0
  411. data/src/core/lib/security/transport/security_handshaker.c +507 -0
  412. data/src/core/lib/security/transport/security_handshaker.h +49 -0
  413. data/src/core/lib/security/transport/server_auth_filter.c +277 -0
  414. data/src/core/lib/security/transport/tsi_error.c +42 -0
  415. data/src/core/lib/security/transport/tsi_error.h +42 -0
  416. data/src/core/lib/security/util/json_util.c +61 -0
  417. data/src/core/lib/security/util/json_util.h +55 -0
  418. data/src/core/lib/slice/b64.c +251 -0
  419. data/src/core/lib/slice/b64.h +65 -0
  420. data/src/core/lib/slice/percent_encoding.c +182 -0
  421. data/src/core/lib/slice/percent_encoding.h +78 -0
  422. data/src/core/lib/slice/slice.c +466 -0
  423. data/src/core/lib/slice/slice_buffer.c +355 -0
  424. data/src/core/lib/slice/slice_hash_table.c +125 -0
  425. data/src/core/lib/slice/slice_hash_table.h +77 -0
  426. data/src/core/lib/slice/slice_intern.c +346 -0
  427. data/src/core/lib/slice/slice_internal.h +64 -0
  428. data/src/core/lib/slice/slice_string_helpers.c +95 -0
  429. data/src/core/lib/slice/slice_string_helpers.h +63 -0
  430. data/src/core/lib/support/alloc.c +117 -0
  431. data/src/core/lib/support/arena.c +98 -0
  432. data/src/core/lib/support/arena.h +54 -0
  433. data/src/core/lib/support/atm.c +47 -0
  434. data/src/core/lib/support/avl.c +299 -0
  435. data/src/core/lib/support/backoff.c +87 -0
  436. data/src/core/lib/support/backoff.h +71 -0
  437. data/src/core/lib/support/block_annotate.h +48 -0
  438. data/src/core/lib/support/cmdline.c +345 -0
  439. data/src/core/lib/support/cpu_iphone.c +49 -0
  440. data/src/core/lib/support/cpu_linux.c +83 -0
  441. data/src/core/lib/support/cpu_posix.c +72 -0
  442. data/src/core/lib/support/cpu_windows.c +47 -0
  443. data/src/core/lib/support/env.h +58 -0
  444. data/src/core/lib/support/env_linux.c +89 -0
  445. data/src/core/lib/support/env_posix.c +57 -0
  446. data/src/core/lib/support/env_windows.c +79 -0
  447. data/src/core/lib/support/histogram.c +243 -0
  448. data/src/core/lib/support/host_port.c +110 -0
  449. data/src/core/lib/support/log.c +103 -0
  450. data/src/core/lib/support/log_android.c +87 -0
  451. data/src/core/lib/support/log_linux.c +105 -0
  452. data/src/core/lib/support/log_posix.c +106 -0
  453. data/src/core/lib/support/log_windows.c +112 -0
  454. data/src/core/lib/support/mpscq.c +83 -0
  455. data/src/core/lib/support/mpscq.h +65 -0
  456. data/src/core/lib/support/murmur_hash.c +94 -0
  457. data/src/core/lib/support/murmur_hash.h +44 -0
  458. data/src/core/lib/support/spinlock.h +52 -0
  459. data/src/core/lib/support/stack_lockfree.c +185 -0
  460. data/src/core/lib/support/stack_lockfree.h +53 -0
  461. data/src/core/lib/support/string.c +315 -0
  462. data/src/core/lib/support/string.h +128 -0
  463. data/src/core/lib/support/string_posix.c +86 -0
  464. data/src/core/lib/support/string_util_windows.c +94 -0
  465. data/src/core/lib/support/string_windows.c +83 -0
  466. data/src/core/lib/support/string_windows.h +47 -0
  467. data/src/core/lib/support/subprocess_posix.c +114 -0
  468. data/src/core/lib/support/subprocess_windows.c +141 -0
  469. data/src/core/lib/support/sync.c +137 -0
  470. data/src/core/lib/support/sync_posix.c +113 -0
  471. data/src/core/lib/support/sync_windows.c +133 -0
  472. data/src/core/lib/support/thd.c +64 -0
  473. data/src/core/lib/support/thd_internal.h +39 -0
  474. data/src/core/lib/support/thd_posix.c +95 -0
  475. data/src/core/lib/support/thd_windows.c +117 -0
  476. data/src/core/lib/support/time.c +262 -0
  477. data/src/core/lib/support/time_posix.c +176 -0
  478. data/src/core/lib/support/time_precise.c +89 -0
  479. data/src/core/lib/support/time_precise.h +42 -0
  480. data/src/core/lib/support/time_windows.c +116 -0
  481. data/src/core/lib/support/tls_pthread.c +45 -0
  482. data/src/core/lib/support/tmpfile.h +53 -0
  483. data/src/core/lib/support/tmpfile_msys.c +73 -0
  484. data/src/core/lib/support/tmpfile_posix.c +85 -0
  485. data/src/core/lib/support/tmpfile_windows.c +84 -0
  486. data/src/core/lib/support/wrap_memcpy.c +55 -0
  487. data/src/core/lib/surface/alarm.c +87 -0
  488. data/src/core/lib/surface/api_trace.c +36 -0
  489. data/src/core/lib/surface/api_trace.h +65 -0
  490. data/src/core/lib/surface/byte_buffer.c +103 -0
  491. data/src/core/lib/surface/byte_buffer_reader.c +140 -0
  492. data/src/core/lib/surface/call.c +1835 -0
  493. data/src/core/lib/surface/call.h +135 -0
  494. data/src/core/lib/surface/call_details.c +56 -0
  495. data/src/core/lib/surface/call_log_batch.c +131 -0
  496. data/src/core/lib/surface/call_test_only.h +64 -0
  497. data/src/core/lib/surface/channel.c +434 -0
  498. data/src/core/lib/surface/channel.h +99 -0
  499. data/src/core/lib/surface/channel_init.c +140 -0
  500. data/src/core/lib/surface/channel_init.h +96 -0
  501. data/src/core/lib/surface/channel_ping.c +80 -0
  502. data/src/core/lib/surface/channel_stack_type.c +54 -0
  503. data/src/core/lib/surface/channel_stack_type.h +58 -0
  504. data/src/core/lib/surface/completion_queue.c +692 -0
  505. data/src/core/lib/surface/completion_queue.h +102 -0
  506. data/src/core/lib/surface/completion_queue_factory.c +77 -0
  507. data/src/core/lib/surface/completion_queue_factory.h +51 -0
  508. data/src/core/lib/surface/event_string.c +81 -0
  509. data/src/core/lib/surface/event_string.h +42 -0
  510. data/src/core/lib/surface/init.c +261 -0
  511. data/src/core/lib/surface/init.h +42 -0
  512. data/src/core/lib/surface/init_secure.c +94 -0
  513. data/src/core/lib/surface/lame_client.c +188 -0
  514. data/src/core/lib/surface/lame_client.h +41 -0
  515. data/src/core/lib/surface/metadata_array.c +49 -0
  516. data/src/core/lib/surface/server.c +1529 -0
  517. data/src/core/lib/surface/server.h +71 -0
  518. data/src/core/lib/surface/validate_metadata.c +108 -0
  519. data/src/core/lib/surface/validate_metadata.h +43 -0
  520. data/src/core/lib/surface/version.c +41 -0
  521. data/src/core/lib/transport/bdp_estimator.c +104 -0
  522. data/src/core/lib/transport/bdp_estimator.h +76 -0
  523. data/src/core/lib/transport/byte_stream.c +81 -0
  524. data/src/core/lib/transport/byte_stream.h +85 -0
  525. data/src/core/lib/transport/connectivity_state.c +219 -0
  526. data/src/core/lib/transport/connectivity_state.h +101 -0
  527. data/src/core/lib/transport/error_utils.c +124 -0
  528. data/src/core/lib/transport/error_utils.h +56 -0
  529. data/src/core/lib/transport/http2_errors.h +56 -0
  530. data/src/core/lib/transport/metadata.c +529 -0
  531. data/src/core/lib/transport/metadata.h +186 -0
  532. data/src/core/lib/transport/metadata_batch.c +328 -0
  533. data/src/core/lib/transport/metadata_batch.h +166 -0
  534. data/src/core/lib/transport/pid_controller.c +78 -0
  535. data/src/core/lib/transport/pid_controller.h +77 -0
  536. data/src/core/lib/transport/service_config.c +266 -0
  537. data/src/core/lib/transport/service_config.h +77 -0
  538. data/src/core/lib/transport/static_metadata.c +801 -0
  539. data/src/core/lib/transport/static_metadata.h +557 -0
  540. data/src/core/lib/transport/status_conversion.c +113 -0
  541. data/src/core/lib/transport/status_conversion.h +49 -0
  542. data/src/core/lib/transport/timeout_encoding.c +190 -0
  543. data/src/core/lib/transport/timeout_encoding.h +49 -0
  544. data/src/core/lib/transport/transport.c +282 -0
  545. data/src/core/lib/transport/transport.h +354 -0
  546. data/src/core/lib/transport/transport_impl.h +90 -0
  547. data/src/core/lib/transport/transport_op_string.c +217 -0
  548. data/src/core/plugin_registry/grpc_plugin_registry.c +82 -0
  549. data/src/core/tsi/fake_transport_security.c +527 -0
  550. data/src/core/tsi/fake_transport_security.h +61 -0
  551. data/src/core/tsi/ssl_transport_security.c +1533 -0
  552. data/src/core/tsi/ssl_transport_security.h +214 -0
  553. data/src/core/tsi/ssl_types.h +55 -0
  554. data/src/core/tsi/transport_security.c +266 -0
  555. data/src/core/tsi/transport_security.h +111 -0
  556. data/src/core/tsi/transport_security_interface.h +353 -0
  557. data/src/ruby/bin/apis/google/protobuf/empty.rb +44 -0
  558. data/src/ruby/bin/apis/pubsub_demo.rb +256 -0
  559. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +174 -0
  560. data/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +103 -0
  561. data/src/ruby/bin/math_client.rb +147 -0
  562. data/src/ruby/bin/math_pb.rb +32 -0
  563. data/src/ruby/bin/math_server.rb +206 -0
  564. data/src/ruby/bin/math_services_pb.rb +66 -0
  565. data/src/ruby/bin/noproto_client.rb +108 -0
  566. data/src/ruby/bin/noproto_server.rb +112 -0
  567. data/src/ruby/ext/grpc/extconf.rb +131 -0
  568. data/src/ruby/ext/grpc/rb_byte_buffer.c +77 -0
  569. data/src/ruby/ext/grpc/rb_byte_buffer.h +50 -0
  570. data/src/ruby/ext/grpc/rb_call.c +1009 -0
  571. data/src/ruby/ext/grpc/rb_call.h +66 -0
  572. data/src/ruby/ext/grpc/rb_call_credentials.c +295 -0
  573. data/src/ruby/ext/grpc/rb_call_credentials.h +46 -0
  574. data/src/ruby/ext/grpc/rb_channel.c +662 -0
  575. data/src/ruby/ext/grpc/rb_channel.h +49 -0
  576. data/src/ruby/ext/grpc/rb_channel_args.c +168 -0
  577. data/src/ruby/ext/grpc/rb_channel_args.h +53 -0
  578. data/src/ruby/ext/grpc/rb_channel_credentials.c +268 -0
  579. data/src/ruby/ext/grpc/rb_channel_credentials.h +47 -0
  580. data/src/ruby/ext/grpc/rb_completion_queue.c +117 -0
  581. data/src/ruby/ext/grpc/rb_completion_queue.h +51 -0
  582. data/src/ruby/ext/grpc/rb_compression_options.c +472 -0
  583. data/src/ruby/ext/grpc/rb_compression_options.h +44 -0
  584. data/src/ruby/ext/grpc/rb_event_thread.c +158 -0
  585. data/src/ruby/ext/grpc/rb_event_thread.h +37 -0
  586. data/src/ruby/ext/grpc/rb_grpc.c +343 -0
  587. data/src/ruby/ext/grpc/rb_grpc.h +87 -0
  588. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +634 -0
  589. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +955 -0
  590. data/src/ruby/ext/grpc/rb_loader.c +72 -0
  591. data/src/ruby/ext/grpc/rb_loader.h +40 -0
  592. data/src/ruby/ext/grpc/rb_server.c +359 -0
  593. data/src/ruby/ext/grpc/rb_server.h +47 -0
  594. data/src/ruby/ext/grpc/rb_server_credentials.c +258 -0
  595. data/src/ruby/ext/grpc/rb_server_credentials.h +47 -0
  596. data/src/ruby/lib/grpc/core/time_consts.rb +71 -0
  597. data/src/ruby/lib/grpc/errors.rb +215 -0
  598. data/src/ruby/lib/grpc/generic/active_call.rb +547 -0
  599. data/src/ruby/lib/grpc/generic/bidi_call.rb +229 -0
  600. data/src/ruby/lib/grpc/generic/client_stub.rb +463 -0
  601. data/src/ruby/lib/grpc/generic/rpc_desc.rb +173 -0
  602. data/src/ruby/lib/grpc/generic/rpc_server.rb +476 -0
  603. data/src/ruby/lib/grpc/generic/service.rb +225 -0
  604. data/src/ruby/lib/grpc/grpc.rb +39 -0
  605. data/src/ruby/lib/grpc/grpc_c.bundle +0 -0
  606. data/src/ruby/lib/grpc/logconfig.rb +59 -0
  607. data/src/ruby/lib/grpc/notifier.rb +60 -0
  608. data/src/ruby/lib/grpc/version.rb +33 -0
  609. data/src/ruby/lib/grpc.rb +49 -0
  610. data/src/ruby/pb/README.md +42 -0
  611. data/src/ruby/pb/generate_proto_ruby.sh +58 -0
  612. data/src/ruby/pb/grpc/health/checker.rb +77 -0
  613. data/src/ruby/pb/grpc/health/v1/health_pb.rb +28 -0
  614. data/src/ruby/pb/grpc/health/v1/health_services_pb.rb +56 -0
  615. data/src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb +58 -0
  616. data/src/ruby/pb/grpc/testing/metrics_pb.rb +28 -0
  617. data/src/ruby/pb/grpc/testing/metrics_services_pb.rb +64 -0
  618. data/src/ruby/pb/src/proto/grpc/testing/empty_pb.rb +15 -0
  619. data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +82 -0
  620. data/src/ruby/pb/src/proto/grpc/testing/test_pb.rb +14 -0
  621. data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +117 -0
  622. data/src/ruby/pb/test/client.rb +779 -0
  623. data/src/ruby/pb/test/server.rb +267 -0
  624. data/src/ruby/spec/call_credentials_spec.rb +57 -0
  625. data/src/ruby/spec/call_spec.rb +162 -0
  626. data/src/ruby/spec/channel_connection_spec.rb +141 -0
  627. data/src/ruby/spec/channel_credentials_spec.rb +97 -0
  628. data/src/ruby/spec/channel_spec.rb +205 -0
  629. data/src/ruby/spec/client_server_spec.rb +491 -0
  630. data/src/ruby/spec/compression_options_spec.rb +164 -0
  631. data/src/ruby/spec/error_sanity_spec.rb +64 -0
  632. data/src/ruby/spec/generic/active_call_spec.rb +632 -0
  633. data/src/ruby/spec/generic/client_stub_spec.rb +556 -0
  634. data/src/ruby/spec/generic/rpc_desc_spec.rb +351 -0
  635. data/src/ruby/spec/generic/rpc_server_pool_spec.rb +142 -0
  636. data/src/ruby/spec/generic/rpc_server_spec.rb +524 -0
  637. data/src/ruby/spec/generic/service_spec.rb +276 -0
  638. data/src/ruby/spec/pb/duplicate/codegen_spec.rb +71 -0
  639. data/src/ruby/spec/pb/health/checker_spec.rb +222 -0
  640. data/src/ruby/spec/server_credentials_spec.rb +94 -0
  641. data/src/ruby/spec/server_spec.rb +205 -0
  642. data/src/ruby/spec/spec_helper.rb +71 -0
  643. data/src/ruby/spec/testdata/README +1 -0
  644. data/src/ruby/spec/testdata/ca.pem +15 -0
  645. data/src/ruby/spec/testdata/server1.key +16 -0
  646. data/src/ruby/spec/testdata/server1.pem +16 -0
  647. data/src/ruby/spec/time_consts_spec.rb +89 -0
  648. data/third_party/boringssl/crypto/aes/aes.c +1142 -0
  649. data/third_party/boringssl/crypto/aes/internal.h +87 -0
  650. data/third_party/boringssl/crypto/aes/mode_wrappers.c +112 -0
  651. data/third_party/boringssl/crypto/asn1/a_bitstr.c +263 -0
  652. data/third_party/boringssl/crypto/asn1/a_bool.c +110 -0
  653. data/third_party/boringssl/crypto/asn1/a_d2i_fp.c +282 -0
  654. data/third_party/boringssl/crypto/asn1/a_dup.c +111 -0
  655. data/third_party/boringssl/crypto/asn1/a_enum.c +181 -0
  656. data/third_party/boringssl/crypto/asn1/a_gentm.c +256 -0
  657. data/third_party/boringssl/crypto/asn1/a_i2d_fp.c +147 -0
  658. data/third_party/boringssl/crypto/asn1/a_int.c +460 -0
  659. data/third_party/boringssl/crypto/asn1/a_mbstr.c +409 -0
  660. data/third_party/boringssl/crypto/asn1/a_object.c +400 -0
  661. data/third_party/boringssl/crypto/asn1/a_octet.c +77 -0
  662. data/third_party/boringssl/crypto/asn1/a_print.c +121 -0
  663. data/third_party/boringssl/crypto/asn1/a_strnid.c +309 -0
  664. data/third_party/boringssl/crypto/asn1/a_time.c +206 -0
  665. data/third_party/boringssl/crypto/asn1/a_type.c +151 -0
  666. data/third_party/boringssl/crypto/asn1/a_utctm.c +304 -0
  667. data/third_party/boringssl/crypto/asn1/a_utf8.c +234 -0
  668. data/third_party/boringssl/crypto/asn1/asn1_lib.c +483 -0
  669. data/third_party/boringssl/crypto/asn1/asn1_locl.h +63 -0
  670. data/third_party/boringssl/crypto/asn1/asn1_par.c +80 -0
  671. data/third_party/boringssl/crypto/asn1/asn_pack.c +105 -0
  672. data/third_party/boringssl/crypto/asn1/f_enum.c +93 -0
  673. data/third_party/boringssl/crypto/asn1/f_int.c +97 -0
  674. data/third_party/boringssl/crypto/asn1/f_string.c +91 -0
  675. data/third_party/boringssl/crypto/asn1/t_bitst.c +103 -0
  676. data/third_party/boringssl/crypto/asn1/tasn_dec.c +1221 -0
  677. data/third_party/boringssl/crypto/asn1/tasn_enc.c +665 -0
  678. data/third_party/boringssl/crypto/asn1/tasn_fre.c +246 -0
  679. data/third_party/boringssl/crypto/asn1/tasn_new.c +381 -0
  680. data/third_party/boringssl/crypto/asn1/tasn_typ.c +131 -0
  681. data/third_party/boringssl/crypto/asn1/tasn_utl.c +266 -0
  682. data/third_party/boringssl/crypto/asn1/x_bignum.c +153 -0
  683. data/third_party/boringssl/crypto/asn1/x_long.c +197 -0
  684. data/third_party/boringssl/crypto/base64/base64.c +442 -0
  685. data/third_party/boringssl/crypto/bio/bio.c +598 -0
  686. data/third_party/boringssl/crypto/bio/bio_mem.c +328 -0
  687. data/third_party/boringssl/crypto/bio/buffer.c +496 -0
  688. data/third_party/boringssl/crypto/bio/connect.c +553 -0
  689. data/third_party/boringssl/crypto/bio/fd.c +277 -0
  690. data/third_party/boringssl/crypto/bio/file.c +313 -0
  691. data/third_party/boringssl/crypto/bio/hexdump.c +191 -0
  692. data/third_party/boringssl/crypto/bio/internal.h +111 -0
  693. data/third_party/boringssl/crypto/bio/pair.c +803 -0
  694. data/third_party/boringssl/crypto/bio/printf.c +119 -0
  695. data/third_party/boringssl/crypto/bio/socket.c +203 -0
  696. data/third_party/boringssl/crypto/bio/socket_helper.c +113 -0
  697. data/third_party/boringssl/crypto/bn/add.c +377 -0
  698. data/third_party/boringssl/crypto/bn/asm/x86_64-gcc.c +531 -0
  699. data/third_party/boringssl/crypto/bn/bn.c +379 -0
  700. data/third_party/boringssl/crypto/bn/bn_asn1.c +80 -0
  701. data/third_party/boringssl/crypto/bn/cmp.c +225 -0
  702. data/third_party/boringssl/crypto/bn/convert.c +599 -0
  703. data/third_party/boringssl/crypto/bn/ctx.c +311 -0
  704. data/third_party/boringssl/crypto/bn/div.c +671 -0
  705. data/third_party/boringssl/crypto/bn/exponentiation.c +1258 -0
  706. data/third_party/boringssl/crypto/bn/gcd.c +628 -0
  707. data/third_party/boringssl/crypto/bn/generic.c +703 -0
  708. data/third_party/boringssl/crypto/bn/internal.h +245 -0
  709. data/third_party/boringssl/crypto/bn/kronecker.c +175 -0
  710. data/third_party/boringssl/crypto/bn/montgomery.c +410 -0
  711. data/third_party/boringssl/crypto/bn/montgomery_inv.c +160 -0
  712. data/third_party/boringssl/crypto/bn/mul.c +869 -0
  713. data/third_party/boringssl/crypto/bn/prime.c +861 -0
  714. data/third_party/boringssl/crypto/bn/random.c +340 -0
  715. data/third_party/boringssl/crypto/bn/rsaz_exp.c +319 -0
  716. data/third_party/boringssl/crypto/bn/rsaz_exp.h +56 -0
  717. data/third_party/boringssl/crypto/bn/shift.c +299 -0
  718. data/third_party/boringssl/crypto/bn/sqrt.c +504 -0
  719. data/third_party/boringssl/crypto/buf/buf.c +239 -0
  720. data/third_party/boringssl/crypto/bytestring/asn1_compat.c +51 -0
  721. data/third_party/boringssl/crypto/bytestring/ber.c +263 -0
  722. data/third_party/boringssl/crypto/bytestring/cbb.c +473 -0
  723. data/third_party/boringssl/crypto/bytestring/cbs.c +439 -0
  724. data/third_party/boringssl/crypto/bytestring/internal.h +75 -0
  725. data/third_party/boringssl/crypto/chacha/chacha.c +167 -0
  726. data/third_party/boringssl/crypto/cipher/aead.c +156 -0
  727. data/third_party/boringssl/crypto/cipher/cipher.c +652 -0
  728. data/third_party/boringssl/crypto/cipher/derive_key.c +154 -0
  729. data/third_party/boringssl/crypto/cipher/e_aes.c +1717 -0
  730. data/third_party/boringssl/crypto/cipher/e_chacha20poly1305.c +300 -0
  731. data/third_party/boringssl/crypto/cipher/e_des.c +205 -0
  732. data/third_party/boringssl/crypto/cipher/e_null.c +85 -0
  733. data/third_party/boringssl/crypto/cipher/e_rc2.c +443 -0
  734. data/third_party/boringssl/crypto/cipher/e_rc4.c +87 -0
  735. data/third_party/boringssl/crypto/cipher/e_ssl3.c +403 -0
  736. data/third_party/boringssl/crypto/cipher/e_tls.c +602 -0
  737. data/third_party/boringssl/crypto/cipher/internal.h +162 -0
  738. data/third_party/boringssl/crypto/cipher/tls_cbc.c +553 -0
  739. data/third_party/boringssl/crypto/cmac/cmac.c +239 -0
  740. data/third_party/boringssl/crypto/conf/conf.c +788 -0
  741. data/third_party/boringssl/crypto/conf/conf_def.h +127 -0
  742. data/third_party/boringssl/crypto/conf/internal.h +31 -0
  743. data/third_party/boringssl/crypto/cpu-aarch64-linux.c +61 -0
  744. data/third_party/boringssl/crypto/cpu-arm-linux.c +360 -0
  745. data/third_party/boringssl/crypto/cpu-arm.c +38 -0
  746. data/third_party/boringssl/crypto/cpu-intel.c +263 -0
  747. data/third_party/boringssl/crypto/cpu-ppc64le.c +40 -0
  748. data/third_party/boringssl/crypto/crypto.c +164 -0
  749. data/third_party/boringssl/crypto/curve25519/curve25519.c +4944 -0
  750. data/third_party/boringssl/crypto/curve25519/internal.h +109 -0
  751. data/third_party/boringssl/crypto/curve25519/spake25519.c +464 -0
  752. data/third_party/boringssl/crypto/curve25519/x25519-x86_64.c +246 -0
  753. data/third_party/boringssl/crypto/des/des.c +771 -0
  754. data/third_party/boringssl/crypto/des/internal.h +212 -0
  755. data/third_party/boringssl/crypto/dh/check.c +218 -0
  756. data/third_party/boringssl/crypto/dh/dh.c +487 -0
  757. data/third_party/boringssl/crypto/dh/dh_asn1.c +160 -0
  758. data/third_party/boringssl/crypto/dh/params.c +253 -0
  759. data/third_party/boringssl/crypto/digest/digest.c +248 -0
  760. data/third_party/boringssl/crypto/digest/digests.c +321 -0
  761. data/third_party/boringssl/crypto/digest/internal.h +112 -0
  762. data/third_party/boringssl/crypto/digest/md32_common.h +262 -0
  763. data/third_party/boringssl/crypto/dsa/dsa.c +964 -0
  764. data/third_party/boringssl/crypto/dsa/dsa_asn1.c +339 -0
  765. data/third_party/boringssl/crypto/ec/ec.c +847 -0
  766. data/third_party/boringssl/crypto/ec/ec_asn1.c +549 -0
  767. data/third_party/boringssl/crypto/ec/ec_key.c +479 -0
  768. data/third_party/boringssl/crypto/ec/ec_montgomery.c +308 -0
  769. data/third_party/boringssl/crypto/ec/internal.h +276 -0
  770. data/third_party/boringssl/crypto/ec/oct.c +428 -0
  771. data/third_party/boringssl/crypto/ec/p224-64.c +1187 -0
  772. data/third_party/boringssl/crypto/ec/p256-64.c +1741 -0
  773. data/third_party/boringssl/crypto/ec/p256-x86_64-table.h +9543 -0
  774. data/third_party/boringssl/crypto/ec/p256-x86_64.c +574 -0
  775. data/third_party/boringssl/crypto/ec/simple.c +1117 -0
  776. data/third_party/boringssl/crypto/ec/util-64.c +109 -0
  777. data/third_party/boringssl/crypto/ec/wnaf.c +449 -0
  778. data/third_party/boringssl/crypto/ecdh/ecdh.c +159 -0
  779. data/third_party/boringssl/crypto/ecdsa/ecdsa.c +478 -0
  780. data/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.c +227 -0
  781. data/third_party/boringssl/crypto/engine/engine.c +96 -0
  782. data/third_party/boringssl/crypto/err/err.c +756 -0
  783. data/third_party/boringssl/crypto/evp/digestsign.c +159 -0
  784. data/third_party/boringssl/crypto/evp/evp.c +367 -0
  785. data/third_party/boringssl/crypto/evp/evp_asn1.c +337 -0
  786. data/third_party/boringssl/crypto/evp/evp_ctx.c +448 -0
  787. data/third_party/boringssl/crypto/evp/internal.h +237 -0
  788. data/third_party/boringssl/crypto/evp/p_dsa_asn1.c +268 -0
  789. data/third_party/boringssl/crypto/evp/p_ec.c +236 -0
  790. data/third_party/boringssl/crypto/evp/p_ec_asn1.c +257 -0
  791. data/third_party/boringssl/crypto/evp/p_rsa.c +673 -0
  792. data/third_party/boringssl/crypto/evp/p_rsa_asn1.c +200 -0
  793. data/third_party/boringssl/crypto/evp/pbkdf.c +151 -0
  794. data/third_party/boringssl/crypto/evp/print.c +520 -0
  795. data/third_party/boringssl/crypto/evp/sign.c +151 -0
  796. data/third_party/boringssl/crypto/ex_data.c +292 -0
  797. data/third_party/boringssl/crypto/hkdf/hkdf.c +110 -0
  798. data/third_party/boringssl/crypto/hmac/hmac.c +213 -0
  799. data/third_party/boringssl/crypto/internal.h +527 -0
  800. data/third_party/boringssl/crypto/lhash/lhash.c +342 -0
  801. data/third_party/boringssl/crypto/md4/md4.c +234 -0
  802. data/third_party/boringssl/crypto/md5/md5.c +275 -0
  803. data/third_party/boringssl/crypto/mem.c +200 -0
  804. data/third_party/boringssl/crypto/modes/cbc.c +216 -0
  805. data/third_party/boringssl/crypto/modes/cfb.c +230 -0
  806. data/third_party/boringssl/crypto/modes/ctr.c +219 -0
  807. data/third_party/boringssl/crypto/modes/gcm.c +1288 -0
  808. data/third_party/boringssl/crypto/modes/internal.h +358 -0
  809. data/third_party/boringssl/crypto/modes/ofb.c +95 -0
  810. data/third_party/boringssl/crypto/newhope/error_correction.c +131 -0
  811. data/third_party/boringssl/crypto/newhope/internal.h +71 -0
  812. data/third_party/boringssl/crypto/newhope/newhope.c +174 -0
  813. data/third_party/boringssl/crypto/newhope/ntt.c +148 -0
  814. data/third_party/boringssl/crypto/newhope/poly.c +183 -0
  815. data/third_party/boringssl/crypto/newhope/precomp.c +306 -0
  816. data/third_party/boringssl/crypto/newhope/reduce.c +42 -0
  817. data/third_party/boringssl/crypto/obj/obj.c +640 -0
  818. data/third_party/boringssl/crypto/obj/obj_dat.h +5254 -0
  819. data/third_party/boringssl/crypto/obj/obj_xref.c +124 -0
  820. data/third_party/boringssl/crypto/obj/obj_xref.h +96 -0
  821. data/third_party/boringssl/crypto/pem/pem_all.c +262 -0
  822. data/third_party/boringssl/crypto/pem/pem_info.c +381 -0
  823. data/third_party/boringssl/crypto/pem/pem_lib.c +778 -0
  824. data/third_party/boringssl/crypto/pem/pem_oth.c +88 -0
  825. data/third_party/boringssl/crypto/pem/pem_pk8.c +257 -0
  826. data/third_party/boringssl/crypto/pem/pem_pkey.c +227 -0
  827. data/third_party/boringssl/crypto/pem/pem_x509.c +65 -0
  828. data/third_party/boringssl/crypto/pem/pem_xaux.c +67 -0
  829. data/third_party/boringssl/crypto/pkcs8/internal.h +83 -0
  830. data/third_party/boringssl/crypto/pkcs8/p5_pbe.c +151 -0
  831. data/third_party/boringssl/crypto/pkcs8/p5_pbev2.c +441 -0
  832. data/third_party/boringssl/crypto/pkcs8/p8_pkey.c +85 -0
  833. data/third_party/boringssl/crypto/pkcs8/pkcs8.c +1219 -0
  834. data/third_party/boringssl/crypto/poly1305/internal.h +40 -0
  835. data/third_party/boringssl/crypto/poly1305/poly1305.c +324 -0
  836. data/third_party/boringssl/crypto/poly1305/poly1305_arm.c +304 -0
  837. data/third_party/boringssl/crypto/poly1305/poly1305_vec.c +890 -0
  838. data/third_party/boringssl/crypto/rand/deterministic.c +47 -0
  839. data/third_party/boringssl/crypto/rand/internal.h +32 -0
  840. data/third_party/boringssl/crypto/rand/rand.c +244 -0
  841. data/third_party/boringssl/crypto/rand/urandom.c +221 -0
  842. data/third_party/boringssl/crypto/rand/windows.c +53 -0
  843. data/third_party/boringssl/crypto/rc4/rc4.c +98 -0
  844. data/third_party/boringssl/crypto/refcount_c11.c +67 -0
  845. data/third_party/boringssl/crypto/refcount_lock.c +53 -0
  846. data/third_party/boringssl/crypto/rsa/blinding.c +264 -0
  847. data/third_party/boringssl/crypto/rsa/internal.h +148 -0
  848. data/third_party/boringssl/crypto/rsa/padding.c +708 -0
  849. data/third_party/boringssl/crypto/rsa/rsa.c +830 -0
  850. data/third_party/boringssl/crypto/rsa/rsa_asn1.c +446 -0
  851. data/third_party/boringssl/crypto/rsa/rsa_impl.c +1139 -0
  852. data/third_party/boringssl/crypto/sha/sha1.c +337 -0
  853. data/third_party/boringssl/crypto/sha/sha256.c +327 -0
  854. data/third_party/boringssl/crypto/sha/sha512.c +607 -0
  855. data/third_party/boringssl/crypto/stack/stack.c +377 -0
  856. data/third_party/boringssl/crypto/thread.c +110 -0
  857. data/third_party/boringssl/crypto/thread_none.c +59 -0
  858. data/third_party/boringssl/crypto/thread_pthread.c +176 -0
  859. data/third_party/boringssl/crypto/thread_win.c +237 -0
  860. data/third_party/boringssl/crypto/time_support.c +206 -0
  861. data/third_party/boringssl/crypto/x509/a_digest.c +96 -0
  862. data/third_party/boringssl/crypto/x509/a_sign.c +135 -0
  863. data/third_party/boringssl/crypto/x509/a_strex.c +633 -0
  864. data/third_party/boringssl/crypto/x509/a_verify.c +127 -0
  865. data/third_party/boringssl/crypto/x509/algorithm.c +137 -0
  866. data/third_party/boringssl/crypto/x509/asn1_gen.c +818 -0
  867. data/third_party/boringssl/crypto/x509/by_dir.c +453 -0
  868. data/third_party/boringssl/crypto/x509/by_file.c +275 -0
  869. data/third_party/boringssl/crypto/x509/charmap.h +15 -0
  870. data/third_party/boringssl/crypto/x509/i2d_pr.c +83 -0
  871. data/third_party/boringssl/crypto/x509/internal.h +66 -0
  872. data/third_party/boringssl/crypto/x509/pkcs7.c +353 -0
  873. data/third_party/boringssl/crypto/x509/rsa_pss.c +385 -0
  874. data/third_party/boringssl/crypto/x509/t_crl.c +128 -0
  875. data/third_party/boringssl/crypto/x509/t_req.c +246 -0
  876. data/third_party/boringssl/crypto/x509/t_x509.c +506 -0
  877. data/third_party/boringssl/crypto/x509/t_x509a.c +111 -0
  878. data/third_party/boringssl/crypto/x509/vpm_int.h +70 -0
  879. data/third_party/boringssl/crypto/x509/x509.c +157 -0
  880. data/third_party/boringssl/crypto/x509/x509_att.c +381 -0
  881. data/third_party/boringssl/crypto/x509/x509_cmp.c +474 -0
  882. data/third_party/boringssl/crypto/x509/x509_d2.c +106 -0
  883. data/third_party/boringssl/crypto/x509/x509_def.c +98 -0
  884. data/third_party/boringssl/crypto/x509/x509_ext.c +206 -0
  885. data/third_party/boringssl/crypto/x509/x509_lu.c +690 -0
  886. data/third_party/boringssl/crypto/x509/x509_obj.c +197 -0
  887. data/third_party/boringssl/crypto/x509/x509_r2x.c +117 -0
  888. data/third_party/boringssl/crypto/x509/x509_req.c +322 -0
  889. data/third_party/boringssl/crypto/x509/x509_set.c +154 -0
  890. data/third_party/boringssl/crypto/x509/x509_trs.c +326 -0
  891. data/third_party/boringssl/crypto/x509/x509_txt.c +211 -0
  892. data/third_party/boringssl/crypto/x509/x509_v3.c +278 -0
  893. data/third_party/boringssl/crypto/x509/x509_vfy.c +2436 -0
  894. data/third_party/boringssl/crypto/x509/x509_vpm.c +647 -0
  895. data/third_party/boringssl/crypto/x509/x509cset.c +170 -0
  896. data/third_party/boringssl/crypto/x509/x509name.c +386 -0
  897. data/third_party/boringssl/crypto/x509/x509rset.c +81 -0
  898. data/third_party/boringssl/crypto/x509/x509spki.c +137 -0
  899. data/third_party/boringssl/crypto/x509/x509type.c +126 -0
  900. data/third_party/boringssl/crypto/x509/x_algor.c +151 -0
  901. data/third_party/boringssl/crypto/x509/x_all.c +501 -0
  902. data/third_party/boringssl/crypto/x509/x_attrib.c +111 -0
  903. data/third_party/boringssl/crypto/x509/x_crl.c +539 -0
  904. data/third_party/boringssl/crypto/x509/x_exten.c +75 -0
  905. data/third_party/boringssl/crypto/x509/x_info.c +98 -0
  906. data/third_party/boringssl/crypto/x509/x_name.c +534 -0
  907. data/third_party/boringssl/crypto/x509/x_pkey.c +103 -0
  908. data/third_party/boringssl/crypto/x509/x_pubkey.c +368 -0
  909. data/third_party/boringssl/crypto/x509/x_req.c +109 -0
  910. data/third_party/boringssl/crypto/x509/x_sig.c +69 -0
  911. data/third_party/boringssl/crypto/x509/x_spki.c +80 -0
  912. data/third_party/boringssl/crypto/x509/x_val.c +69 -0
  913. data/third_party/boringssl/crypto/x509/x_x509.c +289 -0
  914. data/third_party/boringssl/crypto/x509/x_x509a.c +205 -0
  915. data/third_party/boringssl/crypto/x509v3/ext_dat.h +135 -0
  916. data/third_party/boringssl/crypto/x509v3/pcy_cache.c +284 -0
  917. data/third_party/boringssl/crypto/x509v3/pcy_data.c +130 -0
  918. data/third_party/boringssl/crypto/x509v3/pcy_int.h +217 -0
  919. data/third_party/boringssl/crypto/x509v3/pcy_lib.c +164 -0
  920. data/third_party/boringssl/crypto/x509v3/pcy_map.c +130 -0
  921. data/third_party/boringssl/crypto/x509v3/pcy_node.c +188 -0
  922. data/third_party/boringssl/crypto/x509v3/pcy_tree.c +829 -0
  923. data/third_party/boringssl/crypto/x509v3/v3_akey.c +204 -0
  924. data/third_party/boringssl/crypto/x509v3/v3_akeya.c +72 -0
  925. data/third_party/boringssl/crypto/x509v3/v3_alt.c +614 -0
  926. data/third_party/boringssl/crypto/x509v3/v3_bcons.c +133 -0
  927. data/third_party/boringssl/crypto/x509v3/v3_bitst.c +141 -0
  928. data/third_party/boringssl/crypto/x509v3/v3_conf.c +462 -0
  929. data/third_party/boringssl/crypto/x509v3/v3_cpols.c +496 -0
  930. data/third_party/boringssl/crypto/x509v3/v3_crld.c +561 -0
  931. data/third_party/boringssl/crypto/x509v3/v3_enum.c +100 -0
  932. data/third_party/boringssl/crypto/x509v3/v3_extku.c +148 -0
  933. data/third_party/boringssl/crypto/x509v3/v3_genn.c +250 -0
  934. data/third_party/boringssl/crypto/x509v3/v3_ia5.c +119 -0
  935. data/third_party/boringssl/crypto/x509v3/v3_info.c +212 -0
  936. data/third_party/boringssl/crypto/x509v3/v3_int.c +91 -0
  937. data/third_party/boringssl/crypto/x509v3/v3_lib.c +362 -0
  938. data/third_party/boringssl/crypto/x509v3/v3_ncons.c +482 -0
  939. data/third_party/boringssl/crypto/x509v3/v3_pci.c +317 -0
  940. data/third_party/boringssl/crypto/x509v3/v3_pcia.c +57 -0
  941. data/third_party/boringssl/crypto/x509v3/v3_pcons.c +139 -0
  942. data/third_party/boringssl/crypto/x509v3/v3_pku.c +110 -0
  943. data/third_party/boringssl/crypto/x509v3/v3_pmaps.c +154 -0
  944. data/third_party/boringssl/crypto/x509v3/v3_prn.c +229 -0
  945. data/third_party/boringssl/crypto/x509v3/v3_purp.c +874 -0
  946. data/third_party/boringssl/crypto/x509v3/v3_skey.c +152 -0
  947. data/third_party/boringssl/crypto/x509v3/v3_sxnet.c +274 -0
  948. data/third_party/boringssl/crypto/x509v3/v3_utl.c +1327 -0
  949. data/third_party/boringssl/include/openssl/aead.h +345 -0
  950. data/third_party/boringssl/include/openssl/aes.h +158 -0
  951. data/third_party/boringssl/include/openssl/arm_arch.h +121 -0
  952. data/third_party/boringssl/include/openssl/asn1.h +1038 -0
  953. data/third_party/boringssl/include/openssl/asn1_mac.h +18 -0
  954. data/third_party/boringssl/include/openssl/asn1t.h +896 -0
  955. data/third_party/boringssl/include/openssl/base.h +412 -0
  956. data/third_party/boringssl/include/openssl/base64.h +187 -0
  957. data/third_party/boringssl/include/openssl/bio.h +926 -0
  958. data/third_party/boringssl/include/openssl/blowfish.h +93 -0
  959. data/third_party/boringssl/include/openssl/bn.h +955 -0
  960. data/third_party/boringssl/include/openssl/buf.h +133 -0
  961. data/third_party/boringssl/include/openssl/buffer.h +18 -0
  962. data/third_party/boringssl/include/openssl/bytestring.h +437 -0
  963. data/third_party/boringssl/include/openssl/cast.h +96 -0
  964. data/third_party/boringssl/include/openssl/chacha.h +37 -0
  965. data/third_party/boringssl/include/openssl/cipher.h +588 -0
  966. data/third_party/boringssl/include/openssl/cmac.h +87 -0
  967. data/third_party/boringssl/include/openssl/conf.h +181 -0
  968. data/third_party/boringssl/include/openssl/cpu.h +181 -0
  969. data/third_party/boringssl/include/openssl/crypto.h +94 -0
  970. data/third_party/boringssl/include/openssl/curve25519.h +183 -0
  971. data/third_party/boringssl/include/openssl/des.h +177 -0
  972. data/third_party/boringssl/include/openssl/dh.h +297 -0
  973. data/third_party/boringssl/include/openssl/digest.h +285 -0
  974. data/third_party/boringssl/include/openssl/dsa.h +436 -0
  975. data/third_party/boringssl/include/openssl/dtls1.h +16 -0
  976. data/third_party/boringssl/include/openssl/ec.h +406 -0
  977. data/third_party/boringssl/include/openssl/ec_key.h +337 -0
  978. data/third_party/boringssl/include/openssl/ecdh.h +102 -0
  979. data/third_party/boringssl/include/openssl/ecdsa.h +217 -0
  980. data/third_party/boringssl/include/openssl/engine.h +109 -0
  981. data/third_party/boringssl/include/openssl/err.h +488 -0
  982. data/third_party/boringssl/include/openssl/evp.h +797 -0
  983. data/third_party/boringssl/include/openssl/ex_data.h +213 -0
  984. data/third_party/boringssl/include/openssl/hkdf.h +64 -0
  985. data/third_party/boringssl/include/openssl/hmac.h +174 -0
  986. data/third_party/boringssl/include/openssl/lhash.h +192 -0
  987. data/third_party/boringssl/include/openssl/lhash_macros.h +132 -0
  988. data/third_party/boringssl/include/openssl/md4.h +106 -0
  989. data/third_party/boringssl/include/openssl/md5.h +107 -0
  990. data/third_party/boringssl/include/openssl/mem.h +150 -0
  991. data/third_party/boringssl/include/openssl/newhope.h +158 -0
  992. data/third_party/boringssl/include/openssl/nid.h +4166 -0
  993. data/third_party/boringssl/include/openssl/obj.h +226 -0
  994. data/third_party/boringssl/include/openssl/obj_mac.h +18 -0
  995. data/third_party/boringssl/include/openssl/objects.h +18 -0
  996. data/third_party/boringssl/include/openssl/opensslconf.h +60 -0
  997. data/third_party/boringssl/include/openssl/opensslv.h +18 -0
  998. data/third_party/boringssl/include/openssl/ossl_typ.h +18 -0
  999. data/third_party/boringssl/include/openssl/pem.h +517 -0
  1000. data/third_party/boringssl/include/openssl/pkcs12.h +18 -0
  1001. data/third_party/boringssl/include/openssl/pkcs7.h +16 -0
  1002. data/third_party/boringssl/include/openssl/pkcs8.h +236 -0
  1003. data/third_party/boringssl/include/openssl/poly1305.h +51 -0
  1004. data/third_party/boringssl/include/openssl/rand.h +122 -0
  1005. data/third_party/boringssl/include/openssl/rc4.h +96 -0
  1006. data/third_party/boringssl/include/openssl/ripemd.h +107 -0
  1007. data/third_party/boringssl/include/openssl/rsa.h +699 -0
  1008. data/third_party/boringssl/include/openssl/safestack.h +16 -0
  1009. data/third_party/boringssl/include/openssl/sha.h +260 -0
  1010. data/third_party/boringssl/include/openssl/srtp.h +18 -0
  1011. data/third_party/boringssl/include/openssl/ssl.h +4826 -0
  1012. data/third_party/boringssl/include/openssl/ssl3.h +434 -0
  1013. data/third_party/boringssl/include/openssl/stack.h +293 -0
  1014. data/third_party/boringssl/include/openssl/stack_macros.h +3902 -0
  1015. data/third_party/boringssl/include/openssl/thread.h +191 -0
  1016. data/third_party/boringssl/include/openssl/time_support.h +91 -0
  1017. data/third_party/boringssl/include/openssl/tls1.h +657 -0
  1018. data/third_party/boringssl/include/openssl/type_check.h +91 -0
  1019. data/third_party/boringssl/include/openssl/x509.h +1299 -0
  1020. data/third_party/boringssl/include/openssl/x509_vfy.h +618 -0
  1021. data/third_party/boringssl/include/openssl/x509v3.h +819 -0
  1022. data/third_party/boringssl/ssl/custom_extensions.c +255 -0
  1023. data/third_party/boringssl/ssl/d1_both.c +845 -0
  1024. data/third_party/boringssl/ssl/d1_lib.c +270 -0
  1025. data/third_party/boringssl/ssl/d1_pkt.c +419 -0
  1026. data/third_party/boringssl/ssl/d1_srtp.c +236 -0
  1027. data/third_party/boringssl/ssl/dtls_method.c +203 -0
  1028. data/third_party/boringssl/ssl/dtls_record.c +309 -0
  1029. data/third_party/boringssl/ssl/handshake_client.c +2002 -0
  1030. data/third_party/boringssl/ssl/handshake_server.c +1932 -0
  1031. data/third_party/boringssl/ssl/internal.h +1551 -0
  1032. data/third_party/boringssl/ssl/s3_both.c +745 -0
  1033. data/third_party/boringssl/ssl/s3_enc.c +412 -0
  1034. data/third_party/boringssl/ssl/s3_lib.c +336 -0
  1035. data/third_party/boringssl/ssl/s3_pkt.c +497 -0
  1036. data/third_party/boringssl/ssl/ssl_aead_ctx.c +329 -0
  1037. data/third_party/boringssl/ssl/ssl_asn1.c +748 -0
  1038. data/third_party/boringssl/ssl/ssl_buffer.c +311 -0
  1039. data/third_party/boringssl/ssl/ssl_cert.c +814 -0
  1040. data/third_party/boringssl/ssl/ssl_cipher.c +2062 -0
  1041. data/third_party/boringssl/ssl/ssl_ecdh.c +610 -0
  1042. data/third_party/boringssl/ssl/ssl_file.c +586 -0
  1043. data/third_party/boringssl/ssl/ssl_lib.c +3063 -0
  1044. data/third_party/boringssl/ssl/ssl_rsa.c +793 -0
  1045. data/third_party/boringssl/ssl/ssl_session.c +985 -0
  1046. data/third_party/boringssl/ssl/ssl_stat.c +509 -0
  1047. data/third_party/boringssl/ssl/t1_enc.c +547 -0
  1048. data/third_party/boringssl/ssl/t1_lib.c +3279 -0
  1049. data/third_party/boringssl/ssl/tls13_both.c +440 -0
  1050. data/third_party/boringssl/ssl/tls13_client.c +682 -0
  1051. data/third_party/boringssl/ssl/tls13_enc.c +391 -0
  1052. data/third_party/boringssl/ssl/tls13_server.c +672 -0
  1053. data/third_party/boringssl/ssl/tls_method.c +245 -0
  1054. data/third_party/boringssl/ssl/tls_record.c +461 -0
  1055. data/third_party/cares/ares_build.h +264 -0
  1056. data/third_party/cares/cares/ares.h +636 -0
  1057. data/third_party/cares/cares/ares__close_sockets.c +61 -0
  1058. data/third_party/cares/cares/ares__get_hostent.c +261 -0
  1059. data/third_party/cares/cares/ares__read_line.c +73 -0
  1060. data/third_party/cares/cares/ares__timeval.c +111 -0
  1061. data/third_party/cares/cares/ares_cancel.c +63 -0
  1062. data/third_party/cares/cares/ares_create_query.c +202 -0
  1063. data/third_party/cares/cares/ares_data.c +221 -0
  1064. data/third_party/cares/cares/ares_data.h +72 -0
  1065. data/third_party/cares/cares/ares_destroy.c +108 -0
  1066. data/third_party/cares/cares/ares_dns.h +103 -0
  1067. data/third_party/cares/cares/ares_expand_name.c +205 -0
  1068. data/third_party/cares/cares/ares_expand_string.c +70 -0
  1069. data/third_party/cares/cares/ares_fds.c +59 -0
  1070. data/third_party/cares/cares/ares_free_hostent.c +41 -0
  1071. data/third_party/cares/cares/ares_free_string.c +25 -0
  1072. data/third_party/cares/cares/ares_getenv.c +30 -0
  1073. data/third_party/cares/cares/ares_getenv.h +26 -0
  1074. data/third_party/cares/cares/ares_gethostbyaddr.c +294 -0
  1075. data/third_party/cares/cares/ares_gethostbyname.c +518 -0
  1076. data/third_party/cares/cares/ares_getnameinfo.c +422 -0
  1077. data/third_party/cares/cares/ares_getopt.c +122 -0
  1078. data/third_party/cares/cares/ares_getopt.h +53 -0
  1079. data/third_party/cares/cares/ares_getsock.c +66 -0
  1080. data/third_party/cares/cares/ares_inet_net_pton.h +25 -0
  1081. data/third_party/cares/cares/ares_init.c +2146 -0
  1082. data/third_party/cares/cares/ares_iphlpapi.h +221 -0
  1083. data/third_party/cares/cares/ares_ipv6.h +78 -0
  1084. data/third_party/cares/cares/ares_library_init.c +167 -0
  1085. data/third_party/cares/cares/ares_library_init.h +42 -0
  1086. data/third_party/cares/cares/ares_llist.c +63 -0
  1087. data/third_party/cares/cares/ares_llist.h +39 -0
  1088. data/third_party/cares/cares/ares_mkquery.c +24 -0
  1089. data/third_party/cares/cares/ares_nowarn.c +260 -0
  1090. data/third_party/cares/cares/ares_nowarn.h +61 -0
  1091. data/third_party/cares/cares/ares_options.c +402 -0
  1092. data/third_party/cares/cares/ares_parse_a_reply.c +264 -0
  1093. data/third_party/cares/cares/ares_parse_aaaa_reply.c +264 -0
  1094. data/third_party/cares/cares/ares_parse_mx_reply.c +170 -0
  1095. data/third_party/cares/cares/ares_parse_naptr_reply.c +188 -0
  1096. data/third_party/cares/cares/ares_parse_ns_reply.c +183 -0
  1097. data/third_party/cares/cares/ares_parse_ptr_reply.c +219 -0
  1098. data/third_party/cares/cares/ares_parse_soa_reply.c +133 -0
  1099. data/third_party/cares/cares/ares_parse_srv_reply.c +179 -0
  1100. data/third_party/cares/cares/ares_parse_txt_reply.c +220 -0
  1101. data/third_party/cares/cares/ares_platform.c +11035 -0
  1102. data/third_party/cares/cares/ares_platform.h +43 -0
  1103. data/third_party/cares/cares/ares_private.h +363 -0
  1104. data/third_party/cares/cares/ares_process.c +1359 -0
  1105. data/third_party/cares/cares/ares_query.c +186 -0
  1106. data/third_party/cares/cares/ares_rules.h +125 -0
  1107. data/third_party/cares/cares/ares_search.c +316 -0
  1108. data/third_party/cares/cares/ares_send.c +131 -0
  1109. data/third_party/cares/cares/ares_setup.h +217 -0
  1110. data/third_party/cares/cares/ares_strcasecmp.c +66 -0
  1111. data/third_party/cares/cares/ares_strcasecmp.h +30 -0
  1112. data/third_party/cares/cares/ares_strdup.c +49 -0
  1113. data/third_party/cares/cares/ares_strdup.h +24 -0
  1114. data/third_party/cares/cares/ares_strerror.c +56 -0
  1115. data/third_party/cares/cares/ares_timeout.c +88 -0
  1116. data/third_party/cares/cares/ares_version.c +11 -0
  1117. data/third_party/cares/cares/ares_version.h +24 -0
  1118. data/third_party/cares/cares/ares_writev.c +79 -0
  1119. data/third_party/cares/cares/bitncmp.c +59 -0
  1120. data/third_party/cares/cares/bitncmp.h +26 -0
  1121. data/third_party/cares/cares/config-win32.h +377 -0
  1122. data/third_party/cares/cares/inet_net_pton.c +450 -0
  1123. data/third_party/cares/cares/inet_ntop.c +208 -0
  1124. data/third_party/cares/cares/setup_once.h +554 -0
  1125. data/third_party/cares/cares/windows_port.c +22 -0
  1126. data/third_party/cares/config_darwin/ares_config.h +523 -0
  1127. data/third_party/cares/config_linux/ares_config.h +524 -0
  1128. data/third_party/nanopb/pb.h +579 -0
  1129. data/third_party/nanopb/pb_common.c +97 -0
  1130. data/third_party/nanopb/pb_common.h +42 -0
  1131. data/third_party/nanopb/pb_decode.c +1347 -0
  1132. data/third_party/nanopb/pb_decode.h +149 -0
  1133. data/third_party/nanopb/pb_encode.c +696 -0
  1134. data/third_party/nanopb/pb_encode.h +154 -0
  1135. data/third_party/zlib/adler32.c +179 -0
  1136. data/third_party/zlib/compress.c +80 -0
  1137. data/third_party/zlib/crc32.c +425 -0
  1138. data/third_party/zlib/crc32.h +441 -0
  1139. data/third_party/zlib/deflate.c +1967 -0
  1140. data/third_party/zlib/deflate.h +346 -0
  1141. data/third_party/zlib/gzclose.c +25 -0
  1142. data/third_party/zlib/gzguts.h +209 -0
  1143. data/third_party/zlib/gzlib.c +634 -0
  1144. data/third_party/zlib/gzread.c +594 -0
  1145. data/third_party/zlib/gzwrite.c +577 -0
  1146. data/third_party/zlib/infback.c +640 -0
  1147. data/third_party/zlib/inffast.c +340 -0
  1148. data/third_party/zlib/inffast.h +11 -0
  1149. data/third_party/zlib/inffixed.h +94 -0
  1150. data/third_party/zlib/inflate.c +1512 -0
  1151. data/third_party/zlib/inflate.h +122 -0
  1152. data/third_party/zlib/inftrees.c +306 -0
  1153. data/third_party/zlib/inftrees.h +62 -0
  1154. data/third_party/zlib/trees.c +1226 -0
  1155. data/third_party/zlib/trees.h +128 -0
  1156. data/third_party/zlib/uncompr.c +59 -0
  1157. data/third_party/zlib/zconf.h +511 -0
  1158. data/third_party/zlib/zlib.h +1768 -0
  1159. data/third_party/zlib/zutil.c +324 -0
  1160. data/third_party/zlib/zutil.h +253 -0
  1161. metadata +1397 -0
@@ -0,0 +1,107 @@
1
+ /*
2
+ *
3
+ * Copyright 2015, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
35
+ #define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
36
+
37
+ #include <grpc/slice.h>
38
+ #include <grpc/slice_buffer.h>
39
+ #include <grpc/support/port_platform.h>
40
+ #include "src/core/ext/transport/chttp2/transport/frame.h"
41
+ #include "src/core/lib/transport/metadata.h"
42
+ #include "src/core/lib/transport/metadata_batch.h"
43
+ #include "src/core/lib/transport/transport.h"
44
+
45
+ #define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256
46
+ #define GRPC_CHTTP2_HPACKC_NUM_VALUES 256
47
+ /* initial table size, per spec */
48
+ #define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096
49
+ /* maximum table size we'll actually use */
50
+ #define GRPC_CHTTP2_HPACKC_MAX_TABLE_SIZE (1024 * 1024)
51
+
52
+ typedef struct {
53
+ uint32_t filter_elems_sum;
54
+ uint32_t max_table_size;
55
+ uint32_t max_table_elems;
56
+ uint32_t cap_table_elems;
57
+ /** if non-zero, advertise to the decoder that we'll start using a table
58
+ of this size */
59
+ uint8_t advertise_table_size_change;
60
+ /** maximum number of bytes we'll use for the decode table (to guard against
61
+ peers ooming us by setting decode table size high) */
62
+ uint32_t max_usable_size;
63
+ /* one before the lowest usable table index */
64
+ uint32_t tail_remote_index;
65
+ uint32_t table_size;
66
+ uint32_t table_elems;
67
+
68
+ /* filter tables for elems: this tables provides an approximate
69
+ popularity count for particular hashes, and are used to determine whether
70
+ a new literal should be added to the compression table or not.
71
+ They track a single integer that counts how often a particular value has
72
+ been seen. When that count reaches max (255), all values are halved. */
73
+ uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_FILTERS];
74
+
75
+ /* entry tables for keys & elems: these tables track values that have been
76
+ seen and *may* be in the decompressor table */
77
+ grpc_slice entries_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
78
+ grpc_mdelem entries_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
79
+ uint32_t indices_keys[GRPC_CHTTP2_HPACKC_NUM_VALUES];
80
+ uint32_t indices_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES];
81
+
82
+ uint16_t *table_elem_size;
83
+ } grpc_chttp2_hpack_compressor;
84
+
85
+ void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor *c);
86
+ void grpc_chttp2_hpack_compressor_destroy(grpc_exec_ctx *exec_ctx,
87
+ grpc_chttp2_hpack_compressor *c);
88
+ void grpc_chttp2_hpack_compressor_set_max_table_size(
89
+ grpc_chttp2_hpack_compressor *c, uint32_t max_table_size);
90
+ void grpc_chttp2_hpack_compressor_set_max_usable_size(
91
+ grpc_chttp2_hpack_compressor *c, uint32_t max_table_size);
92
+
93
+ typedef struct {
94
+ uint32_t stream_id;
95
+ bool is_eof;
96
+ bool use_true_binary_metadata;
97
+ size_t max_frame_size;
98
+ grpc_transport_one_way_stats *stats;
99
+ } grpc_encode_header_options;
100
+
101
+ void grpc_chttp2_encode_header(grpc_exec_ctx *exec_ctx,
102
+ grpc_chttp2_hpack_compressor *c,
103
+ grpc_metadata_batch *metadata,
104
+ const grpc_encode_header_options *options,
105
+ grpc_slice_buffer *outbuf);
106
+
107
+ #endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */
@@ -0,0 +1,1734 @@
1
+ /*
2
+ *
3
+ * Copyright 2015, Google Inc.
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are
8
+ * met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above
13
+ * copyright notice, this list of conditions and the following disclaimer
14
+ * in the documentation and/or other materials provided with the
15
+ * distribution.
16
+ * * Neither the name of Google Inc. nor the names of its
17
+ * contributors may be used to endorse or promote products derived from
18
+ * this software without specific prior written permission.
19
+ *
20
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+ *
32
+ */
33
+
34
+ #include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
35
+ #include "src/core/ext/transport/chttp2/transport/internal.h"
36
+
37
+ #include <assert.h>
38
+ #include <stddef.h>
39
+ #include <string.h>
40
+
41
+ #include <grpc/support/alloc.h>
42
+ #include <grpc/support/log.h>
43
+ #include <grpc/support/port_platform.h>
44
+ #include <grpc/support/string_util.h>
45
+ #include <grpc/support/useful.h>
46
+
47
+ #include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
48
+ #include "src/core/lib/profiling/timers.h"
49
+ #include "src/core/lib/slice/slice_internal.h"
50
+ #include "src/core/lib/support/string.h"
51
+ #include "src/core/lib/transport/http2_errors.h"
52
+
53
+ extern int grpc_http_trace;
54
+
55
+ typedef enum {
56
+ NOT_BINARY,
57
+ BINARY_BEGIN,
58
+ B64_BYTE0,
59
+ B64_BYTE1,
60
+ B64_BYTE2,
61
+ B64_BYTE3
62
+ } binary_state;
63
+
64
+ /* How parsing works:
65
+
66
+ The parser object keeps track of a function pointer which represents the
67
+ current parse state.
68
+
69
+ Each time new bytes are presented, we call into the current state, which
70
+ recursively parses until all bytes in the given chunk are exhausted.
71
+
72
+ The parse state that terminates then saves its function pointer to be the
73
+ current state so that it can resume when more bytes are available.
74
+
75
+ It's expected that most optimizing compilers will turn this code into
76
+ a set of indirect jumps, and so not waste stack space. */
77
+
78
+ /* forward declarations for parsing states */
79
+ static grpc_error *parse_begin(grpc_exec_ctx *exec_ctx,
80
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
81
+ const uint8_t *end);
82
+ static grpc_error *parse_error(grpc_exec_ctx *exec_ctx,
83
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
84
+ const uint8_t *end, grpc_error *error);
85
+ static grpc_error *still_parse_error(grpc_exec_ctx *exec_ctx,
86
+ grpc_chttp2_hpack_parser *p,
87
+ const uint8_t *cur, const uint8_t *end);
88
+ static grpc_error *parse_illegal_op(grpc_exec_ctx *exec_ctx,
89
+ grpc_chttp2_hpack_parser *p,
90
+ const uint8_t *cur, const uint8_t *end);
91
+
92
+ static grpc_error *parse_string_prefix(grpc_exec_ctx *exec_ctx,
93
+ grpc_chttp2_hpack_parser *p,
94
+ const uint8_t *cur, const uint8_t *end);
95
+ static grpc_error *parse_key_string(grpc_exec_ctx *exec_ctx,
96
+ grpc_chttp2_hpack_parser *p,
97
+ const uint8_t *cur, const uint8_t *end);
98
+ static grpc_error *parse_value_string_with_indexed_key(
99
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p, const uint8_t *cur,
100
+ const uint8_t *end);
101
+ static grpc_error *parse_value_string_with_literal_key(
102
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p, const uint8_t *cur,
103
+ const uint8_t *end);
104
+
105
+ static grpc_error *parse_value0(grpc_exec_ctx *exec_ctx,
106
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
107
+ const uint8_t *end);
108
+ static grpc_error *parse_value1(grpc_exec_ctx *exec_ctx,
109
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
110
+ const uint8_t *end);
111
+ static grpc_error *parse_value2(grpc_exec_ctx *exec_ctx,
112
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
113
+ const uint8_t *end);
114
+ static grpc_error *parse_value3(grpc_exec_ctx *exec_ctx,
115
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
116
+ const uint8_t *end);
117
+ static grpc_error *parse_value4(grpc_exec_ctx *exec_ctx,
118
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
119
+ const uint8_t *end);
120
+ static grpc_error *parse_value5up(grpc_exec_ctx *exec_ctx,
121
+ grpc_chttp2_hpack_parser *p,
122
+ const uint8_t *cur, const uint8_t *end);
123
+
124
+ static grpc_error *parse_indexed_field(grpc_exec_ctx *exec_ctx,
125
+ grpc_chttp2_hpack_parser *p,
126
+ const uint8_t *cur, const uint8_t *end);
127
+ static grpc_error *parse_indexed_field_x(grpc_exec_ctx *exec_ctx,
128
+ grpc_chttp2_hpack_parser *p,
129
+ const uint8_t *cur,
130
+ const uint8_t *end);
131
+ static grpc_error *parse_lithdr_incidx(grpc_exec_ctx *exec_ctx,
132
+ grpc_chttp2_hpack_parser *p,
133
+ const uint8_t *cur, const uint8_t *end);
134
+ static grpc_error *parse_lithdr_incidx_x(grpc_exec_ctx *exec_ctx,
135
+ grpc_chttp2_hpack_parser *p,
136
+ const uint8_t *cur,
137
+ const uint8_t *end);
138
+ static grpc_error *parse_lithdr_incidx_v(grpc_exec_ctx *exec_ctx,
139
+ grpc_chttp2_hpack_parser *p,
140
+ const uint8_t *cur,
141
+ const uint8_t *end);
142
+ static grpc_error *parse_lithdr_notidx(grpc_exec_ctx *exec_ctx,
143
+ grpc_chttp2_hpack_parser *p,
144
+ const uint8_t *cur, const uint8_t *end);
145
+ static grpc_error *parse_lithdr_notidx_x(grpc_exec_ctx *exec_ctx,
146
+ grpc_chttp2_hpack_parser *p,
147
+ const uint8_t *cur,
148
+ const uint8_t *end);
149
+ static grpc_error *parse_lithdr_notidx_v(grpc_exec_ctx *exec_ctx,
150
+ grpc_chttp2_hpack_parser *p,
151
+ const uint8_t *cur,
152
+ const uint8_t *end);
153
+ static grpc_error *parse_lithdr_nvridx(grpc_exec_ctx *exec_ctx,
154
+ grpc_chttp2_hpack_parser *p,
155
+ const uint8_t *cur, const uint8_t *end);
156
+ static grpc_error *parse_lithdr_nvridx_x(grpc_exec_ctx *exec_ctx,
157
+ grpc_chttp2_hpack_parser *p,
158
+ const uint8_t *cur,
159
+ const uint8_t *end);
160
+ static grpc_error *parse_lithdr_nvridx_v(grpc_exec_ctx *exec_ctx,
161
+ grpc_chttp2_hpack_parser *p,
162
+ const uint8_t *cur,
163
+ const uint8_t *end);
164
+ static grpc_error *parse_max_tbl_size(grpc_exec_ctx *exec_ctx,
165
+ grpc_chttp2_hpack_parser *p,
166
+ const uint8_t *cur, const uint8_t *end);
167
+ static grpc_error *parse_max_tbl_size_x(grpc_exec_ctx *exec_ctx,
168
+ grpc_chttp2_hpack_parser *p,
169
+ const uint8_t *cur, const uint8_t *end);
170
+
171
+ /* we translate the first byte of a hpack field into one of these decoding
172
+ cases, then use a lookup table to jump directly to the appropriate parser.
173
+
174
+ _X => the integer index is all ones, meaning we need to do varint decoding
175
+ _V => the integer index is all zeros, meaning we need to decode an additional
176
+ string value */
177
+ typedef enum {
178
+ INDEXED_FIELD,
179
+ INDEXED_FIELD_X,
180
+ LITHDR_INCIDX,
181
+ LITHDR_INCIDX_X,
182
+ LITHDR_INCIDX_V,
183
+ LITHDR_NOTIDX,
184
+ LITHDR_NOTIDX_X,
185
+ LITHDR_NOTIDX_V,
186
+ LITHDR_NVRIDX,
187
+ LITHDR_NVRIDX_X,
188
+ LITHDR_NVRIDX_V,
189
+ MAX_TBL_SIZE,
190
+ MAX_TBL_SIZE_X,
191
+ ILLEGAL
192
+ } first_byte_type;
193
+
194
+ /* jump table of parse state functions -- order must match first_byte_type
195
+ above */
196
+ static const grpc_chttp2_hpack_parser_state first_byte_action[] = {
197
+ parse_indexed_field, parse_indexed_field_x, parse_lithdr_incidx,
198
+ parse_lithdr_incidx_x, parse_lithdr_incidx_v, parse_lithdr_notidx,
199
+ parse_lithdr_notidx_x, parse_lithdr_notidx_v, parse_lithdr_nvridx,
200
+ parse_lithdr_nvridx_x, parse_lithdr_nvridx_v, parse_max_tbl_size,
201
+ parse_max_tbl_size_x, parse_illegal_op};
202
+
203
+ /* indexes the first byte to a parse state function - generated by
204
+ gen_hpack_tables.c */
205
+ static const uint8_t first_byte_lut[256] = {
206
+ LITHDR_NOTIDX_V, LITHDR_NOTIDX, LITHDR_NOTIDX, LITHDR_NOTIDX,
207
+ LITHDR_NOTIDX, LITHDR_NOTIDX, LITHDR_NOTIDX, LITHDR_NOTIDX,
208
+ LITHDR_NOTIDX, LITHDR_NOTIDX, LITHDR_NOTIDX, LITHDR_NOTIDX,
209
+ LITHDR_NOTIDX, LITHDR_NOTIDX, LITHDR_NOTIDX, LITHDR_NOTIDX_X,
210
+ LITHDR_NVRIDX_V, LITHDR_NVRIDX, LITHDR_NVRIDX, LITHDR_NVRIDX,
211
+ LITHDR_NVRIDX, LITHDR_NVRIDX, LITHDR_NVRIDX, LITHDR_NVRIDX,
212
+ LITHDR_NVRIDX, LITHDR_NVRIDX, LITHDR_NVRIDX, LITHDR_NVRIDX,
213
+ LITHDR_NVRIDX, LITHDR_NVRIDX, LITHDR_NVRIDX, LITHDR_NVRIDX_X,
214
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE,
215
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE,
216
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE,
217
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE,
218
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE,
219
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE,
220
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE,
221
+ MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE, MAX_TBL_SIZE_X,
222
+ LITHDR_INCIDX_V, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
223
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
224
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
225
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
226
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
227
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
228
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
229
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
230
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
231
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
232
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
233
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
234
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
235
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
236
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX,
237
+ LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX, LITHDR_INCIDX_X,
238
+ ILLEGAL, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
239
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
240
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
241
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
242
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
243
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
244
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
245
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
246
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
247
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
248
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
249
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
250
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
251
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
252
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
253
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
254
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
255
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
256
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
257
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
258
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
259
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
260
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
261
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
262
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
263
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
264
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
265
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
266
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
267
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
268
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD,
269
+ INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD, INDEXED_FIELD_X,
270
+ };
271
+
272
+ /* state table for huffman decoding: given a state, gives an index/16 into
273
+ next_sub_tbl. Taking that index and adding the value of the nibble being
274
+ considered returns the next state.
275
+
276
+ generated by gen_hpack_tables.c */
277
+ static const uint8_t next_tbl[256] = {
278
+ 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 7, 8, 1, 3, 3, 9, 10, 11, 1, 1,
279
+ 1, 12, 1, 2, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
280
+ 14, 1, 15, 16, 1, 17, 1, 15, 2, 7, 3, 18, 19, 1, 1, 1, 1, 20, 1, 1,
281
+ 1, 1, 1, 1, 1, 1, 1, 1, 15, 2, 2, 7, 21, 1, 22, 1, 1, 1, 1, 1,
282
+ 1, 1, 1, 15, 2, 2, 2, 2, 2, 2, 23, 24, 25, 1, 1, 1, 1, 2, 2, 2,
283
+ 26, 3, 3, 27, 10, 28, 1, 1, 1, 1, 1, 1, 2, 3, 29, 10, 30, 1, 1, 1,
284
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 31, 1, 1, 1, 1, 1, 1, 1, 2,
285
+ 2, 2, 2, 2, 2, 2, 2, 32, 1, 1, 15, 33, 1, 34, 35, 9, 36, 1, 1, 1,
286
+ 1, 1, 1, 1, 37, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 26, 9,
287
+ 38, 1, 1, 1, 1, 1, 1, 1, 15, 2, 2, 2, 2, 26, 3, 3, 39, 1, 1, 1,
288
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 7, 3, 3, 3, 40, 2,
289
+ 41, 1, 1, 1, 42, 43, 1, 1, 44, 1, 1, 1, 1, 15, 2, 2, 2, 2, 2, 2,
290
+ 3, 3, 3, 45, 46, 1, 1, 2, 2, 2, 35, 3, 3, 18, 47, 2,
291
+ };
292
+
293
+ /* next state, based upon current state and the current nibble: see above.
294
+ generated by gen_hpack_tables.c */
295
+ static const int16_t next_sub_tbl[48 * 16] = {
296
+ 1, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
297
+ 218, 2, 6, 10, 13, 14, 15, 16, 17, 2, 6, 10, 13, 14, 15,
298
+ 16, 17, 3, 7, 11, 24, 3, 7, 11, 24, 3, 7, 11, 24, 3,
299
+ 7, 11, 24, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8,
300
+ 4, 8, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5,
301
+ 199, 200, 201, 202, 203, 4, 8, 4, 8, 0, 0, 0, 0, 0, 0,
302
+ 0, 0, 0, 0, 0, 0, 9, 133, 134, 135, 136, 137, 138, 139, 140,
303
+ 141, 142, 143, 144, 145, 146, 147, 3, 7, 11, 24, 3, 7, 11, 24,
304
+ 4, 8, 4, 8, 4, 8, 4, 8, 0, 0, 0, 0, 0, 0, 0,
305
+ 0, 0, 0, 0, 0, 0, 0, 12, 132, 4, 8, 4, 8, 4, 8,
306
+ 4, 8, 4, 8, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
307
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
308
+ 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 21, 4, 8, 4,
309
+ 8, 4, 8, 4, 8, 4, 8, 0, 0, 0, 22, 23, 91, 25, 26,
310
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 3,
311
+ 7, 11, 24, 3, 7, 11, 24, 0, 0, 0, 0, 0, 41, 42, 43,
312
+ 2, 6, 10, 13, 14, 15, 16, 17, 3, 7, 11, 24, 3, 7, 11,
313
+ 24, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 0, 0,
314
+ 44, 45, 2, 6, 10, 13, 14, 15, 16, 17, 46, 47, 48, 49, 50,
315
+ 51, 52, 57, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
316
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
317
+ 0, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
318
+ 68, 69, 70, 71, 72, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
319
+ 0, 0, 0, 0, 0, 0, 73, 75, 76, 77, 78, 79, 80, 81, 82,
320
+ 83, 84, 85, 86, 87, 88, 89, 90, 3, 7, 11, 24, 3, 7, 11,
321
+ 24, 3, 7, 11, 24, 0, 0, 0, 0, 3, 7, 11, 24, 3, 7,
322
+ 11, 24, 4, 8, 4, 8, 0, 0, 0, 92, 0, 0, 0, 93, 94,
323
+ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 3, 7, 11, 24,
324
+ 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4,
325
+ 8, 4, 8, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
326
+ 0, 0, 0, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 4,
327
+ 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 0, 0,
328
+ 0, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
329
+ 131, 2, 6, 10, 13, 14, 15, 16, 17, 4, 8, 4, 8, 4, 8,
330
+ 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 148,
331
+ 149, 150, 151, 3, 7, 11, 24, 4, 8, 4, 8, 0, 0, 0, 0,
332
+ 0, 0, 152, 153, 3, 7, 11, 24, 3, 7, 11, 24, 3, 7, 11,
333
+ 24, 154, 155, 156, 164, 3, 7, 11, 24, 3, 7, 11, 24, 3, 7,
334
+ 11, 24, 4, 8, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
335
+ 157, 158, 159, 160, 161, 162, 163, 165, 166, 167, 168, 169, 170, 171, 172,
336
+ 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
337
+ 188, 189, 190, 191, 192, 193, 194, 195, 196, 4, 8, 4, 8, 4, 8,
338
+ 4, 8, 4, 8, 4, 8, 4, 8, 197, 198, 4, 8, 4, 8, 4,
339
+ 8, 4, 8, 0, 0, 0, 0, 0, 0, 219, 220, 3, 7, 11, 24,
340
+ 4, 8, 4, 8, 4, 8, 0, 0, 221, 222, 223, 224, 3, 7, 11,
341
+ 24, 3, 7, 11, 24, 4, 8, 4, 8, 4, 8, 225, 228, 4, 8,
342
+ 4, 8, 4, 8, 0, 0, 0, 0, 0, 0, 0, 0, 226, 227, 229,
343
+ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
344
+ 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 0, 0, 0, 0, 0,
345
+ 0, 0, 0, 0, 0, 0, 0, 245, 246, 247, 248, 249, 250, 251, 252,
346
+ 253, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
347
+ 0, 0, 255,
348
+ };
349
+
350
+ /* emission table: indexed like next_tbl, ultimately gives the byte to be
351
+ emitted, or -1 for no byte, or 256 for end of stream
352
+
353
+ generated by gen_hpack_tables.c */
354
+ static const uint16_t emit_tbl[256] = {
355
+ 0, 1, 2, 3, 4, 5, 6, 7, 0, 8, 9, 10, 11, 12, 13,
356
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, 23, 24, 25, 26, 27,
357
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
358
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 0, 55, 56,
359
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 0,
360
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
361
+ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
362
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
363
+ 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
364
+ 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
365
+ 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 0,
366
+ 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174,
367
+ 0, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
368
+ 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203,
369
+ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218,
370
+ 219, 220, 221, 0, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
371
+ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
372
+ 248,
373
+ };
374
+
375
+ /* generated by gen_hpack_tables.c */
376
+ static const int16_t emit_sub_tbl[249 * 16] = {
377
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
378
+ -1, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49,
379
+ 49, 49, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 97,
380
+ 97, 97, 97, 48, 48, 49, 49, 50, 50, 97, 97, 99, 99, 101, 101,
381
+ 105, 105, 111, 111, 48, 49, 50, 97, 99, 101, 105, 111, 115, 116, -1,
382
+ -1, -1, -1, -1, -1, 32, 32, 32, 32, 32, 32, 32, 32, 37, 37,
383
+ 37, 37, 37, 37, 37, 37, 99, 99, 99, 99, 101, 101, 101, 101, 105,
384
+ 105, 105, 105, 111, 111, 111, 111, 115, 115, 116, 116, 32, 37, 45, 46,
385
+ 47, 51, 52, 53, 54, 55, 56, 57, 61, 61, 61, 61, 61, 61, 61,
386
+ 61, 65, 65, 65, 65, 65, 65, 65, 65, 115, 115, 115, 115, 116, 116,
387
+ 116, 116, 32, 32, 37, 37, 45, 45, 46, 46, 61, 65, 95, 98, 100,
388
+ 102, 103, 104, 108, 109, 110, 112, 114, 117, -1, -1, 58, 58, 58, 58,
389
+ 58, 58, 58, 58, 66, 66, 66, 66, 66, 66, 66, 66, 47, 47, 51,
390
+ 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 61, 61,
391
+ 65, 65, 95, 95, 98, 98, 100, 100, 102, 102, 103, 103, 104, 104, 108,
392
+ 108, 109, 109, 110, 110, 112, 112, 114, 114, 117, 117, 58, 66, 67, 68,
393
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
394
+ 84, 85, 86, 87, 89, 106, 107, 113, 118, 119, 120, 121, 122, -1, -1,
395
+ -1, -1, 38, 38, 38, 38, 38, 38, 38, 38, 42, 42, 42, 42, 42,
396
+ 42, 42, 42, 44, 44, 44, 44, 44, 44, 44, 44, 59, 59, 59, 59,
397
+ 59, 59, 59, 59, 88, 88, 88, 88, 88, 88, 88, 88, 90, 90, 90,
398
+ 90, 90, 90, 90, 90, 33, 33, 34, 34, 40, 40, 41, 41, 63, 63,
399
+ 39, 43, 124, -1, -1, -1, 35, 35, 35, 35, 35, 35, 35, 35, 62,
400
+ 62, 62, 62, 62, 62, 62, 62, 0, 0, 0, 0, 36, 36, 36, 36,
401
+ 64, 64, 64, 64, 91, 91, 91, 91, 69, 69, 69, 69, 69, 69, 69,
402
+ 69, 70, 70, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 71,
403
+ 71, 71, 72, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73,
404
+ 73, 73, 73, 74, 74, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75,
405
+ 75, 75, 75, 75, 76, 76, 76, 76, 76, 76, 76, 76, 77, 77, 77,
406
+ 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 78, 79, 79,
407
+ 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 81,
408
+ 81, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 82, 82,
409
+ 83, 83, 83, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 84,
410
+ 84, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86,
411
+ 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 89, 89, 89, 89, 89,
412
+ 89, 89, 89, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107,
413
+ 107, 107, 107, 107, 113, 113, 113, 113, 113, 113, 113, 113, 118, 118, 118,
414
+ 118, 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 119, 120, 120,
415
+ 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 121, 122,
416
+ 122, 122, 122, 122, 122, 122, 122, 38, 38, 38, 38, 42, 42, 42, 42,
417
+ 44, 44, 44, 44, 59, 59, 59, 59, 88, 88, 88, 88, 90, 90, 90,
418
+ 90, 33, 34, 40, 41, 63, -1, -1, -1, 39, 39, 39, 39, 39, 39,
419
+ 39, 39, 43, 43, 43, 43, 43, 43, 43, 43, 124, 124, 124, 124, 124,
420
+ 124, 124, 124, 35, 35, 35, 35, 62, 62, 62, 62, 0, 0, 36, 36,
421
+ 64, 64, 91, 91, 93, 93, 126, 126, 94, 125, -1, -1, 60, 60, 60,
422
+ 60, 60, 60, 60, 60, 96, 96, 96, 96, 96, 96, 96, 96, 123, 123,
423
+ 123, 123, 123, 123, 123, 123, -1, -1, -1, -1, -1, -1, -1, -1, 92,
424
+ 92, 92, 92, 92, 92, 92, 92, 195, 195, 195, 195, 195, 195, 195, 195,
425
+ 208, 208, 208, 208, 208, 208, 208, 208, 128, 128, 128, 128, 130, 130, 130,
426
+ 130, 131, 131, 131, 131, 162, 162, 162, 162, 184, 184, 184, 184, 194, 194,
427
+ 194, 194, 224, 224, 224, 224, 226, 226, 226, 226, 153, 153, 161, 161, 167,
428
+ 167, 172, 172, 176, 176, 177, 177, 179, 179, 209, 209, 216, 216, 217, 217,
429
+ 227, 227, 229, 229, 230, 230, 129, 132, 133, 134, 136, 146, 154, 156, 160,
430
+ 163, 164, 169, 170, 173, 178, 181, 185, 186, 187, 189, 190, 196, 198, 228,
431
+ 232, 233, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 135,
432
+ 135, 135, 135, 135, 135, 135, 135, 137, 137, 137, 137, 137, 137, 137, 137,
433
+ 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, 139, 139, 139,
434
+ 139, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141,
435
+ 141, 141, 143, 143, 143, 143, 143, 143, 143, 143, 147, 147, 147, 147, 147,
436
+ 147, 147, 147, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150,
437
+ 150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 152,
438
+ 152, 152, 152, 152, 152, 155, 155, 155, 155, 155, 155, 155, 155, 157, 157,
439
+ 157, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 165,
440
+ 165, 165, 165, 165, 165, 165, 165, 166, 166, 166, 166, 166, 166, 166, 166,
441
+ 168, 168, 168, 168, 168, 168, 168, 168, 174, 174, 174, 174, 174, 174, 174,
442
+ 174, 175, 175, 175, 175, 175, 175, 175, 175, 180, 180, 180, 180, 180, 180,
443
+ 180, 180, 182, 182, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183,
444
+ 183, 183, 183, 188, 188, 188, 188, 188, 188, 188, 188, 191, 191, 191, 191,
445
+ 191, 191, 191, 191, 197, 197, 197, 197, 197, 197, 197, 197, 231, 231, 231,
446
+ 231, 231, 231, 231, 231, 239, 239, 239, 239, 239, 239, 239, 239, 9, 9,
447
+ 9, 9, 142, 142, 142, 142, 144, 144, 144, 144, 145, 145, 145, 145, 148,
448
+ 148, 148, 148, 159, 159, 159, 159, 171, 171, 171, 171, 206, 206, 206, 206,
449
+ 215, 215, 215, 215, 225, 225, 225, 225, 236, 236, 236, 236, 237, 237, 237,
450
+ 237, 199, 199, 207, 207, 234, 234, 235, 235, 192, 193, 200, 201, 202, 205,
451
+ 210, 213, 218, 219, 238, 240, 242, 243, 255, -1, 203, 203, 203, 203, 203,
452
+ 203, 203, 203, 204, 204, 204, 204, 204, 204, 204, 204, 211, 211, 211, 211,
453
+ 211, 211, 211, 211, 212, 212, 212, 212, 212, 212, 212, 212, 214, 214, 214,
454
+ 214, 214, 214, 214, 214, 221, 221, 221, 221, 221, 221, 221, 221, 222, 222,
455
+ 222, 222, 222, 222, 222, 222, 223, 223, 223, 223, 223, 223, 223, 223, 241,
456
+ 241, 241, 241, 241, 241, 241, 241, 244, 244, 244, 244, 244, 244, 244, 244,
457
+ 245, 245, 245, 245, 245, 245, 245, 245, 246, 246, 246, 246, 246, 246, 246,
458
+ 246, 247, 247, 247, 247, 247, 247, 247, 247, 248, 248, 248, 248, 248, 248,
459
+ 248, 248, 250, 250, 250, 250, 250, 250, 250, 250, 251, 251, 251, 251, 251,
460
+ 251, 251, 251, 252, 252, 252, 252, 252, 252, 252, 252, 253, 253, 253, 253,
461
+ 253, 253, 253, 253, 254, 254, 254, 254, 254, 254, 254, 254, 2, 2, 2,
462
+ 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,
463
+ 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 11, 11, 11, 11, 12,
464
+ 12, 12, 12, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16,
465
+ 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20,
466
+ 20, 21, 21, 21, 21, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25,
467
+ 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29,
468
+ 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 127, 127, 127, 127,
469
+ 220, 220, 220, 220, 249, 249, 249, 249, 10, 13, 22, 256, 93, 93, 93,
470
+ 93, 126, 126, 126, 126, 94, 94, 125, 125, 60, 96, 123, -1, 92, 195,
471
+ 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128,
472
+ 128, 128, 128, 128, 128, 128, 128, 130, 130, 130, 130, 130, 130, 130, 130,
473
+ 131, 131, 131, 131, 131, 131, 131, 131, 162, 162, 162, 162, 162, 162, 162,
474
+ 162, 184, 184, 184, 184, 184, 184, 184, 184, 194, 194, 194, 194, 194, 194,
475
+ 194, 194, 224, 224, 224, 224, 224, 224, 224, 224, 226, 226, 226, 226, 226,
476
+ 226, 226, 226, 153, 153, 153, 153, 161, 161, 161, 161, 167, 167, 167, 167,
477
+ 172, 172, 172, 172, 176, 176, 176, 176, 177, 177, 177, 177, 179, 179, 179,
478
+ 179, 209, 209, 209, 209, 216, 216, 216, 216, 217, 217, 217, 217, 227, 227,
479
+ 227, 227, 229, 229, 229, 229, 230, 230, 230, 230, 129, 129, 132, 132, 133,
480
+ 133, 134, 134, 136, 136, 146, 146, 154, 154, 156, 156, 160, 160, 163, 163,
481
+ 164, 164, 169, 169, 170, 170, 173, 173, 178, 178, 181, 181, 185, 185, 186,
482
+ 186, 187, 187, 189, 189, 190, 190, 196, 196, 198, 198, 228, 228, 232, 232,
483
+ 233, 233, 1, 135, 137, 138, 139, 140, 141, 143, 147, 149, 150, 151, 152,
484
+ 155, 157, 158, 165, 166, 168, 174, 175, 180, 182, 183, 188, 191, 197, 231,
485
+ 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 9, 9,
486
+ 9, 9, 9, 9, 9, 142, 142, 142, 142, 142, 142, 142, 142, 144, 144,
487
+ 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 145, 145, 148,
488
+ 148, 148, 148, 148, 148, 148, 148, 159, 159, 159, 159, 159, 159, 159, 159,
489
+ 171, 171, 171, 171, 171, 171, 171, 171, 206, 206, 206, 206, 206, 206, 206,
490
+ 206, 215, 215, 215, 215, 215, 215, 215, 215, 225, 225, 225, 225, 225, 225,
491
+ 225, 225, 236, 236, 236, 236, 236, 236, 236, 236, 237, 237, 237, 237, 237,
492
+ 237, 237, 237, 199, 199, 199, 199, 207, 207, 207, 207, 234, 234, 234, 234,
493
+ 235, 235, 235, 235, 192, 192, 193, 193, 200, 200, 201, 201, 202, 202, 205,
494
+ 205, 210, 210, 213, 213, 218, 218, 219, 219, 238, 238, 240, 240, 242, 242,
495
+ 243, 243, 255, 255, 203, 204, 211, 212, 214, 221, 222, 223, 241, 244, 245,
496
+ 246, 247, 248, 250, 251, 252, 253, 254, -1, -1, -1, -1, -1, -1, -1,
497
+ -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, 2,
498
+ 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
499
+ 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
500
+ 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
501
+ 8, 8, 8, 8, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12,
502
+ 12, 12, 12, 12, 12, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15,
503
+ 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17,
504
+ 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18,
505
+ 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20,
506
+ 20, 21, 21, 21, 21, 21, 21, 21, 21, 23, 23, 23, 23, 23, 23,
507
+ 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25,
508
+ 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27,
509
+ 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29,
510
+ 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31,
511
+ 31, 31, 31, 31, 31, 31, 127, 127, 127, 127, 127, 127, 127, 127, 220,
512
+ 220, 220, 220, 220, 220, 220, 220, 249, 249, 249, 249, 249, 249, 249, 249,
513
+ 10, 10, 13, 13, 22, 22, 256, 256, 67, 67, 67, 67, 67, 67, 67,
514
+ 67, 68, 68, 68, 68, 68, 68, 68, 68, 95, 95, 95, 95, 95, 95,
515
+ 95, 95, 98, 98, 98, 98, 98, 98, 98, 98, 100, 100, 100, 100, 100,
516
+ 100, 100, 100, 102, 102, 102, 102, 102, 102, 102, 102, 103, 103, 103, 103,
517
+ 103, 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, 108, 108, 108,
518
+ 108, 108, 108, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 110, 110,
519
+ 110, 110, 110, 110, 110, 110, 112, 112, 112, 112, 112, 112, 112, 112, 114,
520
+ 114, 114, 114, 114, 114, 114, 114, 117, 117, 117, 117, 117, 117, 117, 117,
521
+ 58, 58, 58, 58, 66, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68,
522
+ 68, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 72, 72,
523
+ 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 75, 76,
524
+ 76, 76, 76, 77, 77, 77, 77, 78, 78, 78, 78, 79, 79, 79, 79,
525
+ 80, 80, 80, 80, 81, 81, 81, 81, 82, 82, 82, 82, 83, 83, 83,
526
+ 83, 84, 84, 84, 84, 85, 85, 85, 85, 86, 86, 86, 86, 87, 87,
527
+ 87, 87, 89, 89, 89, 89, 106, 106, 106, 106, 107, 107, 107, 107, 113,
528
+ 113, 113, 113, 118, 118, 118, 118, 119, 119, 119, 119, 120, 120, 120, 120,
529
+ 121, 121, 121, 121, 122, 122, 122, 122, 38, 38, 42, 42, 44, 44, 59,
530
+ 59, 88, 88, 90, 90, -1, -1, -1, -1, 33, 33, 33, 33, 33, 33,
531
+ 33, 33, 34, 34, 34, 34, 34, 34, 34, 34, 40, 40, 40, 40, 40,
532
+ 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 63, 63, 63, 63,
533
+ 63, 63, 63, 63, 39, 39, 39, 39, 43, 43, 43, 43, 124, 124, 124,
534
+ 124, 35, 35, 62, 62, 0, 36, 64, 91, 93, 126, -1, -1, 94, 94,
535
+ 94, 94, 94, 94, 94, 94, 125, 125, 125, 125, 125, 125, 125, 125, 60,
536
+ 60, 60, 60, 96, 96, 96, 96, 123, 123, 123, 123, -1, -1, -1, -1,
537
+ 92, 92, 92, 92, 195, 195, 195, 195, 208, 208, 208, 208, 128, 128, 130,
538
+ 130, 131, 131, 162, 162, 184, 184, 194, 194, 224, 224, 226, 226, 153, 161,
539
+ 167, 172, 176, 177, 179, 209, 216, 217, 227, 229, 230, -1, -1, -1, -1,
540
+ -1, -1, -1, 129, 129, 129, 129, 129, 129, 129, 129, 132, 132, 132, 132,
541
+ 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, 134,
542
+ 134, 134, 134, 134, 134, 136, 136, 136, 136, 136, 136, 136, 136, 146, 146,
543
+ 146, 146, 146, 146, 146, 146, 154, 154, 154, 154, 154, 154, 154, 154, 156,
544
+ 156, 156, 156, 156, 156, 156, 156, 160, 160, 160, 160, 160, 160, 160, 160,
545
+ 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, 164, 164, 164, 164, 164,
546
+ 164, 169, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170,
547
+ 170, 170, 173, 173, 173, 173, 173, 173, 173, 173, 178, 178, 178, 178, 178,
548
+ 178, 178, 178, 181, 181, 181, 181, 181, 181, 181, 181, 185, 185, 185, 185,
549
+ 185, 185, 185, 185, 186, 186, 186, 186, 186, 186, 186, 186, 187, 187, 187,
550
+ 187, 187, 187, 187, 187, 189, 189, 189, 189, 189, 189, 189, 189, 190, 190,
551
+ 190, 190, 190, 190, 190, 190, 196, 196, 196, 196, 196, 196, 196, 196, 198,
552
+ 198, 198, 198, 198, 198, 198, 198, 228, 228, 228, 228, 228, 228, 228, 228,
553
+ 232, 232, 232, 232, 232, 232, 232, 232, 233, 233, 233, 233, 233, 233, 233,
554
+ 233, 1, 1, 1, 1, 135, 135, 135, 135, 137, 137, 137, 137, 138, 138,
555
+ 138, 138, 139, 139, 139, 139, 140, 140, 140, 140, 141, 141, 141, 141, 143,
556
+ 143, 143, 143, 147, 147, 147, 147, 149, 149, 149, 149, 150, 150, 150, 150,
557
+ 151, 151, 151, 151, 152, 152, 152, 152, 155, 155, 155, 155, 157, 157, 157,
558
+ 157, 158, 158, 158, 158, 165, 165, 165, 165, 166, 166, 166, 166, 168, 168,
559
+ 168, 168, 174, 174, 174, 174, 175, 175, 175, 175, 180, 180, 180, 180, 182,
560
+ 182, 182, 182, 183, 183, 183, 183, 188, 188, 188, 188, 191, 191, 191, 191,
561
+ 197, 197, 197, 197, 231, 231, 231, 231, 239, 239, 239, 239, 9, 9, 142,
562
+ 142, 144, 144, 145, 145, 148, 148, 159, 159, 171, 171, 206, 206, 215, 215,
563
+ 225, 225, 236, 236, 237, 237, 199, 207, 234, 235, 192, 192, 192, 192, 192,
564
+ 192, 192, 192, 193, 193, 193, 193, 193, 193, 193, 193, 200, 200, 200, 200,
565
+ 200, 200, 200, 200, 201, 201, 201, 201, 201, 201, 201, 201, 202, 202, 202,
566
+ 202, 202, 202, 202, 202, 205, 205, 205, 205, 205, 205, 205, 205, 210, 210,
567
+ 210, 210, 210, 210, 210, 210, 213, 213, 213, 213, 213, 213, 213, 213, 218,
568
+ 218, 218, 218, 218, 218, 218, 218, 219, 219, 219, 219, 219, 219, 219, 219,
569
+ 238, 238, 238, 238, 238, 238, 238, 238, 240, 240, 240, 240, 240, 240, 240,
570
+ 240, 242, 242, 242, 242, 242, 242, 242, 242, 243, 243, 243, 243, 243, 243,
571
+ 243, 243, 255, 255, 255, 255, 255, 255, 255, 255, 203, 203, 203, 203, 204,
572
+ 204, 204, 204, 211, 211, 211, 211, 212, 212, 212, 212, 214, 214, 214, 214,
573
+ 221, 221, 221, 221, 222, 222, 222, 222, 223, 223, 223, 223, 241, 241, 241,
574
+ 241, 244, 244, 244, 244, 245, 245, 245, 245, 246, 246, 246, 246, 247, 247,
575
+ 247, 247, 248, 248, 248, 248, 250, 250, 250, 250, 251, 251, 251, 251, 252,
576
+ 252, 252, 252, 253, 253, 253, 253, 254, 254, 254, 254, 2, 2, 3, 3,
577
+ 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 11, 11, 12, 12, 14,
578
+ 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21,
579
+ 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30,
580
+ 30, 31, 31, 127, 127, 220, 220, 249, 249, -1, -1, 10, 10, 10, 10,
581
+ 10, 10, 10, 10, 13, 13, 13, 13, 13, 13, 13, 13, 22, 22, 22,
582
+ 22, 22, 22, 22, 22, 256, 256, 256, 256, 256, 256, 256, 256, 45, 45,
583
+ 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 47,
584
+ 47, 47, 47, 47, 47, 47, 47, 51, 51, 51, 51, 51, 51, 51, 51,
585
+ 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53,
586
+ 53, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55,
587
+ 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57,
588
+ 57, 57, 57, 50, 50, 50, 50, 50, 50, 50, 50, 97, 97, 97, 97,
589
+ 97, 97, 97, 97, 99, 99, 99, 99, 99, 99, 99, 99, 101, 101, 101,
590
+ 101, 101, 101, 101, 101, 105, 105, 105, 105, 105, 105, 105, 105, 111, 111,
591
+ 111, 111, 111, 111, 111, 111, 115, 115, 115, 115, 115, 115, 115, 115, 116,
592
+ 116, 116, 116, 116, 116, 116, 116, 32, 32, 32, 32, 37, 37, 37, 37,
593
+ 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 51, 51, 51,
594
+ 51, 52, 52, 52, 52, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55,
595
+ 55, 55, 56, 56, 56, 56, 57, 57, 57, 57, 61, 61, 61, 61, 65,
596
+ 65, 65, 65, 95, 95, 95, 95, 98, 98, 98, 98, 100, 100, 100, 100,
597
+ 102, 102, 102, 102, 103, 103, 103, 103, 104, 104, 104, 104, 108, 108, 108,
598
+ 108, 109, 109, 109, 109, 110, 110, 110, 110, 112, 112, 112, 112, 114, 114,
599
+ 114, 114, 117, 117, 117, 117, 58, 58, 66, 66, 67, 67, 68, 68, 69,
600
+ 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76,
601
+ 77, 77, 78, 78, 79, 79, 80, 80, 81, 81, 82, 82, 83, 83, 84,
602
+ 84, 85, 85, 86, 86, 87, 87, 89, 89, 106, 106, 107, 107, 113, 113,
603
+ 118, 118, 119, 119, 120, 120, 121, 121, 122, 122, 38, 42, 44, 59, 88,
604
+ 90, -1, -1, 33, 33, 33, 33, 34, 34, 34, 34, 40, 40, 40, 40,
605
+ 41, 41, 41, 41, 63, 63, 63, 63, 39, 39, 43, 43, 124, 124, 35,
606
+ 62, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 36, 36,
607
+ 36, 36, 36, 36, 36, 36, 64, 64, 64, 64, 64, 64, 64, 64, 91,
608
+ 91, 91, 91, 91, 91, 91, 91, 93, 93, 93, 93, 93, 93, 93, 93,
609
+ 126, 126, 126, 126, 126, 126, 126, 126, 94, 94, 94, 94, 125, 125, 125,
610
+ 125, 60, 60, 96, 96, 123, 123, -1, -1, 92, 92, 195, 195, 208, 208,
611
+ 128, 130, 131, 162, 184, 194, 224, 226, -1, -1, 153, 153, 153, 153, 153,
612
+ 153, 153, 153, 161, 161, 161, 161, 161, 161, 161, 161, 167, 167, 167, 167,
613
+ 167, 167, 167, 167, 172, 172, 172, 172, 172, 172, 172, 172, 176, 176, 176,
614
+ 176, 176, 176, 176, 176, 177, 177, 177, 177, 177, 177, 177, 177, 179, 179,
615
+ 179, 179, 179, 179, 179, 179, 209, 209, 209, 209, 209, 209, 209, 209, 216,
616
+ 216, 216, 216, 216, 216, 216, 216, 217, 217, 217, 217, 217, 217, 217, 217,
617
+ 227, 227, 227, 227, 227, 227, 227, 227, 229, 229, 229, 229, 229, 229, 229,
618
+ 229, 230, 230, 230, 230, 230, 230, 230, 230, 129, 129, 129, 129, 132, 132,
619
+ 132, 132, 133, 133, 133, 133, 134, 134, 134, 134, 136, 136, 136, 136, 146,
620
+ 146, 146, 146, 154, 154, 154, 154, 156, 156, 156, 156, 160, 160, 160, 160,
621
+ 163, 163, 163, 163, 164, 164, 164, 164, 169, 169, 169, 169, 170, 170, 170,
622
+ 170, 173, 173, 173, 173, 178, 178, 178, 178, 181, 181, 181, 181, 185, 185,
623
+ 185, 185, 186, 186, 186, 186, 187, 187, 187, 187, 189, 189, 189, 189, 190,
624
+ 190, 190, 190, 196, 196, 196, 196, 198, 198, 198, 198, 228, 228, 228, 228,
625
+ 232, 232, 232, 232, 233, 233, 233, 233, 1, 1, 135, 135, 137, 137, 138,
626
+ 138, 139, 139, 140, 140, 141, 141, 143, 143, 147, 147, 149, 149, 150, 150,
627
+ 151, 151, 152, 152, 155, 155, 157, 157, 158, 158, 165, 165, 166, 166, 168,
628
+ 168, 174, 174, 175, 175, 180, 180, 182, 182, 183, 183, 188, 188, 191, 191,
629
+ 197, 197, 231, 231, 239, 239, 9, 142, 144, 145, 148, 159, 171, 206, 215,
630
+ 225, 236, 237, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 199, 199,
631
+ 199, 199, 199, 199, 199, 199, 207, 207, 207, 207, 207, 207, 207, 207, 234,
632
+ 234, 234, 234, 234, 234, 234, 234, 235, 235, 235, 235, 235, 235, 235, 235,
633
+ 192, 192, 192, 192, 193, 193, 193, 193, 200, 200, 200, 200, 201, 201, 201,
634
+ 201, 202, 202, 202, 202, 205, 205, 205, 205, 210, 210, 210, 210, 213, 213,
635
+ 213, 213, 218, 218, 218, 218, 219, 219, 219, 219, 238, 238, 238, 238, 240,
636
+ 240, 240, 240, 242, 242, 242, 242, 243, 243, 243, 243, 255, 255, 255, 255,
637
+ 203, 203, 204, 204, 211, 211, 212, 212, 214, 214, 221, 221, 222, 222, 223,
638
+ 223, 241, 241, 244, 244, 245, 245, 246, 246, 247, 247, 248, 248, 250, 250,
639
+ 251, 251, 252, 252, 253, 253, 254, 254, 2, 3, 4, 5, 6, 7, 8,
640
+ 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27,
641
+ 28, 29, 30, 31, 127, 220, 249, -1, 10, 10, 10, 10, 13, 13, 13,
642
+ 13, 22, 22, 22, 22, 256, 256, 256, 256,
643
+ };
644
+
645
+ static const uint8_t inverse_base64[256] = {
646
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
647
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
648
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255,
649
+ 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255,
650
+ 255, 64, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
651
+ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
652
+ 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33,
653
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
654
+ 49, 50, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
655
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
656
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
657
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
658
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
659
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
660
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
661
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
662
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
663
+ 255,
664
+ };
665
+
666
+ /* emission helpers */
667
+ static grpc_error *on_hdr(grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p,
668
+ grpc_mdelem md, int add_to_table) {
669
+ if (grpc_http_trace && !GRPC_MDELEM_IS_INTERNED(md)) {
670
+ char *k = grpc_slice_to_c_string(GRPC_MDKEY(md));
671
+ char *v = grpc_slice_to_c_string(GRPC_MDVALUE(md));
672
+ gpr_log(
673
+ GPR_DEBUG,
674
+ "Decode: '%s: %s', elem_interned=%d [%d], k_interned=%d, v_interned=%d",
675
+ k, v, GRPC_MDELEM_IS_INTERNED(md), GRPC_MDELEM_STORAGE(md),
676
+ grpc_slice_is_interned(GRPC_MDKEY(md)),
677
+ grpc_slice_is_interned(GRPC_MDVALUE(md)));
678
+ gpr_free(k);
679
+ gpr_free(v);
680
+ }
681
+ if (add_to_table) {
682
+ GPR_ASSERT(GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_INTERNED ||
683
+ GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC);
684
+ grpc_error *err = grpc_chttp2_hptbl_add(exec_ctx, &p->table, md);
685
+ if (err != GRPC_ERROR_NONE) return err;
686
+ }
687
+ if (p->on_header == NULL) {
688
+ GRPC_MDELEM_UNREF(exec_ctx, md);
689
+ return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
690
+ }
691
+ p->on_header(exec_ctx, p->on_header_user_data, md);
692
+ return GRPC_ERROR_NONE;
693
+ }
694
+
695
+ static grpc_slice take_string(grpc_exec_ctx *exec_ctx,
696
+ grpc_chttp2_hpack_parser *p,
697
+ grpc_chttp2_hpack_parser_string *str,
698
+ bool intern) {
699
+ grpc_slice s;
700
+ if (!str->copied) {
701
+ if (intern) {
702
+ s = grpc_slice_intern(str->data.referenced);
703
+ grpc_slice_unref_internal(exec_ctx, str->data.referenced);
704
+ } else {
705
+ s = str->data.referenced;
706
+ }
707
+ str->copied = true;
708
+ str->data.referenced = grpc_empty_slice();
709
+ } else if (intern) {
710
+ s = grpc_slice_intern(grpc_slice_from_static_buffer(
711
+ str->data.copied.str, str->data.copied.length));
712
+ } else {
713
+ s = grpc_slice_from_copied_buffer(str->data.copied.str,
714
+ str->data.copied.length);
715
+ }
716
+ str->data.copied.length = 0;
717
+ return s;
718
+ }
719
+
720
+ /* jump to the next state */
721
+ static grpc_error *parse_next(grpc_exec_ctx *exec_ctx,
722
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
723
+ const uint8_t *end) {
724
+ p->state = *p->next_state++;
725
+ return p->state(exec_ctx, p, cur, end);
726
+ }
727
+
728
+ /* begin parsing a header: all functionality is encoded into lookup tables
729
+ above */
730
+ static grpc_error *parse_begin(grpc_exec_ctx *exec_ctx,
731
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
732
+ const uint8_t *end) {
733
+ if (cur == end) {
734
+ p->state = parse_begin;
735
+ return GRPC_ERROR_NONE;
736
+ }
737
+
738
+ return first_byte_action[first_byte_lut[*cur]](exec_ctx, p, cur, end);
739
+ }
740
+
741
+ /* stream dependency and prioritization data: we just skip it */
742
+ static grpc_error *parse_stream_weight(grpc_exec_ctx *exec_ctx,
743
+ grpc_chttp2_hpack_parser *p,
744
+ const uint8_t *cur, const uint8_t *end) {
745
+ if (cur == end) {
746
+ p->state = parse_stream_weight;
747
+ return GRPC_ERROR_NONE;
748
+ }
749
+
750
+ return p->after_prioritization(exec_ctx, p, cur + 1, end);
751
+ }
752
+
753
+ static grpc_error *parse_stream_dep3(grpc_exec_ctx *exec_ctx,
754
+ grpc_chttp2_hpack_parser *p,
755
+ const uint8_t *cur, const uint8_t *end) {
756
+ if (cur == end) {
757
+ p->state = parse_stream_dep3;
758
+ return GRPC_ERROR_NONE;
759
+ }
760
+
761
+ return parse_stream_weight(exec_ctx, p, cur + 1, end);
762
+ }
763
+
764
+ static grpc_error *parse_stream_dep2(grpc_exec_ctx *exec_ctx,
765
+ grpc_chttp2_hpack_parser *p,
766
+ const uint8_t *cur, const uint8_t *end) {
767
+ if (cur == end) {
768
+ p->state = parse_stream_dep2;
769
+ return GRPC_ERROR_NONE;
770
+ }
771
+
772
+ return parse_stream_dep3(exec_ctx, p, cur + 1, end);
773
+ }
774
+
775
+ static grpc_error *parse_stream_dep1(grpc_exec_ctx *exec_ctx,
776
+ grpc_chttp2_hpack_parser *p,
777
+ const uint8_t *cur, const uint8_t *end) {
778
+ if (cur == end) {
779
+ p->state = parse_stream_dep1;
780
+ return GRPC_ERROR_NONE;
781
+ }
782
+
783
+ return parse_stream_dep2(exec_ctx, p, cur + 1, end);
784
+ }
785
+
786
+ static grpc_error *parse_stream_dep0(grpc_exec_ctx *exec_ctx,
787
+ grpc_chttp2_hpack_parser *p,
788
+ const uint8_t *cur, const uint8_t *end) {
789
+ if (cur == end) {
790
+ p->state = parse_stream_dep0;
791
+ return GRPC_ERROR_NONE;
792
+ }
793
+
794
+ return parse_stream_dep1(exec_ctx, p, cur + 1, end);
795
+ }
796
+
797
+ /* emit an indexed field; for now just logs it to console; jumps to
798
+ begin the next field on completion */
799
+ static grpc_error *finish_indexed_field(grpc_exec_ctx *exec_ctx,
800
+ grpc_chttp2_hpack_parser *p,
801
+ const uint8_t *cur,
802
+ const uint8_t *end) {
803
+ grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
804
+ if (GRPC_MDISNULL(md)) {
805
+ return grpc_error_set_int(
806
+ grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
807
+ "Invalid HPACK index received"),
808
+ GRPC_ERROR_INT_INDEX, (intptr_t)p->index),
809
+ GRPC_ERROR_INT_SIZE, (intptr_t)p->table.num_ents);
810
+ }
811
+ GRPC_MDELEM_REF(md);
812
+ grpc_error *err = on_hdr(exec_ctx, p, md, 0);
813
+ if (err != GRPC_ERROR_NONE) return err;
814
+ return parse_begin(exec_ctx, p, cur, end);
815
+ }
816
+
817
+ /* parse an indexed field with index < 127 */
818
+ static grpc_error *parse_indexed_field(grpc_exec_ctx *exec_ctx,
819
+ grpc_chttp2_hpack_parser *p,
820
+ const uint8_t *cur, const uint8_t *end) {
821
+ p->dynamic_table_update_allowed = 0;
822
+ p->index = (*cur) & 0x7f;
823
+ return finish_indexed_field(exec_ctx, p, cur + 1, end);
824
+ }
825
+
826
+ /* parse an indexed field with index >= 127 */
827
+ static grpc_error *parse_indexed_field_x(grpc_exec_ctx *exec_ctx,
828
+ grpc_chttp2_hpack_parser *p,
829
+ const uint8_t *cur,
830
+ const uint8_t *end) {
831
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
832
+ finish_indexed_field};
833
+ p->dynamic_table_update_allowed = 0;
834
+ p->next_state = and_then;
835
+ p->index = 0x7f;
836
+ p->parsing.value = &p->index;
837
+ return parse_value0(exec_ctx, p, cur + 1, end);
838
+ }
839
+
840
+ /* finish a literal header with incremental indexing: just log, and jump to '
841
+ begin */
842
+ static grpc_error *finish_lithdr_incidx(grpc_exec_ctx *exec_ctx,
843
+ grpc_chttp2_hpack_parser *p,
844
+ const uint8_t *cur,
845
+ const uint8_t *end) {
846
+ grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
847
+ GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
848
+ grpc_error *err = on_hdr(
849
+ exec_ctx, p,
850
+ grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
851
+ take_string(exec_ctx, p, &p->value, true)),
852
+ 1);
853
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
854
+ return parse_begin(exec_ctx, p, cur, end);
855
+ }
856
+
857
+ /* finish a literal header with incremental indexing with no index */
858
+ static grpc_error *finish_lithdr_incidx_v(grpc_exec_ctx *exec_ctx,
859
+ grpc_chttp2_hpack_parser *p,
860
+ const uint8_t *cur,
861
+ const uint8_t *end) {
862
+ grpc_error *err = on_hdr(
863
+ exec_ctx, p,
864
+ grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
865
+ take_string(exec_ctx, p, &p->value, true)),
866
+ 1);
867
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
868
+ return parse_begin(exec_ctx, p, cur, end);
869
+ }
870
+
871
+ /* parse a literal header with incremental indexing; index < 63 */
872
+ static grpc_error *parse_lithdr_incidx(grpc_exec_ctx *exec_ctx,
873
+ grpc_chttp2_hpack_parser *p,
874
+ const uint8_t *cur, const uint8_t *end) {
875
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
876
+ parse_value_string_with_indexed_key, finish_lithdr_incidx};
877
+ p->dynamic_table_update_allowed = 0;
878
+ p->next_state = and_then;
879
+ p->index = (*cur) & 0x3f;
880
+ return parse_string_prefix(exec_ctx, p, cur + 1, end);
881
+ }
882
+
883
+ /* parse a literal header with incremental indexing; index >= 63 */
884
+ static grpc_error *parse_lithdr_incidx_x(grpc_exec_ctx *exec_ctx,
885
+ grpc_chttp2_hpack_parser *p,
886
+ const uint8_t *cur,
887
+ const uint8_t *end) {
888
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
889
+ parse_string_prefix, parse_value_string_with_indexed_key,
890
+ finish_lithdr_incidx};
891
+ p->dynamic_table_update_allowed = 0;
892
+ p->next_state = and_then;
893
+ p->index = 0x3f;
894
+ p->parsing.value = &p->index;
895
+ return parse_value0(exec_ctx, p, cur + 1, end);
896
+ }
897
+
898
+ /* parse a literal header with incremental indexing; index = 0 */
899
+ static grpc_error *parse_lithdr_incidx_v(grpc_exec_ctx *exec_ctx,
900
+ grpc_chttp2_hpack_parser *p,
901
+ const uint8_t *cur,
902
+ const uint8_t *end) {
903
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
904
+ parse_key_string, parse_string_prefix,
905
+ parse_value_string_with_literal_key, finish_lithdr_incidx_v};
906
+ p->dynamic_table_update_allowed = 0;
907
+ p->next_state = and_then;
908
+ return parse_string_prefix(exec_ctx, p, cur + 1, end);
909
+ }
910
+
911
+ /* finish a literal header without incremental indexing */
912
+ static grpc_error *finish_lithdr_notidx(grpc_exec_ctx *exec_ctx,
913
+ grpc_chttp2_hpack_parser *p,
914
+ const uint8_t *cur,
915
+ const uint8_t *end) {
916
+ grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
917
+ GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
918
+ grpc_error *err = on_hdr(
919
+ exec_ctx, p,
920
+ grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
921
+ take_string(exec_ctx, p, &p->value, false)),
922
+ 0);
923
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
924
+ return parse_begin(exec_ctx, p, cur, end);
925
+ }
926
+
927
+ /* finish a literal header without incremental indexing with index = 0 */
928
+ static grpc_error *finish_lithdr_notidx_v(grpc_exec_ctx *exec_ctx,
929
+ grpc_chttp2_hpack_parser *p,
930
+ const uint8_t *cur,
931
+ const uint8_t *end) {
932
+ grpc_error *err = on_hdr(
933
+ exec_ctx, p,
934
+ grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
935
+ take_string(exec_ctx, p, &p->value, false)),
936
+ 0);
937
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
938
+ return parse_begin(exec_ctx, p, cur, end);
939
+ }
940
+
941
+ /* parse a literal header without incremental indexing; index < 15 */
942
+ static grpc_error *parse_lithdr_notidx(grpc_exec_ctx *exec_ctx,
943
+ grpc_chttp2_hpack_parser *p,
944
+ const uint8_t *cur, const uint8_t *end) {
945
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
946
+ parse_value_string_with_indexed_key, finish_lithdr_notidx};
947
+ p->dynamic_table_update_allowed = 0;
948
+ p->next_state = and_then;
949
+ p->index = (*cur) & 0xf;
950
+ return parse_string_prefix(exec_ctx, p, cur + 1, end);
951
+ }
952
+
953
+ /* parse a literal header without incremental indexing; index >= 15 */
954
+ static grpc_error *parse_lithdr_notidx_x(grpc_exec_ctx *exec_ctx,
955
+ grpc_chttp2_hpack_parser *p,
956
+ const uint8_t *cur,
957
+ const uint8_t *end) {
958
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
959
+ parse_string_prefix, parse_value_string_with_indexed_key,
960
+ finish_lithdr_notidx};
961
+ p->dynamic_table_update_allowed = 0;
962
+ p->next_state = and_then;
963
+ p->index = 0xf;
964
+ p->parsing.value = &p->index;
965
+ return parse_value0(exec_ctx, p, cur + 1, end);
966
+ }
967
+
968
+ /* parse a literal header without incremental indexing; index == 0 */
969
+ static grpc_error *parse_lithdr_notidx_v(grpc_exec_ctx *exec_ctx,
970
+ grpc_chttp2_hpack_parser *p,
971
+ const uint8_t *cur,
972
+ const uint8_t *end) {
973
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
974
+ parse_key_string, parse_string_prefix,
975
+ parse_value_string_with_literal_key, finish_lithdr_notidx_v};
976
+ p->dynamic_table_update_allowed = 0;
977
+ p->next_state = and_then;
978
+ return parse_string_prefix(exec_ctx, p, cur + 1, end);
979
+ }
980
+
981
+ /* finish a literal header that is never indexed */
982
+ static grpc_error *finish_lithdr_nvridx(grpc_exec_ctx *exec_ctx,
983
+ grpc_chttp2_hpack_parser *p,
984
+ const uint8_t *cur,
985
+ const uint8_t *end) {
986
+ grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
987
+ GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
988
+ grpc_error *err = on_hdr(
989
+ exec_ctx, p,
990
+ grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
991
+ take_string(exec_ctx, p, &p->value, false)),
992
+ 0);
993
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
994
+ return parse_begin(exec_ctx, p, cur, end);
995
+ }
996
+
997
+ /* finish a literal header that is never indexed with an extra value */
998
+ static grpc_error *finish_lithdr_nvridx_v(grpc_exec_ctx *exec_ctx,
999
+ grpc_chttp2_hpack_parser *p,
1000
+ const uint8_t *cur,
1001
+ const uint8_t *end) {
1002
+ grpc_error *err = on_hdr(
1003
+ exec_ctx, p,
1004
+ grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
1005
+ take_string(exec_ctx, p, &p->value, false)),
1006
+ 0);
1007
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1008
+ return parse_begin(exec_ctx, p, cur, end);
1009
+ }
1010
+
1011
+ /* parse a literal header that is never indexed; index < 15 */
1012
+ static grpc_error *parse_lithdr_nvridx(grpc_exec_ctx *exec_ctx,
1013
+ grpc_chttp2_hpack_parser *p,
1014
+ const uint8_t *cur, const uint8_t *end) {
1015
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
1016
+ parse_value_string_with_indexed_key, finish_lithdr_nvridx};
1017
+ p->dynamic_table_update_allowed = 0;
1018
+ p->next_state = and_then;
1019
+ p->index = (*cur) & 0xf;
1020
+ return parse_string_prefix(exec_ctx, p, cur + 1, end);
1021
+ }
1022
+
1023
+ /* parse a literal header that is never indexed; index >= 15 */
1024
+ static grpc_error *parse_lithdr_nvridx_x(grpc_exec_ctx *exec_ctx,
1025
+ grpc_chttp2_hpack_parser *p,
1026
+ const uint8_t *cur,
1027
+ const uint8_t *end) {
1028
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
1029
+ parse_string_prefix, parse_value_string_with_indexed_key,
1030
+ finish_lithdr_nvridx};
1031
+ p->dynamic_table_update_allowed = 0;
1032
+ p->next_state = and_then;
1033
+ p->index = 0xf;
1034
+ p->parsing.value = &p->index;
1035
+ return parse_value0(exec_ctx, p, cur + 1, end);
1036
+ }
1037
+
1038
+ /* parse a literal header that is never indexed; index == 0 */
1039
+ static grpc_error *parse_lithdr_nvridx_v(grpc_exec_ctx *exec_ctx,
1040
+ grpc_chttp2_hpack_parser *p,
1041
+ const uint8_t *cur,
1042
+ const uint8_t *end) {
1043
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
1044
+ parse_key_string, parse_string_prefix,
1045
+ parse_value_string_with_literal_key, finish_lithdr_nvridx_v};
1046
+ p->dynamic_table_update_allowed = 0;
1047
+ p->next_state = and_then;
1048
+ return parse_string_prefix(exec_ctx, p, cur + 1, end);
1049
+ }
1050
+
1051
+ /* finish parsing a max table size change */
1052
+ static grpc_error *finish_max_tbl_size(grpc_exec_ctx *exec_ctx,
1053
+ grpc_chttp2_hpack_parser *p,
1054
+ const uint8_t *cur, const uint8_t *end) {
1055
+ if (grpc_http_trace) {
1056
+ gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
1057
+ }
1058
+ grpc_error *err =
1059
+ grpc_chttp2_hptbl_set_current_table_size(exec_ctx, &p->table, p->index);
1060
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1061
+ return parse_begin(exec_ctx, p, cur, end);
1062
+ }
1063
+
1064
+ /* parse a max table size change, max size < 15 */
1065
+ static grpc_error *parse_max_tbl_size(grpc_exec_ctx *exec_ctx,
1066
+ grpc_chttp2_hpack_parser *p,
1067
+ const uint8_t *cur, const uint8_t *end) {
1068
+ if (p->dynamic_table_update_allowed == 0) {
1069
+ return parse_error(
1070
+ exec_ctx, p, cur, end,
1071
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1072
+ "More than two max table size changes in a single frame"));
1073
+ }
1074
+ p->dynamic_table_update_allowed--;
1075
+ p->index = (*cur) & 0x1f;
1076
+ return finish_max_tbl_size(exec_ctx, p, cur + 1, end);
1077
+ }
1078
+
1079
+ /* parse a max table size change, max size >= 15 */
1080
+ static grpc_error *parse_max_tbl_size_x(grpc_exec_ctx *exec_ctx,
1081
+ grpc_chttp2_hpack_parser *p,
1082
+ const uint8_t *cur,
1083
+ const uint8_t *end) {
1084
+ static const grpc_chttp2_hpack_parser_state and_then[] = {
1085
+ finish_max_tbl_size};
1086
+ if (p->dynamic_table_update_allowed == 0) {
1087
+ return parse_error(
1088
+ exec_ctx, p, cur, end,
1089
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1090
+ "More than two max table size changes in a single frame"));
1091
+ }
1092
+ p->dynamic_table_update_allowed--;
1093
+ p->next_state = and_then;
1094
+ p->index = 0x1f;
1095
+ p->parsing.value = &p->index;
1096
+ return parse_value0(exec_ctx, p, cur + 1, end);
1097
+ }
1098
+
1099
+ /* a parse error: jam the parse state into parse_error, and return error */
1100
+ static grpc_error *parse_error(grpc_exec_ctx *exec_ctx,
1101
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1102
+ const uint8_t *end, grpc_error *err) {
1103
+ GPR_ASSERT(err != GRPC_ERROR_NONE);
1104
+ if (p->last_error == GRPC_ERROR_NONE) {
1105
+ p->last_error = GRPC_ERROR_REF(err);
1106
+ }
1107
+ p->state = still_parse_error;
1108
+ return err;
1109
+ }
1110
+
1111
+ static grpc_error *still_parse_error(grpc_exec_ctx *exec_ctx,
1112
+ grpc_chttp2_hpack_parser *p,
1113
+ const uint8_t *cur, const uint8_t *end) {
1114
+ return GRPC_ERROR_REF(p->last_error);
1115
+ }
1116
+
1117
+ static grpc_error *parse_illegal_op(grpc_exec_ctx *exec_ctx,
1118
+ grpc_chttp2_hpack_parser *p,
1119
+ const uint8_t *cur, const uint8_t *end) {
1120
+ GPR_ASSERT(cur != end);
1121
+ char *msg;
1122
+ gpr_asprintf(&msg, "Illegal hpack op code %d", *cur);
1123
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
1124
+ gpr_free(msg);
1125
+ return parse_error(exec_ctx, p, cur, end, err);
1126
+ }
1127
+
1128
+ /* parse the 1st byte of a varint into p->parsing.value
1129
+ no overflow is possible */
1130
+ static grpc_error *parse_value0(grpc_exec_ctx *exec_ctx,
1131
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1132
+ const uint8_t *end) {
1133
+ if (cur == end) {
1134
+ p->state = parse_value0;
1135
+ return GRPC_ERROR_NONE;
1136
+ }
1137
+
1138
+ *p->parsing.value += (*cur) & 0x7f;
1139
+
1140
+ if ((*cur) & 0x80) {
1141
+ return parse_value1(exec_ctx, p, cur + 1, end);
1142
+ } else {
1143
+ return parse_next(exec_ctx, p, cur + 1, end);
1144
+ }
1145
+ }
1146
+
1147
+ /* parse the 2nd byte of a varint into p->parsing.value
1148
+ no overflow is possible */
1149
+ static grpc_error *parse_value1(grpc_exec_ctx *exec_ctx,
1150
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1151
+ const uint8_t *end) {
1152
+ if (cur == end) {
1153
+ p->state = parse_value1;
1154
+ return GRPC_ERROR_NONE;
1155
+ }
1156
+
1157
+ *p->parsing.value += (((uint32_t)*cur) & 0x7f) << 7;
1158
+
1159
+ if ((*cur) & 0x80) {
1160
+ return parse_value2(exec_ctx, p, cur + 1, end);
1161
+ } else {
1162
+ return parse_next(exec_ctx, p, cur + 1, end);
1163
+ }
1164
+ }
1165
+
1166
+ /* parse the 3rd byte of a varint into p->parsing.value
1167
+ no overflow is possible */
1168
+ static grpc_error *parse_value2(grpc_exec_ctx *exec_ctx,
1169
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1170
+ const uint8_t *end) {
1171
+ if (cur == end) {
1172
+ p->state = parse_value2;
1173
+ return GRPC_ERROR_NONE;
1174
+ }
1175
+
1176
+ *p->parsing.value += (((uint32_t)*cur) & 0x7f) << 14;
1177
+
1178
+ if ((*cur) & 0x80) {
1179
+ return parse_value3(exec_ctx, p, cur + 1, end);
1180
+ } else {
1181
+ return parse_next(exec_ctx, p, cur + 1, end);
1182
+ }
1183
+ }
1184
+
1185
+ /* parse the 4th byte of a varint into p->parsing.value
1186
+ no overflow is possible */
1187
+ static grpc_error *parse_value3(grpc_exec_ctx *exec_ctx,
1188
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1189
+ const uint8_t *end) {
1190
+ if (cur == end) {
1191
+ p->state = parse_value3;
1192
+ return GRPC_ERROR_NONE;
1193
+ }
1194
+
1195
+ *p->parsing.value += (((uint32_t)*cur) & 0x7f) << 21;
1196
+
1197
+ if ((*cur) & 0x80) {
1198
+ return parse_value4(exec_ctx, p, cur + 1, end);
1199
+ } else {
1200
+ return parse_next(exec_ctx, p, cur + 1, end);
1201
+ }
1202
+ }
1203
+
1204
+ /* parse the 5th byte of a varint into p->parsing.value
1205
+ depending on the byte, we may overflow, and care must be taken */
1206
+ static grpc_error *parse_value4(grpc_exec_ctx *exec_ctx,
1207
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1208
+ const uint8_t *end) {
1209
+ uint8_t c;
1210
+ uint32_t cur_value;
1211
+ uint32_t add_value;
1212
+ char *msg;
1213
+
1214
+ if (cur == end) {
1215
+ p->state = parse_value4;
1216
+ return GRPC_ERROR_NONE;
1217
+ }
1218
+
1219
+ c = (*cur) & 0x7f;
1220
+ if (c > 0xf) {
1221
+ goto error;
1222
+ }
1223
+
1224
+ cur_value = *p->parsing.value;
1225
+ add_value = ((uint32_t)c) << 28;
1226
+ if (add_value > 0xffffffffu - cur_value) {
1227
+ goto error;
1228
+ }
1229
+
1230
+ *p->parsing.value = cur_value + add_value;
1231
+
1232
+ if ((*cur) & 0x80) {
1233
+ return parse_value5up(exec_ctx, p, cur + 1, end);
1234
+ } else {
1235
+ return parse_next(exec_ctx, p, cur + 1, end);
1236
+ }
1237
+
1238
+ error:
1239
+ gpr_asprintf(&msg,
1240
+ "integer overflow in hpack integer decoding: have 0x%08x, "
1241
+ "got byte 0x%02x on byte 5",
1242
+ *p->parsing.value, *cur);
1243
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
1244
+ gpr_free(msg);
1245
+ return parse_error(exec_ctx, p, cur, end, err);
1246
+ }
1247
+
1248
+ /* parse any trailing bytes in a varint: it's possible to append an arbitrary
1249
+ number of 0x80's and not affect the value - a zero will terminate - and
1250
+ anything else will overflow */
1251
+ static grpc_error *parse_value5up(grpc_exec_ctx *exec_ctx,
1252
+ grpc_chttp2_hpack_parser *p,
1253
+ const uint8_t *cur, const uint8_t *end) {
1254
+ while (cur != end && *cur == 0x80) {
1255
+ ++cur;
1256
+ }
1257
+
1258
+ if (cur == end) {
1259
+ p->state = parse_value5up;
1260
+ return GRPC_ERROR_NONE;
1261
+ }
1262
+
1263
+ if (*cur == 0) {
1264
+ return parse_next(exec_ctx, p, cur + 1, end);
1265
+ }
1266
+
1267
+ char *msg;
1268
+ gpr_asprintf(&msg,
1269
+ "integer overflow in hpack integer decoding: have 0x%08x, "
1270
+ "got byte 0x%02x sometime after byte 5",
1271
+ *p->parsing.value, *cur);
1272
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
1273
+ gpr_free(msg);
1274
+ return parse_error(exec_ctx, p, cur, end, err);
1275
+ }
1276
+
1277
+ /* parse a string prefix */
1278
+ static grpc_error *parse_string_prefix(grpc_exec_ctx *exec_ctx,
1279
+ grpc_chttp2_hpack_parser *p,
1280
+ const uint8_t *cur, const uint8_t *end) {
1281
+ if (cur == end) {
1282
+ p->state = parse_string_prefix;
1283
+ return GRPC_ERROR_NONE;
1284
+ }
1285
+
1286
+ p->strlen = (*cur) & 0x7f;
1287
+ p->huff = (*cur) >> 7;
1288
+ if (p->strlen == 0x7f) {
1289
+ p->parsing.value = &p->strlen;
1290
+ return parse_value0(exec_ctx, p, cur + 1, end);
1291
+ } else {
1292
+ return parse_next(exec_ctx, p, cur + 1, end);
1293
+ }
1294
+ }
1295
+
1296
+ /* append some bytes to a string */
1297
+ static void append_bytes(grpc_chttp2_hpack_parser_string *str,
1298
+ const uint8_t *data, size_t length) {
1299
+ if (length == 0) return;
1300
+ if (length + str->data.copied.length > str->data.copied.capacity) {
1301
+ GPR_ASSERT(str->data.copied.length + length <= UINT32_MAX);
1302
+ str->data.copied.capacity = (uint32_t)(str->data.copied.length + length);
1303
+ str->data.copied.str =
1304
+ gpr_realloc(str->data.copied.str, str->data.copied.capacity);
1305
+ }
1306
+ memcpy(str->data.copied.str + str->data.copied.length, data, length);
1307
+ GPR_ASSERT(length <= UINT32_MAX - str->data.copied.length);
1308
+ str->data.copied.length += (uint32_t)length;
1309
+ }
1310
+
1311
+ static grpc_error *append_string(grpc_exec_ctx *exec_ctx,
1312
+ grpc_chttp2_hpack_parser *p,
1313
+ const uint8_t *cur, const uint8_t *end) {
1314
+ grpc_chttp2_hpack_parser_string *str = p->parsing.str;
1315
+ uint32_t bits;
1316
+ uint8_t decoded[3];
1317
+ switch ((binary_state)p->binary) {
1318
+ case NOT_BINARY:
1319
+ append_bytes(str, cur, (size_t)(end - cur));
1320
+ return GRPC_ERROR_NONE;
1321
+ case BINARY_BEGIN:
1322
+ if (cur == end) {
1323
+ p->binary = BINARY_BEGIN;
1324
+ return GRPC_ERROR_NONE;
1325
+ }
1326
+ if (*cur == 0) {
1327
+ /* 'true-binary' case */
1328
+ ++cur;
1329
+ p->binary = NOT_BINARY;
1330
+ append_bytes(str, cur, (size_t)(end - cur));
1331
+ return GRPC_ERROR_NONE;
1332
+ }
1333
+ /* fallthrough */
1334
+ b64_byte0:
1335
+ case B64_BYTE0:
1336
+ if (cur == end) {
1337
+ p->binary = B64_BYTE0;
1338
+ return GRPC_ERROR_NONE;
1339
+ }
1340
+ bits = inverse_base64[*cur];
1341
+ ++cur;
1342
+ if (bits == 255)
1343
+ return parse_error(
1344
+ exec_ctx, p, cur, end,
1345
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
1346
+ else if (bits == 64)
1347
+ goto b64_byte0;
1348
+ p->base64_buffer = bits << 18;
1349
+ /* fallthrough */
1350
+ b64_byte1:
1351
+ case B64_BYTE1:
1352
+ if (cur == end) {
1353
+ p->binary = B64_BYTE1;
1354
+ return GRPC_ERROR_NONE;
1355
+ }
1356
+ bits = inverse_base64[*cur];
1357
+ ++cur;
1358
+ if (bits == 255)
1359
+ return parse_error(
1360
+ exec_ctx, p, cur, end,
1361
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
1362
+ else if (bits == 64)
1363
+ goto b64_byte1;
1364
+ p->base64_buffer |= bits << 12;
1365
+ /* fallthrough */
1366
+ b64_byte2:
1367
+ case B64_BYTE2:
1368
+ if (cur == end) {
1369
+ p->binary = B64_BYTE2;
1370
+ return GRPC_ERROR_NONE;
1371
+ }
1372
+ bits = inverse_base64[*cur];
1373
+ ++cur;
1374
+ if (bits == 255)
1375
+ return parse_error(
1376
+ exec_ctx, p, cur, end,
1377
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
1378
+ else if (bits == 64)
1379
+ goto b64_byte2;
1380
+ p->base64_buffer |= bits << 6;
1381
+ /* fallthrough */
1382
+ b64_byte3:
1383
+ case B64_BYTE3:
1384
+ if (cur == end) {
1385
+ p->binary = B64_BYTE3;
1386
+ return GRPC_ERROR_NONE;
1387
+ }
1388
+ bits = inverse_base64[*cur];
1389
+ ++cur;
1390
+ if (bits == 255)
1391
+ return parse_error(
1392
+ exec_ctx, p, cur, end,
1393
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
1394
+ else if (bits == 64)
1395
+ goto b64_byte3;
1396
+ p->base64_buffer |= bits;
1397
+ bits = p->base64_buffer;
1398
+ decoded[0] = (uint8_t)(bits >> 16);
1399
+ decoded[1] = (uint8_t)(bits >> 8);
1400
+ decoded[2] = (uint8_t)(bits);
1401
+ append_bytes(str, decoded, 3);
1402
+ goto b64_byte0;
1403
+ }
1404
+ GPR_UNREACHABLE_CODE(return parse_error(
1405
+ exec_ctx, p, cur, end,
1406
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here")));
1407
+ }
1408
+
1409
+ static grpc_error *finish_str(grpc_exec_ctx *exec_ctx,
1410
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1411
+ const uint8_t *end) {
1412
+ uint8_t decoded[2];
1413
+ uint32_t bits;
1414
+ grpc_chttp2_hpack_parser_string *str = p->parsing.str;
1415
+ switch ((binary_state)p->binary) {
1416
+ case NOT_BINARY:
1417
+ break;
1418
+ case BINARY_BEGIN:
1419
+ break;
1420
+ case B64_BYTE0:
1421
+ break;
1422
+ case B64_BYTE1:
1423
+ return parse_error(exec_ctx, p, cur, end,
1424
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1425
+ "illegal base64 encoding")); /* illegal encoding */
1426
+ case B64_BYTE2:
1427
+ bits = p->base64_buffer;
1428
+ if (bits & 0xffff) {
1429
+ char *msg;
1430
+ gpr_asprintf(&msg, "trailing bits in base64 encoding: 0x%04x",
1431
+ bits & 0xffff);
1432
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
1433
+ gpr_free(msg);
1434
+ return parse_error(exec_ctx, p, cur, end, err);
1435
+ }
1436
+ decoded[0] = (uint8_t)(bits >> 16);
1437
+ append_bytes(str, decoded, 1);
1438
+ break;
1439
+ case B64_BYTE3:
1440
+ bits = p->base64_buffer;
1441
+ if (bits & 0xff) {
1442
+ char *msg;
1443
+ gpr_asprintf(&msg, "trailing bits in base64 encoding: 0x%02x",
1444
+ bits & 0xff);
1445
+ grpc_error *err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
1446
+ gpr_free(msg);
1447
+ return parse_error(exec_ctx, p, cur, end, err);
1448
+ }
1449
+ decoded[0] = (uint8_t)(bits >> 16);
1450
+ decoded[1] = (uint8_t)(bits >> 8);
1451
+ append_bytes(str, decoded, 2);
1452
+ break;
1453
+ }
1454
+ return GRPC_ERROR_NONE;
1455
+ }
1456
+
1457
+ /* decode a nibble from a huffman encoded stream */
1458
+ static grpc_error *huff_nibble(grpc_exec_ctx *exec_ctx,
1459
+ grpc_chttp2_hpack_parser *p, uint8_t nibble) {
1460
+ int16_t emit = emit_sub_tbl[16 * emit_tbl[p->huff_state] + nibble];
1461
+ int16_t next = next_sub_tbl[16 * next_tbl[p->huff_state] + nibble];
1462
+ if (emit != -1) {
1463
+ if (emit >= 0 && emit < 256) {
1464
+ uint8_t c = (uint8_t)emit;
1465
+ grpc_error *err = append_string(exec_ctx, p, &c, (&c) + 1);
1466
+ if (err != GRPC_ERROR_NONE) return err;
1467
+ } else {
1468
+ assert(emit == 256);
1469
+ }
1470
+ }
1471
+ p->huff_state = next;
1472
+ return GRPC_ERROR_NONE;
1473
+ }
1474
+
1475
+ /* decode full bytes from a huffman encoded stream */
1476
+ static grpc_error *add_huff_bytes(grpc_exec_ctx *exec_ctx,
1477
+ grpc_chttp2_hpack_parser *p,
1478
+ const uint8_t *cur, const uint8_t *end) {
1479
+ for (; cur != end; ++cur) {
1480
+ grpc_error *err = huff_nibble(exec_ctx, p, *cur >> 4);
1481
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1482
+ err = huff_nibble(exec_ctx, p, *cur & 0xf);
1483
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1484
+ }
1485
+ return GRPC_ERROR_NONE;
1486
+ }
1487
+
1488
+ /* decode some string bytes based on the current decoding mode
1489
+ (huffman or not) */
1490
+ static grpc_error *add_str_bytes(grpc_exec_ctx *exec_ctx,
1491
+ grpc_chttp2_hpack_parser *p,
1492
+ const uint8_t *cur, const uint8_t *end) {
1493
+ if (p->huff) {
1494
+ return add_huff_bytes(exec_ctx, p, cur, end);
1495
+ } else {
1496
+ return append_string(exec_ctx, p, cur, end);
1497
+ }
1498
+ }
1499
+
1500
+ /* parse a string - tries to do large chunks at a time */
1501
+ static grpc_error *parse_string(grpc_exec_ctx *exec_ctx,
1502
+ grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1503
+ const uint8_t *end) {
1504
+ size_t remaining = p->strlen - p->strgot;
1505
+ size_t given = (size_t)(end - cur);
1506
+ if (remaining <= given) {
1507
+ grpc_error *err = add_str_bytes(exec_ctx, p, cur, cur + remaining);
1508
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1509
+ err = finish_str(exec_ctx, p, cur + remaining, end);
1510
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1511
+ return parse_next(exec_ctx, p, cur + remaining, end);
1512
+ } else {
1513
+ grpc_error *err = add_str_bytes(exec_ctx, p, cur, cur + given);
1514
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1515
+ GPR_ASSERT(given <= UINT32_MAX - p->strgot);
1516
+ p->strgot += (uint32_t)given;
1517
+ p->state = parse_string;
1518
+ return GRPC_ERROR_NONE;
1519
+ }
1520
+ }
1521
+
1522
+ /* begin parsing a string - performs setup, calls parse_string */
1523
+ static grpc_error *begin_parse_string(grpc_exec_ctx *exec_ctx,
1524
+ grpc_chttp2_hpack_parser *p,
1525
+ const uint8_t *cur, const uint8_t *end,
1526
+ uint8_t binary,
1527
+ grpc_chttp2_hpack_parser_string *str) {
1528
+ if (!p->huff && binary == NOT_BINARY && (end - cur) >= (intptr_t)p->strlen &&
1529
+ p->current_slice_refcount != NULL) {
1530
+ str->copied = false;
1531
+ str->data.referenced.refcount = p->current_slice_refcount;
1532
+ str->data.referenced.data.refcounted.bytes = (uint8_t *)cur;
1533
+ str->data.referenced.data.refcounted.length = p->strlen;
1534
+ grpc_slice_ref_internal(str->data.referenced);
1535
+ return parse_next(exec_ctx, p, cur + p->strlen, end);
1536
+ }
1537
+ p->strgot = 0;
1538
+ str->copied = true;
1539
+ str->data.copied.length = 0;
1540
+ p->parsing.str = str;
1541
+ p->huff_state = 0;
1542
+ p->binary = binary;
1543
+ return parse_string(exec_ctx, p, cur, end);
1544
+ }
1545
+
1546
+ /* parse the key string */
1547
+ static grpc_error *parse_key_string(grpc_exec_ctx *exec_ctx,
1548
+ grpc_chttp2_hpack_parser *p,
1549
+ const uint8_t *cur, const uint8_t *end) {
1550
+ return begin_parse_string(exec_ctx, p, cur, end, NOT_BINARY, &p->key);
1551
+ }
1552
+
1553
+ /* check if a key represents a binary header or not */
1554
+
1555
+ static bool is_binary_literal_header(grpc_chttp2_hpack_parser *p) {
1556
+ return grpc_is_binary_header(
1557
+ p->key.copied ? grpc_slice_from_static_buffer(p->key.data.copied.str,
1558
+ p->key.data.copied.length)
1559
+ : p->key.data.referenced);
1560
+ }
1561
+
1562
+ static grpc_error *is_binary_indexed_header(grpc_chttp2_hpack_parser *p,
1563
+ bool *is) {
1564
+ grpc_mdelem elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
1565
+ if (GRPC_MDISNULL(elem)) {
1566
+ return grpc_error_set_int(
1567
+ grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1568
+ "Invalid HPACK index received"),
1569
+ GRPC_ERROR_INT_INDEX, (intptr_t)p->index),
1570
+ GRPC_ERROR_INT_SIZE, (intptr_t)p->table.num_ents);
1571
+ }
1572
+ *is = grpc_is_binary_header(GRPC_MDKEY(elem));
1573
+ return GRPC_ERROR_NONE;
1574
+ }
1575
+
1576
+ /* parse the value string */
1577
+ static grpc_error *parse_value_string(grpc_exec_ctx *exec_ctx,
1578
+ grpc_chttp2_hpack_parser *p,
1579
+ const uint8_t *cur, const uint8_t *end,
1580
+ bool is_binary) {
1581
+ return begin_parse_string(exec_ctx, p, cur, end,
1582
+ is_binary ? BINARY_BEGIN : NOT_BINARY, &p->value);
1583
+ }
1584
+
1585
+ static grpc_error *parse_value_string_with_indexed_key(
1586
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1587
+ const uint8_t *end) {
1588
+ bool is_binary = false;
1589
+ grpc_error *err = is_binary_indexed_header(p, &is_binary);
1590
+ if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
1591
+ return parse_value_string(exec_ctx, p, cur, end, is_binary);
1592
+ }
1593
+
1594
+ static grpc_error *parse_value_string_with_literal_key(
1595
+ grpc_exec_ctx *exec_ctx, grpc_chttp2_hpack_parser *p, const uint8_t *cur,
1596
+ const uint8_t *end) {
1597
+ return parse_value_string(exec_ctx, p, cur, end, is_binary_literal_header(p));
1598
+ }
1599
+
1600
+ /* PUBLIC INTERFACE */
1601
+
1602
+ void grpc_chttp2_hpack_parser_init(grpc_exec_ctx *exec_ctx,
1603
+ grpc_chttp2_hpack_parser *p) {
1604
+ p->on_header = NULL;
1605
+ p->on_header_user_data = NULL;
1606
+ p->state = parse_begin;
1607
+ p->key.data.referenced = grpc_empty_slice();
1608
+ p->key.data.copied.str = NULL;
1609
+ p->key.data.copied.capacity = 0;
1610
+ p->key.data.copied.length = 0;
1611
+ p->value.data.referenced = grpc_empty_slice();
1612
+ p->value.data.copied.str = NULL;
1613
+ p->value.data.copied.capacity = 0;
1614
+ p->value.data.copied.length = 0;
1615
+ p->dynamic_table_update_allowed = 2;
1616
+ p->last_error = GRPC_ERROR_NONE;
1617
+ grpc_chttp2_hptbl_init(exec_ctx, &p->table);
1618
+ }
1619
+
1620
+ void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser *p) {
1621
+ p->after_prioritization = p->state;
1622
+ p->state = parse_stream_dep0;
1623
+ }
1624
+
1625
+ void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx *exec_ctx,
1626
+ grpc_chttp2_hpack_parser *p) {
1627
+ grpc_chttp2_hptbl_destroy(exec_ctx, &p->table);
1628
+ GRPC_ERROR_UNREF(p->last_error);
1629
+ grpc_slice_unref_internal(exec_ctx, p->key.data.referenced);
1630
+ grpc_slice_unref_internal(exec_ctx, p->value.data.referenced);
1631
+ gpr_free(p->key.data.copied.str);
1632
+ gpr_free(p->value.data.copied.str);
1633
+ }
1634
+
1635
+ grpc_error *grpc_chttp2_hpack_parser_parse(grpc_exec_ctx *exec_ctx,
1636
+ grpc_chttp2_hpack_parser *p,
1637
+ grpc_slice slice) {
1638
+ /* max number of bytes to parse at a time... limits call stack depth on
1639
+ * compilers without TCO */
1640
+ #define MAX_PARSE_LENGTH 1024
1641
+ p->current_slice_refcount = slice.refcount;
1642
+ uint8_t *start = GRPC_SLICE_START_PTR(slice);
1643
+ uint8_t *end = GRPC_SLICE_END_PTR(slice);
1644
+ grpc_error *error = GRPC_ERROR_NONE;
1645
+ while (start != end && error == GRPC_ERROR_NONE) {
1646
+ uint8_t *target = start + GPR_MIN(MAX_PARSE_LENGTH, end - start);
1647
+ error = p->state(exec_ctx, p, start, target);
1648
+ start = target;
1649
+ }
1650
+ p->current_slice_refcount = NULL;
1651
+ return error;
1652
+ }
1653
+
1654
+ typedef void (*maybe_complete_func_type)(grpc_exec_ctx *exec_ctx,
1655
+ grpc_chttp2_transport *t,
1656
+ grpc_chttp2_stream *s);
1657
+ static const maybe_complete_func_type maybe_complete_funcs[] = {
1658
+ grpc_chttp2_maybe_complete_recv_initial_metadata,
1659
+ grpc_chttp2_maybe_complete_recv_trailing_metadata};
1660
+
1661
+ static void force_client_rst_stream(grpc_exec_ctx *exec_ctx, void *sp,
1662
+ grpc_error *error) {
1663
+ grpc_chttp2_stream *s = sp;
1664
+ grpc_chttp2_transport *t = s->t;
1665
+ if (!s->write_closed) {
1666
+ grpc_slice_buffer_add(
1667
+ &t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
1668
+ &s->stats.outgoing));
1669
+ grpc_chttp2_initiate_write(exec_ctx, t, false, "force_rst_stream");
1670
+ grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, true, GRPC_ERROR_NONE);
1671
+ }
1672
+ GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "final_rst");
1673
+ }
1674
+
1675
+ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
1676
+ void *hpack_parser,
1677
+ grpc_chttp2_transport *t,
1678
+ grpc_chttp2_stream *s,
1679
+ grpc_slice slice, int is_last) {
1680
+ grpc_chttp2_hpack_parser *parser = hpack_parser;
1681
+ GPR_TIMER_BEGIN("grpc_chttp2_hpack_parser_parse", 0);
1682
+ if (s != NULL) {
1683
+ s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
1684
+ }
1685
+ grpc_error *error = grpc_chttp2_hpack_parser_parse(exec_ctx, parser, slice);
1686
+ if (error != GRPC_ERROR_NONE) {
1687
+ GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
1688
+ return error;
1689
+ }
1690
+ if (is_last) {
1691
+ if (parser->is_boundary && parser->state != parse_begin) {
1692
+ GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
1693
+ return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1694
+ "end of header frame not aligned with a hpack record boundary");
1695
+ }
1696
+ /* need to check for null stream: this can occur if we receive an invalid
1697
+ stream id on a header */
1698
+ if (s != NULL) {
1699
+ if (parser->is_boundary) {
1700
+ if (s->header_frames_received == GPR_ARRAY_SIZE(s->metadata_buffer)) {
1701
+ return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
1702
+ "Too many trailer frames");
1703
+ }
1704
+ s->published_metadata[s->header_frames_received] =
1705
+ GRPC_METADATA_PUBLISHED_FROM_WIRE;
1706
+ maybe_complete_funcs[s->header_frames_received](exec_ctx, t, s);
1707
+ s->header_frames_received++;
1708
+ }
1709
+ if (parser->is_eof) {
1710
+ if (t->is_client && !s->write_closed) {
1711
+ /* server eof ==> complete closure; we may need to forcefully close
1712
+ the stream. Wait until the combiner lock is ready to be released
1713
+ however -- it might be that we receive a RST_STREAM following this
1714
+ and can avoid the extra write */
1715
+ GRPC_CHTTP2_STREAM_REF(s, "final_rst");
1716
+ grpc_closure_sched(
1717
+ exec_ctx, grpc_closure_create(force_client_rst_stream, s,
1718
+ grpc_combiner_finally_scheduler(
1719
+ t->combiner, false)),
1720
+ GRPC_ERROR_NONE);
1721
+ }
1722
+ grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false,
1723
+ GRPC_ERROR_NONE);
1724
+ }
1725
+ }
1726
+ parser->on_header = NULL;
1727
+ parser->on_header_user_data = NULL;
1728
+ parser->is_boundary = 0xde;
1729
+ parser->is_eof = 0xde;
1730
+ parser->dynamic_table_update_allowed = 2;
1731
+ }
1732
+ GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
1733
+ return GRPC_ERROR_NONE;
1734
+ }