couchbase 1.3.15 → 3.0.0.alpha.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1498) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/tests-6.0.3.yml +52 -0
  3. data/.github/workflows/tests-dev-preview.yml +55 -0
  4. data/.github/workflows/tests.yml +50 -0
  5. data/.gitignore +17 -12
  6. data/.gitmodules +21 -0
  7. data/.idea/.gitignore +5 -0
  8. data/.idea/dictionaries/gem_terms.xml +18 -0
  9. data/.idea/inspectionProfiles/Project_Default.xml +8 -0
  10. data/.idea/vcs.xml +13 -0
  11. data/.yardopts +1 -5
  12. data/Gemfile +22 -2
  13. data/LICENSE.txt +202 -0
  14. data/README.md +60 -0
  15. data/Rakefile +46 -15
  16. data/bin/check-cluster +31 -0
  17. data/bin/console +21 -0
  18. data/bin/fetch-stats +19 -0
  19. data/bin/init-cluster +82 -0
  20. data/bin/jenkins/build-extension +35 -0
  21. data/bin/jenkins/install-dependencies +47 -0
  22. data/bin/jenkins/test-with-cbdyncluster +58 -0
  23. data/bin/setup +24 -0
  24. data/couchbase.gemspec +64 -41
  25. data/examples/analytics.rb +221 -0
  26. data/examples/crud.rb +20 -0
  27. data/examples/managing_analytics_indexes.rb +72 -0
  28. data/examples/managing_buckets.rb +47 -0
  29. data/examples/managing_collections.rb +58 -0
  30. data/examples/managing_query_indexes.rb +63 -0
  31. data/examples/managing_search_indexes.rb +62 -0
  32. data/examples/managing_view_indexes.rb +54 -0
  33. data/examples/query.rb +18 -0
  34. data/examples/query_with_consistency.rb +76 -0
  35. data/examples/search.rb +187 -0
  36. data/examples/search_with_consistency.rb +84 -0
  37. data/examples/subdocument.rb +51 -0
  38. data/examples/view.rb +50 -0
  39. data/ext/.clang-format +15 -0
  40. data/ext/.clang-tidy +22 -0
  41. data/ext/.cmake-format.yaml +8 -0
  42. data/ext/.gitignore +2 -0
  43. data/ext/.idea/.name +1 -0
  44. data/ext/.idea/dictionaries/couchbase_terms.xml +14 -0
  45. data/ext/.idea/ext.iml +2 -0
  46. data/ext/.idea/misc.xml +4 -0
  47. data/ext/.idea/modules.xml +8 -0
  48. data/ext/.idea/vcs.xml +12 -0
  49. data/ext/CMakeLists.txt +163 -0
  50. data/ext/LICENSE.txt +202 -0
  51. data/ext/build_version.hxx.in +26 -0
  52. data/ext/couchbase/bucket.hxx +95 -0
  53. data/ext/couchbase/cbcrypto/cbcrypto.cc +888 -0
  54. data/ext/couchbase/cbcrypto/cbcrypto.h +89 -0
  55. data/ext/couchbase/cbsasl/client.cc +48 -0
  56. data/ext/couchbase/cbsasl/client.h +127 -0
  57. data/ext/couchbase/cbsasl/context.cc +33 -0
  58. data/ext/couchbase/cbsasl/context.h +52 -0
  59. data/ext/couchbase/cbsasl/error.h +72 -0
  60. data/ext/couchbase/cbsasl/mechanism.cc +48 -0
  61. data/ext/couchbase/cbsasl/mechanism.h +55 -0
  62. data/ext/couchbase/cbsasl/plain/plain.cc +36 -0
  63. data/ext/couchbase/cbsasl/plain/plain.h +53 -0
  64. data/ext/couchbase/cbsasl/scram-sha/scram-sha.cc +390 -0
  65. data/ext/couchbase/cbsasl/scram-sha/scram-sha.h +185 -0
  66. data/ext/couchbase/cbsasl/scram-sha/stringutils.cc +81 -0
  67. data/ext/couchbase/cbsasl/scram-sha/stringutils.h +48 -0
  68. data/ext/couchbase/cluster.hxx +176 -0
  69. data/ext/couchbase/collections_manifest.hxx +88 -0
  70. data/ext/couchbase/configuration.hxx +256 -0
  71. data/ext/couchbase/configuration_monitor.hxx +93 -0
  72. data/ext/couchbase/couchbase.cxx +5449 -0
  73. data/ext/couchbase/document_id.hxx +38 -0
  74. data/ext/couchbase/error_map.hxx +61 -0
  75. data/ext/couchbase/errors.hxx +691 -0
  76. data/ext/couchbase/io/dns_client.hxx +215 -0
  77. data/ext/couchbase/io/dns_codec.hxx +207 -0
  78. data/ext/couchbase/io/dns_config.hxx +116 -0
  79. data/ext/couchbase/io/dns_message.hxx +555 -0
  80. data/ext/couchbase/io/http_message.hxx +38 -0
  81. data/ext/couchbase/io/http_parser.hxx +174 -0
  82. data/ext/couchbase/io/http_session.hxx +321 -0
  83. data/ext/couchbase/io/http_session_manager.hxx +127 -0
  84. data/ext/couchbase/io/mcbp_message.hxx +58 -0
  85. data/ext/couchbase/io/mcbp_parser.hxx +101 -0
  86. data/ext/couchbase/io/mcbp_session.hxx +931 -0
  87. data/ext/couchbase/mutation_token.hxx +38 -0
  88. data/ext/couchbase/operations.hxx +91 -0
  89. data/ext/couchbase/operations/analytics_dataset_create.hxx +117 -0
  90. data/ext/couchbase/operations/analytics_dataset_drop.hxx +103 -0
  91. data/ext/couchbase/operations/analytics_dataset_get_all.hxx +107 -0
  92. data/ext/couchbase/operations/analytics_dataverse_create.hxx +104 -0
  93. data/ext/couchbase/operations/analytics_dataverse_drop.hxx +104 -0
  94. data/ext/couchbase/operations/analytics_get_pending_mutations.hxx +91 -0
  95. data/ext/couchbase/operations/analytics_index_create.hxx +128 -0
  96. data/ext/couchbase/operations/analytics_index_drop.hxx +110 -0
  97. data/ext/couchbase/operations/analytics_index_get_all.hxx +106 -0
  98. data/ext/couchbase/operations/analytics_link_connect.hxx +102 -0
  99. data/ext/couchbase/operations/analytics_link_disconnect.hxx +101 -0
  100. data/ext/couchbase/operations/bucket_create.hxx +139 -0
  101. data/ext/couchbase/operations/bucket_drop.hxx +66 -0
  102. data/ext/couchbase/operations/bucket_flush.hxx +66 -0
  103. data/ext/couchbase/operations/bucket_get.hxx +70 -0
  104. data/ext/couchbase/operations/bucket_get_all.hxx +63 -0
  105. data/ext/couchbase/operations/bucket_settings.hxx +111 -0
  106. data/ext/couchbase/operations/bucket_update.hxx +116 -0
  107. data/ext/couchbase/operations/cluster_developer_preview_enable.hxx +61 -0
  108. data/ext/couchbase/operations/collection_create.hxx +91 -0
  109. data/ext/couchbase/operations/collection_drop.hxx +83 -0
  110. data/ext/couchbase/operations/command.hxx +163 -0
  111. data/ext/couchbase/operations/design_document.hxx +59 -0
  112. data/ext/couchbase/operations/document_analytics.hxx +292 -0
  113. data/ext/couchbase/operations/document_decrement.hxx +82 -0
  114. data/ext/couchbase/operations/document_exists.hxx +82 -0
  115. data/ext/couchbase/operations/document_get.hxx +64 -0
  116. data/ext/couchbase/operations/document_get_and_lock.hxx +66 -0
  117. data/ext/couchbase/operations/document_get_and_touch.hxx +66 -0
  118. data/ext/couchbase/operations/document_get_projected.hxx +244 -0
  119. data/ext/couchbase/operations/document_increment.hxx +84 -0
  120. data/ext/couchbase/operations/document_insert.hxx +76 -0
  121. data/ext/couchbase/operations/document_lookup_in.hxx +106 -0
  122. data/ext/couchbase/operations/document_mutate_in.hxx +139 -0
  123. data/ext/couchbase/operations/document_query.hxx +335 -0
  124. data/ext/couchbase/operations/document_remove.hxx +69 -0
  125. data/ext/couchbase/operations/document_replace.hxx +78 -0
  126. data/ext/couchbase/operations/document_search.hxx +356 -0
  127. data/ext/couchbase/operations/document_touch.hxx +62 -0
  128. data/ext/couchbase/operations/document_unlock.hxx +62 -0
  129. data/ext/couchbase/operations/document_upsert.hxx +76 -0
  130. data/ext/couchbase/operations/document_view.hxx +228 -0
  131. data/ext/couchbase/operations/query_index_build_deferred.hxx +86 -0
  132. data/ext/couchbase/operations/query_index_create.hxx +135 -0
  133. data/ext/couchbase/operations/query_index_drop.hxx +109 -0
  134. data/ext/couchbase/operations/query_index_get_all.hxx +107 -0
  135. data/ext/couchbase/operations/scope_create.hxx +82 -0
  136. data/ext/couchbase/operations/scope_drop.hxx +80 -0
  137. data/ext/couchbase/operations/scope_get_all.hxx +74 -0
  138. data/ext/couchbase/operations/search_index.hxx +79 -0
  139. data/ext/couchbase/operations/search_index_analyze_document.hxx +92 -0
  140. data/ext/couchbase/operations/search_index_control_ingest.hxx +80 -0
  141. data/ext/couchbase/operations/search_index_control_plan_freeze.hxx +80 -0
  142. data/ext/couchbase/operations/search_index_control_query.hxx +80 -0
  143. data/ext/couchbase/operations/search_index_drop.hxx +77 -0
  144. data/ext/couchbase/operations/search_index_get.hxx +80 -0
  145. data/ext/couchbase/operations/search_index_get_all.hxx +82 -0
  146. data/ext/couchbase/operations/search_index_get_documents_count.hxx +81 -0
  147. data/ext/couchbase/operations/search_index_upsert.hxx +106 -0
  148. data/ext/couchbase/operations/view_index_drop.hxx +67 -0
  149. data/ext/couchbase/operations/view_index_get.hxx +90 -0
  150. data/ext/couchbase/operations/view_index_get_all.hxx +125 -0
  151. data/ext/couchbase/operations/view_index_upsert.hxx +87 -0
  152. data/ext/couchbase/platform/base64.cc +234 -0
  153. data/ext/couchbase/platform/base64.h +47 -0
  154. data/ext/couchbase/platform/random.cc +119 -0
  155. data/ext/couchbase/platform/random.h +39 -0
  156. data/ext/couchbase/platform/string_hex.cc +99 -0
  157. data/ext/couchbase/platform/string_hex.h +50 -0
  158. data/ext/couchbase/platform/uuid.cc +96 -0
  159. data/ext/couchbase/platform/uuid.h +56 -0
  160. data/ext/couchbase/protocol/client_opcode.hxx +264 -0
  161. data/ext/couchbase/protocol/client_request.hxx +160 -0
  162. data/ext/couchbase/protocol/client_response.hxx +218 -0
  163. data/ext/couchbase/protocol/cmd_cluster_map_change_notification.hxx +81 -0
  164. data/ext/couchbase/protocol/cmd_decrement.hxx +187 -0
  165. data/ext/couchbase/protocol/cmd_exists.hxx +171 -0
  166. data/ext/couchbase/protocol/cmd_get.hxx +122 -0
  167. data/ext/couchbase/protocol/cmd_get_and_lock.hxx +142 -0
  168. data/ext/couchbase/protocol/cmd_get_and_touch.hxx +142 -0
  169. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +124 -0
  170. data/ext/couchbase/protocol/cmd_get_collection_id.hxx +117 -0
  171. data/ext/couchbase/protocol/cmd_get_collections_manifest.hxx +99 -0
  172. data/ext/couchbase/protocol/cmd_get_error_map.hxx +126 -0
  173. data/ext/couchbase/protocol/cmd_hello.hxx +156 -0
  174. data/ext/couchbase/protocol/cmd_increment.hxx +187 -0
  175. data/ext/couchbase/protocol/cmd_info.hxx +36 -0
  176. data/ext/couchbase/protocol/cmd_insert.hxx +172 -0
  177. data/ext/couchbase/protocol/cmd_lookup_in.hxx +219 -0
  178. data/ext/couchbase/protocol/cmd_mutate_in.hxx +365 -0
  179. data/ext/couchbase/protocol/cmd_remove.hxx +134 -0
  180. data/ext/couchbase/protocol/cmd_replace.hxx +172 -0
  181. data/ext/couchbase/protocol/cmd_sasl_auth.hxx +106 -0
  182. data/ext/couchbase/protocol/cmd_sasl_list_mechs.hxx +100 -0
  183. data/ext/couchbase/protocol/cmd_sasl_step.hxx +104 -0
  184. data/ext/couchbase/protocol/cmd_select_bucket.hxx +85 -0
  185. data/ext/couchbase/protocol/cmd_touch.hxx +102 -0
  186. data/ext/couchbase/protocol/cmd_unlock.hxx +95 -0
  187. data/ext/couchbase/protocol/cmd_upsert.hxx +172 -0
  188. data/ext/couchbase/protocol/datatype.hxx +48 -0
  189. data/ext/couchbase/protocol/durability_level.hxx +67 -0
  190. data/ext/couchbase/protocol/frame_info_id.hxx +187 -0
  191. data/ext/couchbase/protocol/hello_feature.hxx +255 -0
  192. data/ext/couchbase/protocol/magic.hxx +83 -0
  193. data/ext/couchbase/protocol/server_opcode.hxx +57 -0
  194. data/ext/couchbase/protocol/server_request.hxx +122 -0
  195. data/ext/couchbase/protocol/status.hxx +333 -0
  196. data/ext/couchbase/protocol/unsigned_leb128.h +195 -0
  197. data/ext/couchbase/service_type.hxx +60 -0
  198. data/ext/couchbase/timeout_defaults.hxx +34 -0
  199. data/ext/couchbase/utils/byteswap.hxx +33 -0
  200. data/ext/couchbase/utils/connection_string.hxx +231 -0
  201. data/ext/couchbase/utils/crc32.hxx +48 -0
  202. data/ext/couchbase/utils/url_codec.hxx +225 -0
  203. data/ext/couchbase/version.hxx +24 -0
  204. data/ext/extconf.rb +47 -0
  205. data/ext/test/main.cxx +58 -0
  206. data/ext/third_party/asio/.appveyor.yml +107 -0
  207. data/ext/third_party/asio/.cirrus.yml +16 -0
  208. data/ext/third_party/asio/.gitignore +3 -0
  209. data/ext/third_party/asio/.travis.yml +323 -0
  210. data/ext/third_party/asio/asio/.gitignore +23 -0
  211. data/ext/third_party/asio/asio/COPYING +4 -0
  212. data/ext/third_party/asio/asio/INSTALL +5 -0
  213. data/ext/third_party/asio/asio/LICENSE_1_0.txt +23 -0
  214. data/ext/third_party/asio/asio/Makefile.am +19 -0
  215. data/ext/third_party/asio/asio/README +4 -0
  216. data/ext/third_party/asio/asio/asio.manifest +4865 -0
  217. data/ext/third_party/asio/asio/autogen.sh +55 -0
  218. data/ext/third_party/asio/asio/boost_asio.manifest +5193 -0
  219. data/ext/third_party/asio/asio/boostify.pl +603 -0
  220. data/ext/third_party/asio/asio/configure.ac +182 -0
  221. data/ext/third_party/asio/asio/include/.gitignore +2 -0
  222. data/ext/third_party/asio/asio/include/Makefile.am +484 -0
  223. data/ext/third_party/asio/asio/include/asio.hpp +147 -0
  224. data/ext/third_party/asio/asio/include/asio/associated_allocator.hpp +131 -0
  225. data/ext/third_party/asio/asio/include/asio/associated_executor.hpp +149 -0
  226. data/ext/third_party/asio/asio/include/asio/async_result.hpp +589 -0
  227. data/ext/third_party/asio/asio/include/asio/awaitable.hpp +123 -0
  228. data/ext/third_party/asio/asio/include/asio/basic_datagram_socket.hpp +1210 -0
  229. data/ext/third_party/asio/asio/include/asio/basic_deadline_timer.hpp +693 -0
  230. data/ext/third_party/asio/asio/include/asio/basic_io_object.hpp +290 -0
  231. data/ext/third_party/asio/asio/include/asio/basic_raw_socket.hpp +1202 -0
  232. data/ext/third_party/asio/asio/include/asio/basic_seq_packet_socket.hpp +756 -0
  233. data/ext/third_party/asio/asio/include/asio/basic_serial_port.hpp +907 -0
  234. data/ext/third_party/asio/asio/include/asio/basic_signal_set.hpp +568 -0
  235. data/ext/third_party/asio/asio/include/asio/basic_socket.hpp +1894 -0
  236. data/ext/third_party/asio/asio/include/asio/basic_socket_acceptor.hpp +2495 -0
  237. data/ext/third_party/asio/asio/include/asio/basic_socket_iostream.hpp +407 -0
  238. data/ext/third_party/asio/asio/include/asio/basic_socket_streambuf.hpp +687 -0
  239. data/ext/third_party/asio/asio/include/asio/basic_stream_socket.hpp +1049 -0
  240. data/ext/third_party/asio/asio/include/asio/basic_streambuf.hpp +452 -0
  241. data/ext/third_party/asio/asio/include/asio/basic_streambuf_fwd.hpp +36 -0
  242. data/ext/third_party/asio/asio/include/asio/basic_waitable_timer.hpp +763 -0
  243. data/ext/third_party/asio/asio/include/asio/bind_executor.hpp +580 -0
  244. data/ext/third_party/asio/asio/include/asio/buffer.hpp +2494 -0
  245. data/ext/third_party/asio/asio/include/asio/buffered_read_stream.hpp +253 -0
  246. data/ext/third_party/asio/asio/include/asio/buffered_read_stream_fwd.hpp +25 -0
  247. data/ext/third_party/asio/asio/include/asio/buffered_stream.hpp +279 -0
  248. data/ext/third_party/asio/asio/include/asio/buffered_stream_fwd.hpp +25 -0
  249. data/ext/third_party/asio/asio/include/asio/buffered_write_stream.hpp +245 -0
  250. data/ext/third_party/asio/asio/include/asio/buffered_write_stream_fwd.hpp +25 -0
  251. data/ext/third_party/asio/asio/include/asio/buffers_iterator.hpp +521 -0
  252. data/ext/third_party/asio/asio/include/asio/co_spawn.hpp +100 -0
  253. data/ext/third_party/asio/asio/include/asio/completion_condition.hpp +218 -0
  254. data/ext/third_party/asio/asio/include/asio/compose.hpp +136 -0
  255. data/ext/third_party/asio/asio/include/asio/connect.hpp +1076 -0
  256. data/ext/third_party/asio/asio/include/asio/coroutine.hpp +328 -0
  257. data/ext/third_party/asio/asio/include/asio/deadline_timer.hpp +38 -0
  258. data/ext/third_party/asio/asio/include/asio/defer.hpp +127 -0
  259. data/ext/third_party/asio/asio/include/asio/detached.hpp +62 -0
  260. data/ext/third_party/asio/asio/include/asio/detail/array.hpp +38 -0
  261. data/ext/third_party/asio/asio/include/asio/detail/array_fwd.hpp +34 -0
  262. data/ext/third_party/asio/asio/include/asio/detail/assert.hpp +32 -0
  263. data/ext/third_party/asio/asio/include/asio/detail/atomic_count.hpp +45 -0
  264. data/ext/third_party/asio/asio/include/asio/detail/base_from_completion_cond.hpp +69 -0
  265. data/ext/third_party/asio/asio/include/asio/detail/bind_handler.hpp +816 -0
  266. data/ext/third_party/asio/asio/include/asio/detail/buffer_resize_guard.hpp +66 -0
  267. data/ext/third_party/asio/asio/include/asio/detail/buffer_sequence_adapter.hpp +544 -0
  268. data/ext/third_party/asio/asio/include/asio/detail/buffered_stream_storage.hpp +126 -0
  269. data/ext/third_party/asio/asio/include/asio/detail/call_stack.hpp +125 -0
  270. data/ext/third_party/asio/asio/include/asio/detail/chrono.hpp +66 -0
  271. data/ext/third_party/asio/asio/include/asio/detail/chrono_time_traits.hpp +190 -0
  272. data/ext/third_party/asio/asio/include/asio/detail/completion_handler.hpp +83 -0
  273. data/ext/third_party/asio/asio/include/asio/detail/concurrency_hint.hpp +94 -0
  274. data/ext/third_party/asio/asio/include/asio/detail/conditionally_enabled_event.hpp +112 -0
  275. data/ext/third_party/asio/asio/include/asio/detail/conditionally_enabled_mutex.hpp +149 -0
  276. data/ext/third_party/asio/asio/include/asio/detail/config.hpp +1499 -0
  277. data/ext/third_party/asio/asio/include/asio/detail/consuming_buffers.hpp +414 -0
  278. data/ext/third_party/asio/asio/include/asio/detail/cstddef.hpp +31 -0
  279. data/ext/third_party/asio/asio/include/asio/detail/cstdint.hpp +60 -0
  280. data/ext/third_party/asio/asio/include/asio/detail/date_time_fwd.hpp +34 -0
  281. data/ext/third_party/asio/asio/include/asio/detail/deadline_timer_service.hpp +280 -0
  282. data/ext/third_party/asio/asio/include/asio/detail/dependent_type.hpp +36 -0
  283. data/ext/third_party/asio/asio/include/asio/detail/descriptor_ops.hpp +121 -0
  284. data/ext/third_party/asio/asio/include/asio/detail/descriptor_read_op.hpp +130 -0
  285. data/ext/third_party/asio/asio/include/asio/detail/descriptor_write_op.hpp +130 -0
  286. data/ext/third_party/asio/asio/include/asio/detail/dev_poll_reactor.hpp +218 -0
  287. data/ext/third_party/asio/asio/include/asio/detail/epoll_reactor.hpp +266 -0
  288. data/ext/third_party/asio/asio/include/asio/detail/event.hpp +48 -0
  289. data/ext/third_party/asio/asio/include/asio/detail/eventfd_select_interrupter.hpp +83 -0
  290. data/ext/third_party/asio/asio/include/asio/detail/executor_function.hpp +104 -0
  291. data/ext/third_party/asio/asio/include/asio/detail/executor_op.hpp +84 -0
  292. data/ext/third_party/asio/asio/include/asio/detail/fd_set_adapter.hpp +39 -0
  293. data/ext/third_party/asio/asio/include/asio/detail/fenced_block.hpp +80 -0
  294. data/ext/third_party/asio/asio/include/asio/detail/functional.hpp +38 -0
  295. data/ext/third_party/asio/asio/include/asio/detail/future.hpp +33 -0
  296. data/ext/third_party/asio/asio/include/asio/detail/gcc_arm_fenced_block.hpp +91 -0
  297. data/ext/third_party/asio/asio/include/asio/detail/gcc_hppa_fenced_block.hpp +68 -0
  298. data/ext/third_party/asio/asio/include/asio/detail/gcc_sync_fenced_block.hpp +65 -0
  299. data/ext/third_party/asio/asio/include/asio/detail/gcc_x86_fenced_block.hpp +99 -0
  300. data/ext/third_party/asio/asio/include/asio/detail/global.hpp +52 -0
  301. data/ext/third_party/asio/asio/include/asio/detail/handler_alloc_helpers.hpp +242 -0
  302. data/ext/third_party/asio/asio/include/asio/detail/handler_cont_helpers.hpp +45 -0
  303. data/ext/third_party/asio/asio/include/asio/detail/handler_invoke_helpers.hpp +57 -0
  304. data/ext/third_party/asio/asio/include/asio/detail/handler_tracking.hpp +238 -0
  305. data/ext/third_party/asio/asio/include/asio/detail/handler_type_requirements.hpp +556 -0
  306. data/ext/third_party/asio/asio/include/asio/detail/handler_work.hpp +113 -0
  307. data/ext/third_party/asio/asio/include/asio/detail/hash_map.hpp +331 -0
  308. data/ext/third_party/asio/asio/include/asio/detail/impl/buffer_sequence_adapter.ipp +118 -0
  309. data/ext/third_party/asio/asio/include/asio/detail/impl/descriptor_ops.ipp +474 -0
  310. data/ext/third_party/asio/asio/include/asio/detail/impl/dev_poll_reactor.hpp +91 -0
  311. data/ext/third_party/asio/asio/include/asio/detail/impl/dev_poll_reactor.ipp +446 -0
  312. data/ext/third_party/asio/asio/include/asio/detail/impl/epoll_reactor.hpp +89 -0
  313. data/ext/third_party/asio/asio/include/asio/detail/impl/epoll_reactor.ipp +787 -0
  314. data/ext/third_party/asio/asio/include/asio/detail/impl/eventfd_select_interrupter.ipp +169 -0
  315. data/ext/third_party/asio/asio/include/asio/detail/impl/handler_tracking.ipp +358 -0
  316. data/ext/third_party/asio/asio/include/asio/detail/impl/kqueue_reactor.hpp +93 -0
  317. data/ext/third_party/asio/asio/include/asio/detail/impl/kqueue_reactor.ipp +570 -0
  318. data/ext/third_party/asio/asio/include/asio/detail/impl/null_event.ipp +74 -0
  319. data/ext/third_party/asio/asio/include/asio/detail/impl/pipe_select_interrupter.ipp +129 -0
  320. data/ext/third_party/asio/asio/include/asio/detail/impl/posix_event.ipp +59 -0
  321. data/ext/third_party/asio/asio/include/asio/detail/impl/posix_mutex.ipp +46 -0
  322. data/ext/third_party/asio/asio/include/asio/detail/impl/posix_thread.ipp +84 -0
  323. data/ext/third_party/asio/asio/include/asio/detail/impl/posix_tss_ptr.ipp +46 -0
  324. data/ext/third_party/asio/asio/include/asio/detail/impl/reactive_descriptor_service.ipp +223 -0
  325. data/ext/third_party/asio/asio/include/asio/detail/impl/reactive_serial_port_service.ipp +152 -0
  326. data/ext/third_party/asio/asio/include/asio/detail/impl/reactive_socket_service_base.ipp +300 -0
  327. data/ext/third_party/asio/asio/include/asio/detail/impl/resolver_service_base.ipp +158 -0
  328. data/ext/third_party/asio/asio/include/asio/detail/impl/scheduler.ipp +617 -0
  329. data/ext/third_party/asio/asio/include/asio/detail/impl/select_reactor.hpp +100 -0
  330. data/ext/third_party/asio/asio/include/asio/detail/impl/select_reactor.ipp +338 -0
  331. data/ext/third_party/asio/asio/include/asio/detail/impl/service_registry.hpp +94 -0
  332. data/ext/third_party/asio/asio/include/asio/detail/impl/service_registry.ipp +197 -0
  333. data/ext/third_party/asio/asio/include/asio/detail/impl/signal_set_service.ipp +667 -0
  334. data/ext/third_party/asio/asio/include/asio/detail/impl/socket_ops.ipp +3575 -0
  335. data/ext/third_party/asio/asio/include/asio/detail/impl/socket_select_interrupter.ipp +185 -0
  336. data/ext/third_party/asio/asio/include/asio/detail/impl/strand_executor_service.hpp +179 -0
  337. data/ext/third_party/asio/asio/include/asio/detail/impl/strand_executor_service.ipp +134 -0
  338. data/ext/third_party/asio/asio/include/asio/detail/impl/strand_service.hpp +118 -0
  339. data/ext/third_party/asio/asio/include/asio/detail/impl/strand_service.ipp +177 -0
  340. data/ext/third_party/asio/asio/include/asio/detail/impl/throw_error.ipp +60 -0
  341. data/ext/third_party/asio/asio/include/asio/detail/impl/timer_queue_ptime.ipp +91 -0
  342. data/ext/third_party/asio/asio/include/asio/detail/impl/timer_queue_set.ipp +101 -0
  343. data/ext/third_party/asio/asio/include/asio/detail/impl/win_event.ipp +76 -0
  344. data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_handle_service.ipp +525 -0
  345. data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_io_context.hpp +103 -0
  346. data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_io_context.ipp +594 -0
  347. data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp +192 -0
  348. data/ext/third_party/asio/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp +801 -0
  349. data/ext/third_party/asio/asio/include/asio/detail/impl/win_mutex.ipp +84 -0
  350. data/ext/third_party/asio/asio/include/asio/detail/impl/win_object_handle_service.ipp +448 -0
  351. data/ext/third_party/asio/asio/include/asio/detail/impl/win_static_mutex.ipp +136 -0
  352. data/ext/third_party/asio/asio/include/asio/detail/impl/win_thread.ipp +150 -0
  353. data/ext/third_party/asio/asio/include/asio/detail/impl/win_tss_ptr.ipp +57 -0
  354. data/ext/third_party/asio/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp +626 -0
  355. data/ext/third_party/asio/asio/include/asio/detail/impl/winrt_timer_scheduler.hpp +92 -0
  356. data/ext/third_party/asio/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp +121 -0
  357. data/ext/third_party/asio/asio/include/asio/detail/impl/winsock_init.ipp +82 -0
  358. data/ext/third_party/asio/asio/include/asio/detail/io_control.hpp +84 -0
  359. data/ext/third_party/asio/asio/include/asio/detail/io_object_executor.hpp +167 -0
  360. data/ext/third_party/asio/asio/include/asio/detail/io_object_impl.hpp +193 -0
  361. data/ext/third_party/asio/asio/include/asio/detail/is_buffer_sequence.hpp +312 -0
  362. data/ext/third_party/asio/asio/include/asio/detail/is_executor.hpp +126 -0
  363. data/ext/third_party/asio/asio/include/asio/detail/keyword_tss_ptr.hpp +70 -0
  364. data/ext/third_party/asio/asio/include/asio/detail/kqueue_reactor.hpp +242 -0
  365. data/ext/third_party/asio/asio/include/asio/detail/limits.hpp +26 -0
  366. data/ext/third_party/asio/asio/include/asio/detail/local_free_on_block_exit.hpp +59 -0
  367. data/ext/third_party/asio/asio/include/asio/detail/macos_fenced_block.hpp +62 -0
  368. data/ext/third_party/asio/asio/include/asio/detail/memory.hpp +70 -0
  369. data/ext/third_party/asio/asio/include/asio/detail/mutex.hpp +48 -0
  370. data/ext/third_party/asio/asio/include/asio/detail/non_const_lvalue.hpp +54 -0
  371. data/ext/third_party/asio/asio/include/asio/detail/noncopyable.hpp +43 -0
  372. data/ext/third_party/asio/asio/include/asio/detail/null_event.hpp +100 -0
  373. data/ext/third_party/asio/asio/include/asio/detail/null_fenced_block.hpp +47 -0
  374. data/ext/third_party/asio/asio/include/asio/detail/null_global.hpp +59 -0
  375. data/ext/third_party/asio/asio/include/asio/detail/null_mutex.hpp +64 -0
  376. data/ext/third_party/asio/asio/include/asio/detail/null_reactor.hpp +68 -0
  377. data/ext/third_party/asio/asio/include/asio/detail/null_signal_blocker.hpp +69 -0
  378. data/ext/third_party/asio/asio/include/asio/detail/null_socket_service.hpp +519 -0
  379. data/ext/third_party/asio/asio/include/asio/detail/null_static_mutex.hpp +60 -0
  380. data/ext/third_party/asio/asio/include/asio/detail/null_thread.hpp +67 -0
  381. data/ext/third_party/asio/asio/include/asio/detail/null_tss_ptr.hpp +68 -0
  382. data/ext/third_party/asio/asio/include/asio/detail/object_pool.hpp +171 -0
  383. data/ext/third_party/asio/asio/include/asio/detail/old_win_sdk_compat.hpp +214 -0
  384. data/ext/third_party/asio/asio/include/asio/detail/op_queue.hpp +162 -0
  385. data/ext/third_party/asio/asio/include/asio/detail/operation.hpp +38 -0
  386. data/ext/third_party/asio/asio/include/asio/detail/pipe_select_interrupter.hpp +89 -0
  387. data/ext/third_party/asio/asio/include/asio/detail/pop_options.hpp +141 -0
  388. data/ext/third_party/asio/asio/include/asio/detail/posix_event.hpp +162 -0
  389. data/ext/third_party/asio/asio/include/asio/detail/posix_fd_set_adapter.hpp +118 -0
  390. data/ext/third_party/asio/asio/include/asio/detail/posix_global.hpp +80 -0
  391. data/ext/third_party/asio/asio/include/asio/detail/posix_mutex.hpp +76 -0
  392. data/ext/third_party/asio/asio/include/asio/detail/posix_signal_blocker.hpp +85 -0
  393. data/ext/third_party/asio/asio/include/asio/detail/posix_static_mutex.hpp +64 -0
  394. data/ext/third_party/asio/asio/include/asio/detail/posix_thread.hpp +109 -0
  395. data/ext/third_party/asio/asio/include/asio/detail/posix_tss_ptr.hpp +79 -0
  396. data/ext/third_party/asio/asio/include/asio/detail/push_options.hpp +185 -0
  397. data/ext/third_party/asio/asio/include/asio/detail/reactive_descriptor_service.hpp +391 -0
  398. data/ext/third_party/asio/asio/include/asio/detail/reactive_null_buffers_op.hpp +92 -0
  399. data/ext/third_party/asio/asio/include/asio/detail/reactive_serial_port_service.hpp +238 -0
  400. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_accept_op.hpp +230 -0
  401. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_connect_op.hpp +116 -0
  402. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recv_op.hpp +137 -0
  403. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recvfrom_op.hpp +142 -0
  404. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_recvmsg_op.hpp +135 -0
  405. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_send_op.hpp +136 -0
  406. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_sendto_op.hpp +134 -0
  407. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_service.hpp +505 -0
  408. data/ext/third_party/asio/asio/include/asio/detail/reactive_socket_service_base.hpp +518 -0
  409. data/ext/third_party/asio/asio/include/asio/detail/reactive_wait_op.hpp +92 -0
  410. data/ext/third_party/asio/asio/include/asio/detail/reactor.hpp +32 -0
  411. data/ext/third_party/asio/asio/include/asio/detail/reactor_fwd.hpp +40 -0
  412. data/ext/third_party/asio/asio/include/asio/detail/reactor_op.hpp +65 -0
  413. data/ext/third_party/asio/asio/include/asio/detail/reactor_op_queue.hpp +168 -0
  414. data/ext/third_party/asio/asio/include/asio/detail/recycling_allocator.hpp +106 -0
  415. data/ext/third_party/asio/asio/include/asio/detail/regex_fwd.hpp +35 -0
  416. data/ext/third_party/asio/asio/include/asio/detail/resolve_endpoint_op.hpp +138 -0
  417. data/ext/third_party/asio/asio/include/asio/detail/resolve_op.hpp +45 -0
  418. data/ext/third_party/asio/asio/include/asio/detail/resolve_query_op.hpp +148 -0
  419. data/ext/third_party/asio/asio/include/asio/detail/resolver_service.hpp +145 -0
  420. data/ext/third_party/asio/asio/include/asio/detail/resolver_service_base.hpp +143 -0
  421. data/ext/third_party/asio/asio/include/asio/detail/scheduler.hpp +224 -0
  422. data/ext/third_party/asio/asio/include/asio/detail/scheduler_operation.hpp +78 -0
  423. data/ext/third_party/asio/asio/include/asio/detail/scheduler_thread_info.hpp +40 -0
  424. data/ext/third_party/asio/asio/include/asio/detail/scoped_lock.hpp +101 -0
  425. data/ext/third_party/asio/asio/include/asio/detail/scoped_ptr.hpp +87 -0
  426. data/ext/third_party/asio/asio/include/asio/detail/select_interrupter.hpp +46 -0
  427. data/ext/third_party/asio/asio/include/asio/detail/select_reactor.hpp +238 -0
  428. data/ext/third_party/asio/asio/include/asio/detail/service_registry.hpp +164 -0
  429. data/ext/third_party/asio/asio/include/asio/detail/signal_blocker.hpp +44 -0
  430. data/ext/third_party/asio/asio/include/asio/detail/signal_handler.hpp +88 -0
  431. data/ext/third_party/asio/asio/include/asio/detail/signal_init.hpp +47 -0
  432. data/ext/third_party/asio/asio/include/asio/detail/signal_op.hpp +49 -0
  433. data/ext/third_party/asio/asio/include/asio/detail/signal_set_service.hpp +229 -0
  434. data/ext/third_party/asio/asio/include/asio/detail/socket_holder.hpp +98 -0
  435. data/ext/third_party/asio/asio/include/asio/detail/socket_ops.hpp +337 -0
  436. data/ext/third_party/asio/asio/include/asio/detail/socket_option.hpp +316 -0
  437. data/ext/third_party/asio/asio/include/asio/detail/socket_select_interrupter.hpp +91 -0
  438. data/ext/third_party/asio/asio/include/asio/detail/socket_types.hpp +416 -0
  439. data/ext/third_party/asio/asio/include/asio/detail/solaris_fenced_block.hpp +62 -0
  440. data/ext/third_party/asio/asio/include/asio/detail/static_mutex.hpp +52 -0
  441. data/ext/third_party/asio/asio/include/asio/detail/std_event.hpp +176 -0
  442. data/ext/third_party/asio/asio/include/asio/detail/std_fenced_block.hpp +62 -0
  443. data/ext/third_party/asio/asio/include/asio/detail/std_global.hpp +70 -0
  444. data/ext/third_party/asio/asio/include/asio/detail/std_mutex.hpp +73 -0
  445. data/ext/third_party/asio/asio/include/asio/detail/std_static_mutex.hpp +81 -0
  446. data/ext/third_party/asio/asio/include/asio/detail/std_thread.hpp +71 -0
  447. data/ext/third_party/asio/asio/include/asio/detail/strand_executor_service.hpp +142 -0
  448. data/ext/third_party/asio/asio/include/asio/detail/strand_service.hpp +142 -0
  449. data/ext/third_party/asio/asio/include/asio/detail/string_view.hpp +47 -0
  450. data/ext/third_party/asio/asio/include/asio/detail/thread.hpp +60 -0
  451. data/ext/third_party/asio/asio/include/asio/detail/thread_context.hpp +42 -0
  452. data/ext/third_party/asio/asio/include/asio/detail/thread_group.hpp +95 -0
  453. data/ext/third_party/asio/asio/include/asio/detail/thread_info_base.hpp +125 -0
  454. data/ext/third_party/asio/asio/include/asio/detail/throw_error.hpp +53 -0
  455. data/ext/third_party/asio/asio/include/asio/detail/throw_exception.hpp +51 -0
  456. data/ext/third_party/asio/asio/include/asio/detail/timer_queue.hpp +360 -0
  457. data/ext/third_party/asio/asio/include/asio/detail/timer_queue_base.hpp +68 -0
  458. data/ext/third_party/asio/asio/include/asio/detail/timer_queue_ptime.hpp +99 -0
  459. data/ext/third_party/asio/asio/include/asio/detail/timer_queue_set.hpp +66 -0
  460. data/ext/third_party/asio/asio/include/asio/detail/timer_scheduler.hpp +35 -0
  461. data/ext/third_party/asio/asio/include/asio/detail/timer_scheduler_fwd.hpp +40 -0
  462. data/ext/third_party/asio/asio/include/asio/detail/tss_ptr.hpp +69 -0
  463. data/ext/third_party/asio/asio/include/asio/detail/type_traits.hpp +89 -0
  464. data/ext/third_party/asio/asio/include/asio/detail/variadic_templates.hpp +151 -0
  465. data/ext/third_party/asio/asio/include/asio/detail/wait_handler.hpp +87 -0
  466. data/ext/third_party/asio/asio/include/asio/detail/wait_op.hpp +45 -0
  467. data/ext/third_party/asio/asio/include/asio/detail/win_event.hpp +151 -0
  468. data/ext/third_party/asio/asio/include/asio/detail/win_fd_set_adapter.hpp +149 -0
  469. data/ext/third_party/asio/asio/include/asio/detail/win_fenced_block.hpp +90 -0
  470. data/ext/third_party/asio/asio/include/asio/detail/win_global.hpp +71 -0
  471. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_read_op.hpp +113 -0
  472. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_service.hpp +335 -0
  473. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_handle_write_op.hpp +106 -0
  474. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_io_context.hpp +338 -0
  475. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_null_buffers_op.hpp +123 -0
  476. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_operation.hpp +96 -0
  477. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_overlapped_op.hpp +92 -0
  478. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp +159 -0
  479. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_serial_port_service.hpp +232 -0
  480. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_accept_op.hpp +308 -0
  481. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_connect_op.hpp +130 -0
  482. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recv_op.hpp +120 -0
  483. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recvfrom_op.hpp +129 -0
  484. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_recvmsg_op.hpp +121 -0
  485. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_send_op.hpp +114 -0
  486. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_service.hpp +581 -0
  487. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_socket_service_base.hpp +600 -0
  488. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_thread_info.hpp +34 -0
  489. data/ext/third_party/asio/asio/include/asio/detail/win_iocp_wait_op.hpp +123 -0
  490. data/ext/third_party/asio/asio/include/asio/detail/win_mutex.hpp +78 -0
  491. data/ext/third_party/asio/asio/include/asio/detail/win_object_handle_service.hpp +195 -0
  492. data/ext/third_party/asio/asio/include/asio/detail/win_static_mutex.hpp +74 -0
  493. data/ext/third_party/asio/asio/include/asio/detail/win_thread.hpp +147 -0
  494. data/ext/third_party/asio/asio/include/asio/detail/win_tss_ptr.hpp +79 -0
  495. data/ext/third_party/asio/asio/include/asio/detail/winapp_thread.hpp +124 -0
  496. data/ext/third_party/asio/asio/include/asio/detail/wince_thread.hpp +124 -0
  497. data/ext/third_party/asio/asio/include/asio/detail/winrt_async_manager.hpp +305 -0
  498. data/ext/third_party/asio/asio/include/asio/detail/winrt_async_op.hpp +65 -0
  499. data/ext/third_party/asio/asio/include/asio/detail/winrt_resolve_op.hpp +121 -0
  500. data/ext/third_party/asio/asio/include/asio/detail/winrt_resolver_service.hpp +212 -0
  501. data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_connect_op.hpp +94 -0
  502. data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_recv_op.hpp +115 -0
  503. data/ext/third_party/asio/asio/include/asio/detail/winrt_socket_send_op.hpp +106 -0
  504. data/ext/third_party/asio/asio/include/asio/detail/winrt_ssocket_service.hpp +250 -0
  505. data/ext/third_party/asio/asio/include/asio/detail/winrt_ssocket_service_base.hpp +362 -0
  506. data/ext/third_party/asio/asio/include/asio/detail/winrt_timer_scheduler.hpp +147 -0
  507. data/ext/third_party/asio/asio/include/asio/detail/winrt_utils.hpp +106 -0
  508. data/ext/third_party/asio/asio/include/asio/detail/winsock_init.hpp +128 -0
  509. data/ext/third_party/asio/asio/include/asio/detail/work_dispatcher.hpp +73 -0
  510. data/ext/third_party/asio/asio/include/asio/detail/wrapped_handler.hpp +291 -0
  511. data/ext/third_party/asio/asio/include/asio/dispatch.hpp +118 -0
  512. data/ext/third_party/asio/asio/include/asio/error.hpp +356 -0
  513. data/ext/third_party/asio/asio/include/asio/error_code.hpp +202 -0
  514. data/ext/third_party/asio/asio/include/asio/execution_context.hpp +412 -0
  515. data/ext/third_party/asio/asio/include/asio/executor.hpp +341 -0
  516. data/ext/third_party/asio/asio/include/asio/executor_work_guard.hpp +170 -0
  517. data/ext/third_party/asio/asio/include/asio/generic/basic_endpoint.hpp +193 -0
  518. data/ext/third_party/asio/asio/include/asio/generic/datagram_protocol.hpp +123 -0
  519. data/ext/third_party/asio/asio/include/asio/generic/detail/endpoint.hpp +133 -0
  520. data/ext/third_party/asio/asio/include/asio/generic/detail/impl/endpoint.ipp +110 -0
  521. data/ext/third_party/asio/asio/include/asio/generic/raw_protocol.hpp +121 -0
  522. data/ext/third_party/asio/asio/include/asio/generic/seq_packet_protocol.hpp +122 -0
  523. data/ext/third_party/asio/asio/include/asio/generic/stream_protocol.hpp +127 -0
  524. data/ext/third_party/asio/asio/include/asio/handler_alloc_hook.hpp +81 -0
  525. data/ext/third_party/asio/asio/include/asio/handler_continuation_hook.hpp +54 -0
  526. data/ext/third_party/asio/asio/include/asio/handler_invoke_hook.hpp +85 -0
  527. data/ext/third_party/asio/asio/include/asio/high_resolution_timer.hpp +44 -0
  528. data/ext/third_party/asio/asio/include/asio/impl/awaitable.hpp +422 -0
  529. data/ext/third_party/asio/asio/include/asio/impl/buffered_read_stream.hpp +491 -0
  530. data/ext/third_party/asio/asio/include/asio/impl/buffered_write_stream.hpp +471 -0
  531. data/ext/third_party/asio/asio/include/asio/impl/co_spawn.hpp +160 -0
  532. data/ext/third_party/asio/asio/include/asio/impl/compose.hpp +533 -0
  533. data/ext/third_party/asio/asio/include/asio/impl/connect.hpp +872 -0
  534. data/ext/third_party/asio/asio/include/asio/impl/defer.hpp +113 -0
  535. data/ext/third_party/asio/asio/include/asio/impl/detached.hpp +130 -0
  536. data/ext/third_party/asio/asio/include/asio/impl/dispatch.hpp +113 -0
  537. data/ext/third_party/asio/asio/include/asio/impl/error.ipp +128 -0
  538. data/ext/third_party/asio/asio/include/asio/impl/error_code.ipp +206 -0
  539. data/ext/third_party/asio/asio/include/asio/impl/execution_context.hpp +109 -0
  540. data/ext/third_party/asio/asio/include/asio/impl/execution_context.ipp +82 -0
  541. data/ext/third_party/asio/asio/include/asio/impl/executor.hpp +387 -0
  542. data/ext/third_party/asio/asio/include/asio/impl/executor.ipp +38 -0
  543. data/ext/third_party/asio/asio/include/asio/impl/handler_alloc_hook.ipp +52 -0
  544. data/ext/third_party/asio/asio/include/asio/impl/io_context.hpp +353 -0
  545. data/ext/third_party/asio/asio/include/asio/impl/io_context.ipp +175 -0
  546. data/ext/third_party/asio/asio/include/asio/impl/post.hpp +113 -0
  547. data/ext/third_party/asio/asio/include/asio/impl/read.hpp +1135 -0
  548. data/ext/third_party/asio/asio/include/asio/impl/read_at.hpp +699 -0
  549. data/ext/third_party/asio/asio/include/asio/impl/read_until.hpp +3150 -0
  550. data/ext/third_party/asio/asio/include/asio/impl/redirect_error.hpp +372 -0
  551. data/ext/third_party/asio/asio/include/asio/impl/serial_port_base.hpp +59 -0
  552. data/ext/third_party/asio/asio/include/asio/impl/serial_port_base.ipp +554 -0
  553. data/ext/third_party/asio/asio/include/asio/impl/spawn.hpp +490 -0
  554. data/ext/third_party/asio/asio/include/asio/impl/src.cpp +25 -0
  555. data/ext/third_party/asio/asio/include/asio/impl/src.hpp +82 -0
  556. data/ext/third_party/asio/asio/include/asio/impl/system_context.hpp +34 -0
  557. data/ext/third_party/asio/asio/include/asio/impl/system_context.ipp +80 -0
  558. data/ext/third_party/asio/asio/include/asio/impl/system_executor.hpp +85 -0
  559. data/ext/third_party/asio/asio/include/asio/impl/thread_pool.hpp +127 -0
  560. data/ext/third_party/asio/asio/include/asio/impl/thread_pool.ipp +87 -0
  561. data/ext/third_party/asio/asio/include/asio/impl/use_awaitable.hpp +276 -0
  562. data/ext/third_party/asio/asio/include/asio/impl/use_future.hpp +887 -0
  563. data/ext/third_party/asio/asio/include/asio/impl/write.hpp +1043 -0
  564. data/ext/third_party/asio/asio/include/asio/impl/write_at.hpp +624 -0
  565. data/ext/third_party/asio/asio/include/asio/io_context.hpp +872 -0
  566. data/ext/third_party/asio/asio/include/asio/io_context_strand.hpp +374 -0
  567. data/ext/third_party/asio/asio/include/asio/io_service.hpp +33 -0
  568. data/ext/third_party/asio/asio/include/asio/io_service_strand.hpp +20 -0
  569. data/ext/third_party/asio/asio/include/asio/ip/address.hpp +268 -0
  570. data/ext/third_party/asio/asio/include/asio/ip/address_v4.hpp +335 -0
  571. data/ext/third_party/asio/asio/include/asio/ip/address_v4_iterator.hpp +162 -0
  572. data/ext/third_party/asio/asio/include/asio/ip/address_v4_range.hpp +134 -0
  573. data/ext/third_party/asio/asio/include/asio/ip/address_v6.hpp +341 -0
  574. data/ext/third_party/asio/asio/include/asio/ip/address_v6_iterator.hpp +183 -0
  575. data/ext/third_party/asio/asio/include/asio/ip/address_v6_range.hpp +129 -0
  576. data/ext/third_party/asio/asio/include/asio/ip/bad_address_cast.hpp +53 -0
  577. data/ext/third_party/asio/asio/include/asio/ip/basic_endpoint.hpp +264 -0
  578. data/ext/third_party/asio/asio/include/asio/ip/basic_resolver.hpp +1030 -0
  579. data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_entry.hpp +113 -0
  580. data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_iterator.hpp +192 -0
  581. data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_query.hpp +244 -0
  582. data/ext/third_party/asio/asio/include/asio/ip/basic_resolver_results.hpp +311 -0
  583. data/ext/third_party/asio/asio/include/asio/ip/detail/endpoint.hpp +141 -0
  584. data/ext/third_party/asio/asio/include/asio/ip/detail/impl/endpoint.ipp +199 -0
  585. data/ext/third_party/asio/asio/include/asio/ip/detail/socket_option.hpp +566 -0
  586. data/ext/third_party/asio/asio/include/asio/ip/host_name.hpp +42 -0
  587. data/ext/third_party/asio/asio/include/asio/ip/icmp.hpp +115 -0
  588. data/ext/third_party/asio/asio/include/asio/ip/impl/address.hpp +67 -0
  589. data/ext/third_party/asio/asio/include/asio/ip/impl/address.ipp +239 -0
  590. data/ext/third_party/asio/asio/include/asio/ip/impl/address_v4.hpp +67 -0
  591. data/ext/third_party/asio/asio/include/asio/ip/impl/address_v4.ipp +210 -0
  592. data/ext/third_party/asio/asio/include/asio/ip/impl/address_v6.hpp +67 -0
  593. data/ext/third_party/asio/asio/include/asio/ip/impl/address_v6.ipp +350 -0
  594. data/ext/third_party/asio/asio/include/asio/ip/impl/basic_endpoint.hpp +43 -0
  595. data/ext/third_party/asio/asio/include/asio/ip/impl/host_name.ipp +54 -0
  596. data/ext/third_party/asio/asio/include/asio/ip/impl/network_v4.hpp +54 -0
  597. data/ext/third_party/asio/asio/include/asio/ip/impl/network_v4.ipp +216 -0
  598. data/ext/third_party/asio/asio/include/asio/ip/impl/network_v6.hpp +53 -0
  599. data/ext/third_party/asio/asio/include/asio/ip/impl/network_v6.ipp +185 -0
  600. data/ext/third_party/asio/asio/include/asio/ip/multicast.hpp +191 -0
  601. data/ext/third_party/asio/asio/include/asio/ip/network_v4.hpp +261 -0
  602. data/ext/third_party/asio/asio/include/asio/ip/network_v6.hpp +235 -0
  603. data/ext/third_party/asio/asio/include/asio/ip/resolver_base.hpp +129 -0
  604. data/ext/third_party/asio/asio/include/asio/ip/resolver_query_base.hpp +43 -0
  605. data/ext/third_party/asio/asio/include/asio/ip/tcp.hpp +155 -0
  606. data/ext/third_party/asio/asio/include/asio/ip/udp.hpp +111 -0
  607. data/ext/third_party/asio/asio/include/asio/ip/unicast.hpp +70 -0
  608. data/ext/third_party/asio/asio/include/asio/ip/v6_only.hpp +69 -0
  609. data/ext/third_party/asio/asio/include/asio/is_executor.hpp +46 -0
  610. data/ext/third_party/asio/asio/include/asio/is_read_buffered.hpp +59 -0
  611. data/ext/third_party/asio/asio/include/asio/is_write_buffered.hpp +59 -0
  612. data/ext/third_party/asio/asio/include/asio/local/basic_endpoint.hpp +247 -0
  613. data/ext/third_party/asio/asio/include/asio/local/connect_pair.hpp +101 -0
  614. data/ext/third_party/asio/asio/include/asio/local/datagram_protocol.hpp +80 -0
  615. data/ext/third_party/asio/asio/include/asio/local/detail/endpoint.hpp +139 -0
  616. data/ext/third_party/asio/asio/include/asio/local/detail/impl/endpoint.ipp +136 -0
  617. data/ext/third_party/asio/asio/include/asio/local/stream_protocol.hpp +90 -0
  618. data/ext/third_party/asio/asio/include/asio/packaged_task.hpp +126 -0
  619. data/ext/third_party/asio/asio/include/asio/placeholders.hpp +151 -0
  620. data/ext/third_party/asio/asio/include/asio/posix/basic_descriptor.hpp +697 -0
  621. data/ext/third_party/asio/asio/include/asio/posix/basic_stream_descriptor.hpp +470 -0
  622. data/ext/third_party/asio/asio/include/asio/posix/descriptor.hpp +37 -0
  623. data/ext/third_party/asio/asio/include/asio/posix/descriptor_base.hpp +90 -0
  624. data/ext/third_party/asio/asio/include/asio/posix/stream_descriptor.hpp +37 -0
  625. data/ext/third_party/asio/asio/include/asio/post.hpp +123 -0
  626. data/ext/third_party/asio/asio/include/asio/read.hpp +1288 -0
  627. data/ext/third_party/asio/asio/include/asio/read_at.hpp +694 -0
  628. data/ext/third_party/asio/asio/include/asio/read_until.hpp +2863 -0
  629. data/ext/third_party/asio/asio/include/asio/redirect_error.hpp +66 -0
  630. data/ext/third_party/asio/asio/include/asio/serial_port.hpp +36 -0
  631. data/ext/third_party/asio/asio/include/asio/serial_port_base.hpp +167 -0
  632. data/ext/third_party/asio/asio/include/asio/signal_set.hpp +28 -0
  633. data/ext/third_party/asio/asio/include/asio/socket_base.hpp +559 -0
  634. data/ext/third_party/asio/asio/include/asio/spawn.hpp +336 -0
  635. data/ext/third_party/asio/asio/include/asio/ssl.hpp +28 -0
  636. data/ext/third_party/asio/asio/include/asio/ssl/context.hpp +761 -0
  637. data/ext/third_party/asio/asio/include/asio/ssl/context_base.hpp +209 -0
  638. data/ext/third_party/asio/asio/include/asio/ssl/detail/buffered_handshake_op.hpp +114 -0
  639. data/ext/third_party/asio/asio/include/asio/ssl/detail/engine.hpp +160 -0
  640. data/ext/third_party/asio/asio/include/asio/ssl/detail/handshake_op.hpp +62 -0
  641. data/ext/third_party/asio/asio/include/asio/ssl/detail/impl/engine.ipp +336 -0
  642. data/ext/third_party/asio/asio/include/asio/ssl/detail/impl/openssl_init.ipp +165 -0
  643. data/ext/third_party/asio/asio/include/asio/ssl/detail/io.hpp +381 -0
  644. data/ext/third_party/asio/asio/include/asio/ssl/detail/openssl_init.hpp +101 -0
  645. data/ext/third_party/asio/asio/include/asio/ssl/detail/openssl_types.hpp +34 -0
  646. data/ext/third_party/asio/asio/include/asio/ssl/detail/password_callback.hpp +66 -0
  647. data/ext/third_party/asio/asio/include/asio/ssl/detail/read_op.hpp +67 -0
  648. data/ext/third_party/asio/asio/include/asio/ssl/detail/shutdown_op.hpp +64 -0
  649. data/ext/third_party/asio/asio/include/asio/ssl/detail/stream_core.hpp +135 -0
  650. data/ext/third_party/asio/asio/include/asio/ssl/detail/verify_callback.hpp +62 -0
  651. data/ext/third_party/asio/asio/include/asio/ssl/detail/write_op.hpp +67 -0
  652. data/ext/third_party/asio/asio/include/asio/ssl/error.hpp +125 -0
  653. data/ext/third_party/asio/asio/include/asio/ssl/host_name_verification.hpp +90 -0
  654. data/ext/third_party/asio/asio/include/asio/ssl/impl/context.hpp +67 -0
  655. data/ext/third_party/asio/asio/include/asio/ssl/impl/context.ipp +1238 -0
  656. data/ext/third_party/asio/asio/include/asio/ssl/impl/error.ipp +102 -0
  657. data/ext/third_party/asio/asio/include/asio/ssl/impl/host_name_verification.ipp +73 -0
  658. data/ext/third_party/asio/asio/include/asio/ssl/impl/rfc2818_verification.ipp +164 -0
  659. data/ext/third_party/asio/asio/include/asio/ssl/impl/src.hpp +29 -0
  660. data/ext/third_party/asio/asio/include/asio/ssl/rfc2818_verification.hpp +98 -0
  661. data/ext/third_party/asio/asio/include/asio/ssl/stream.hpp +885 -0
  662. data/ext/third_party/asio/asio/include/asio/ssl/stream_base.hpp +52 -0
  663. data/ext/third_party/asio/asio/include/asio/ssl/verify_context.hpp +67 -0
  664. data/ext/third_party/asio/asio/include/asio/ssl/verify_mode.hpp +63 -0
  665. data/ext/third_party/asio/asio/include/asio/steady_timer.hpp +42 -0
  666. data/ext/third_party/asio/asio/include/asio/strand.hpp +314 -0
  667. data/ext/third_party/asio/asio/include/asio/streambuf.hpp +33 -0
  668. data/ext/third_party/asio/asio/include/asio/system_context.hpp +81 -0
  669. data/ext/third_party/asio/asio/include/asio/system_error.hpp +131 -0
  670. data/ext/third_party/asio/asio/include/asio/system_executor.hpp +129 -0
  671. data/ext/third_party/asio/asio/include/asio/system_timer.hpp +42 -0
  672. data/ext/third_party/asio/asio/include/asio/this_coro.hpp +45 -0
  673. data/ext/third_party/asio/asio/include/asio/thread.hpp +92 -0
  674. data/ext/third_party/asio/asio/include/asio/thread_pool.hpp +235 -0
  675. data/ext/third_party/asio/asio/include/asio/time_traits.hpp +86 -0
  676. data/ext/third_party/asio/asio/include/asio/ts/buffer.hpp +24 -0
  677. data/ext/third_party/asio/asio/include/asio/ts/executor.hpp +34 -0
  678. data/ext/third_party/asio/asio/include/asio/ts/internet.hpp +40 -0
  679. data/ext/third_party/asio/asio/include/asio/ts/io_context.hpp +20 -0
  680. data/ext/third_party/asio/asio/include/asio/ts/net.hpp +26 -0
  681. data/ext/third_party/asio/asio/include/asio/ts/netfwd.hpp +203 -0
  682. data/ext/third_party/asio/asio/include/asio/ts/socket.hpp +27 -0
  683. data/ext/third_party/asio/asio/include/asio/ts/timer.hpp +26 -0
  684. data/ext/third_party/asio/asio/include/asio/unyield.hpp +21 -0
  685. data/ext/third_party/asio/asio/include/asio/use_awaitable.hpp +110 -0
  686. data/ext/third_party/asio/asio/include/asio/use_future.hpp +160 -0
  687. data/ext/third_party/asio/asio/include/asio/uses_executor.hpp +71 -0
  688. data/ext/third_party/asio/asio/include/asio/version.hpp +23 -0
  689. data/ext/third_party/asio/asio/include/asio/wait_traits.hpp +56 -0
  690. data/ext/third_party/asio/asio/include/asio/windows/basic_object_handle.hpp +435 -0
  691. data/ext/third_party/asio/asio/include/asio/windows/basic_overlapped_handle.hpp +361 -0
  692. data/ext/third_party/asio/asio/include/asio/windows/basic_random_access_handle.hpp +490 -0
  693. data/ext/third_party/asio/asio/include/asio/windows/basic_stream_handle.hpp +474 -0
  694. data/ext/third_party/asio/asio/include/asio/windows/object_handle.hpp +38 -0
  695. data/ext/third_party/asio/asio/include/asio/windows/overlapped_handle.hpp +39 -0
  696. data/ext/third_party/asio/asio/include/asio/windows/overlapped_ptr.hpp +143 -0
  697. data/ext/third_party/asio/asio/include/asio/windows/random_access_handle.hpp +37 -0
  698. data/ext/third_party/asio/asio/include/asio/windows/stream_handle.hpp +37 -0
  699. data/ext/third_party/asio/asio/include/asio/write.hpp +1246 -0
  700. data/ext/third_party/asio/asio/include/asio/write_at.hpp +702 -0
  701. data/ext/third_party/asio/asio/include/asio/yield.hpp +23 -0
  702. data/ext/third_party/asio/asio/release.pl +440 -0
  703. data/ext/third_party/asio/asio/src/.gitignore +11 -0
  704. data/ext/third_party/asio/asio/src/Makefile.am +23 -0
  705. data/ext/third_party/asio/asio/src/Makefile.mgw +204 -0
  706. data/ext/third_party/asio/asio/src/Makefile.msc +497 -0
  707. data/ext/third_party/asio/asio/src/asio.cpp +11 -0
  708. data/ext/third_party/asio/asio/src/asio_ssl.cpp +11 -0
  709. data/ext/third_party/asio/asio/src/doc/.gitignore +5 -0
  710. data/ext/third_party/asio/asio/src/doc/Jamfile.v2 +62 -0
  711. data/ext/third_party/asio/asio/src/doc/asio.png +0 -0
  712. data/ext/third_party/asio/asio/src/doc/asio.qbk +127 -0
  713. data/ext/third_party/asio/asio/src/doc/asioref.sty +90 -0
  714. data/ext/third_party/asio/asio/src/doc/asioref.xsl +94 -0
  715. data/ext/third_party/asio/asio/src/doc/boost_bind_dox.txt +5 -0
  716. data/ext/third_party/asio/asio/src/doc/doxy2qbk.pl +22 -0
  717. data/ext/third_party/asio/asio/src/doc/examples.qbk +564 -0
  718. data/ext/third_party/asio/asio/src/doc/history.qbk +1794 -0
  719. data/ext/third_party/asio/asio/src/doc/index.xml +13 -0
  720. data/ext/third_party/asio/asio/src/doc/makepdf.pl +26 -0
  721. data/ext/third_party/asio/asio/src/doc/net_ts.qbk +479 -0
  722. data/ext/third_party/asio/asio/src/doc/noncopyable_dox.txt +3 -0
  723. data/ext/third_party/asio/asio/src/doc/overview.qbk +103 -0
  724. data/ext/third_party/asio/asio/src/doc/overview/allocation.qbk +89 -0
  725. data/ext/third_party/asio/asio/src/doc/overview/async.qbk +185 -0
  726. data/ext/third_party/asio/asio/src/doc/overview/async_op1.dot +78 -0
  727. data/ext/third_party/asio/asio/src/doc/overview/async_op1.png +0 -0
  728. data/ext/third_party/asio/asio/src/doc/overview/async_op2.dot +78 -0
  729. data/ext/third_party/asio/asio/src/doc/overview/async_op2.png +0 -0
  730. data/ext/third_party/asio/asio/src/doc/overview/basics.qbk +106 -0
  731. data/ext/third_party/asio/asio/src/doc/overview/bsd_sockets.qbk +270 -0
  732. data/ext/third_party/asio/asio/src/doc/overview/buffers.qbk +163 -0
  733. data/ext/third_party/asio/asio/src/doc/overview/concurrency_hint.qbk +88 -0
  734. data/ext/third_party/asio/asio/src/doc/overview/coroutine.qbk +51 -0
  735. data/ext/third_party/asio/asio/src/doc/overview/coroutines_ts.qbk +97 -0
  736. data/ext/third_party/asio/asio/src/doc/overview/cpp2011.qbk +271 -0
  737. data/ext/third_party/asio/asio/src/doc/overview/handler_tracking.qbk +220 -0
  738. data/ext/third_party/asio/asio/src/doc/overview/implementation.qbk +305 -0
  739. data/ext/third_party/asio/asio/src/doc/overview/iostreams.qbk +72 -0
  740. data/ext/third_party/asio/asio/src/doc/overview/line_based.qbk +118 -0
  741. data/ext/third_party/asio/asio/src/doc/overview/other_protocols.qbk +94 -0
  742. data/ext/third_party/asio/asio/src/doc/overview/posix.qbk +152 -0
  743. data/ext/third_party/asio/asio/src/doc/overview/proactor.dot +100 -0
  744. data/ext/third_party/asio/asio/src/doc/overview/proactor.png +0 -0
  745. data/ext/third_party/asio/asio/src/doc/overview/protocols.qbk +149 -0
  746. data/ext/third_party/asio/asio/src/doc/overview/rationale.qbk +54 -0
  747. data/ext/third_party/asio/asio/src/doc/overview/reactor.qbk +44 -0
  748. data/ext/third_party/asio/asio/src/doc/overview/serial_ports.qbk +45 -0
  749. data/ext/third_party/asio/asio/src/doc/overview/signals.qbk +44 -0
  750. data/ext/third_party/asio/asio/src/doc/overview/spawn.qbk +102 -0
  751. data/ext/third_party/asio/asio/src/doc/overview/ssl.qbk +124 -0
  752. data/ext/third_party/asio/asio/src/doc/overview/strands.qbk +114 -0
  753. data/ext/third_party/asio/asio/src/doc/overview/streams.qbk +62 -0
  754. data/ext/third_party/asio/asio/src/doc/overview/sync_op.dot +67 -0
  755. data/ext/third_party/asio/asio/src/doc/overview/sync_op.png +0 -0
  756. data/ext/third_party/asio/asio/src/doc/overview/threads.qbk +67 -0
  757. data/ext/third_party/asio/asio/src/doc/overview/timers.qbk +52 -0
  758. data/ext/third_party/asio/asio/src/doc/overview/windows.qbk +126 -0
  759. data/ext/third_party/asio/asio/src/doc/project-root.jam +1 -0
  760. data/ext/third_party/asio/asio/src/doc/quickref.xml +561 -0
  761. data/ext/third_party/asio/asio/src/doc/reference.dox +264 -0
  762. data/ext/third_party/asio/asio/src/doc/reference.qbk +125973 -0
  763. data/ext/third_party/asio/asio/src/doc/reference.xsl +1831 -0
  764. data/ext/third_party/asio/asio/src/doc/release_checklist.htm +68 -0
  765. data/ext/third_party/asio/asio/src/doc/requirements/AcceptHandler.qbk +72 -0
  766. data/ext/third_party/asio/asio/src/doc/requirements/AcceptableProtocol.qbk +25 -0
  767. data/ext/third_party/asio/asio/src/doc/requirements/AsyncRandomAccessReadDevice.qbk +56 -0
  768. data/ext/third_party/asio/asio/src/doc/requirements/AsyncRandomAccessWriteDevice.qbk +57 -0
  769. data/ext/third_party/asio/asio/src/doc/requirements/AsyncReadStream.qbk +50 -0
  770. data/ext/third_party/asio/asio/src/doc/requirements/AsyncWriteStream.qbk +48 -0
  771. data/ext/third_party/asio/asio/src/doc/requirements/BufferedHandshakeHandler.qbk +55 -0
  772. data/ext/third_party/asio/asio/src/doc/requirements/CompletionCondition.qbk +42 -0
  773. data/ext/third_party/asio/asio/src/doc/requirements/CompletionHandler.qbk +63 -0
  774. data/ext/third_party/asio/asio/src/doc/requirements/ConnectCondition.qbk +34 -0
  775. data/ext/third_party/asio/asio/src/doc/requirements/ConnectHandler.qbk +72 -0
  776. data/ext/third_party/asio/asio/src/doc/requirements/ConstBufferSequence.qbk +53 -0
  777. data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer.qbk +16 -0
  778. data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer_v1.qbk +93 -0
  779. data/ext/third_party/asio/asio/src/doc/requirements/DynamicBuffer_v2.qbk +94 -0
  780. data/ext/third_party/asio/asio/src/doc/requirements/Endpoint.qbk +97 -0
  781. data/ext/third_party/asio/asio/src/doc/requirements/EndpointSequence.qbk +30 -0
  782. data/ext/third_party/asio/asio/src/doc/requirements/ExecutionContext.qbk +36 -0
  783. data/ext/third_party/asio/asio/src/doc/requirements/Executor.qbk +141 -0
  784. data/ext/third_party/asio/asio/src/doc/requirements/GettableSerialPortOption.qbk +33 -0
  785. data/ext/third_party/asio/asio/src/doc/requirements/GettableSocketOption.qbk +67 -0
  786. data/ext/third_party/asio/asio/src/doc/requirements/Handler.qbk +64 -0
  787. data/ext/third_party/asio/asio/src/doc/requirements/HandshakeHandler.qbk +72 -0
  788. data/ext/third_party/asio/asio/src/doc/requirements/InternetProtocol.qbk +47 -0
  789. data/ext/third_party/asio/asio/src/doc/requirements/IoControlCommand.qbk +34 -0
  790. data/ext/third_party/asio/asio/src/doc/requirements/IoObjectService.qbk +62 -0
  791. data/ext/third_party/asio/asio/src/doc/requirements/IteratorConnectHandler.qbk +81 -0
  792. data/ext/third_party/asio/asio/src/doc/requirements/LegacyCompletionHandler.qbk +65 -0
  793. data/ext/third_party/asio/asio/src/doc/requirements/MoveAcceptHandler.qbk +61 -0
  794. data/ext/third_party/asio/asio/src/doc/requirements/MutableBufferSequence.qbk +54 -0
  795. data/ext/third_party/asio/asio/src/doc/requirements/ProtoAllocator.qbk +19 -0
  796. data/ext/third_party/asio/asio/src/doc/requirements/Protocol.qbk +56 -0
  797. data/ext/third_party/asio/asio/src/doc/requirements/RangeConnectHandler.qbk +82 -0
  798. data/ext/third_party/asio/asio/src/doc/requirements/ReadHandler.qbk +79 -0
  799. data/ext/third_party/asio/asio/src/doc/requirements/ResolveHandler.qbk +82 -0
  800. data/ext/third_party/asio/asio/src/doc/requirements/Service.qbk +40 -0
  801. data/ext/third_party/asio/asio/src/doc/requirements/SettableSerialPortOption.qbk +33 -0
  802. data/ext/third_party/asio/asio/src/doc/requirements/SettableSocketOption.qbk +54 -0
  803. data/ext/third_party/asio/asio/src/doc/requirements/ShutdownHandler.qbk +72 -0
  804. data/ext/third_party/asio/asio/src/doc/requirements/SignalHandler.qbk +79 -0
  805. data/ext/third_party/asio/asio/src/doc/requirements/SyncRandomAccessReadDevice.qbk +49 -0
  806. data/ext/third_party/asio/asio/src/doc/requirements/SyncRandomAccessWriteDevice.qbk +49 -0
  807. data/ext/third_party/asio/asio/src/doc/requirements/SyncReadStream.qbk +41 -0
  808. data/ext/third_party/asio/asio/src/doc/requirements/SyncWriteStream.qbk +39 -0
  809. data/ext/third_party/asio/asio/src/doc/requirements/TimeTraits.qbk +72 -0
  810. data/ext/third_party/asio/asio/src/doc/requirements/WaitHandler.qbk +72 -0
  811. data/ext/third_party/asio/asio/src/doc/requirements/WaitTraits.qbk +52 -0
  812. data/ext/third_party/asio/asio/src/doc/requirements/WriteHandler.qbk +79 -0
  813. data/ext/third_party/asio/asio/src/doc/requirements/asynchronous_operations.qbk +300 -0
  814. data/ext/third_party/asio/asio/src/doc/requirements/asynchronous_socket_operations.qbk +39 -0
  815. data/ext/third_party/asio/asio/src/doc/requirements/read_write_operations.qbk +34 -0
  816. data/ext/third_party/asio/asio/src/doc/requirements/synchronous_socket_operations.qbk +37 -0
  817. data/ext/third_party/asio/asio/src/doc/std_exception_dox.txt +7 -0
  818. data/ext/third_party/asio/asio/src/doc/tutorial.dox +226 -0
  819. data/ext/third_party/asio/asio/src/doc/tutorial.qbk +2387 -0
  820. data/ext/third_party/asio/asio/src/doc/tutorial.xsl +437 -0
  821. data/ext/third_party/asio/asio/src/doc/using.qbk +309 -0
  822. data/ext/third_party/asio/asio/tsify.pl +574 -0
  823. data/ext/third_party/gsl/.clang-format +34 -0
  824. data/ext/third_party/gsl/.github/workflows/main.yml +94 -0
  825. data/ext/third_party/gsl/.gitignore +16 -0
  826. data/ext/third_party/gsl/.travis.yml +551 -0
  827. data/ext/third_party/gsl/CMakeLists.txt +119 -0
  828. data/ext/third_party/gsl/CMakeSettings.json +18 -0
  829. data/ext/third_party/gsl/CONTRIBUTING.md +29 -0
  830. data/ext/third_party/gsl/GSL.natvis +98 -0
  831. data/ext/third_party/gsl/LICENSE +21 -0
  832. data/ext/third_party/gsl/README.md +124 -0
  833. data/ext/third_party/gsl/ThirdPartyNotices.txt +41 -0
  834. data/ext/third_party/gsl/appveyor.yml +128 -0
  835. data/ext/third_party/gsl/include/gsl/gsl +29 -0
  836. data/ext/third_party/gsl/include/gsl/gsl_algorithm +61 -0
  837. data/ext/third_party/gsl/include/gsl/gsl_assert +133 -0
  838. data/ext/third_party/gsl/include/gsl/gsl_byte +209 -0
  839. data/ext/third_party/gsl/include/gsl/gsl_util +171 -0
  840. data/ext/third_party/gsl/include/gsl/multi_span +2273 -0
  841. data/ext/third_party/gsl/include/gsl/pointers +301 -0
  842. data/ext/third_party/gsl/include/gsl/span +764 -0
  843. data/ext/third_party/gsl/include/gsl/span_ext +198 -0
  844. data/ext/third_party/gsl/include/gsl/string_span +716 -0
  845. data/ext/third_party/http_parser/.gitignore +30 -0
  846. data/ext/third_party/http_parser/.mailmap +8 -0
  847. data/ext/third_party/http_parser/.travis.yml +13 -0
  848. data/ext/third_party/http_parser/AUTHORS +68 -0
  849. data/ext/third_party/http_parser/LICENSE-MIT +19 -0
  850. data/ext/third_party/http_parser/README.md +246 -0
  851. data/ext/third_party/http_parser/bench.c +128 -0
  852. data/ext/third_party/http_parser/http_parser.c +2568 -0
  853. data/ext/third_party/http_parser/http_parser.gyp +111 -0
  854. data/ext/third_party/http_parser/http_parser.h +447 -0
  855. data/ext/third_party/http_parser/test.c +4600 -0
  856. data/ext/third_party/json/.appveyor.yml +44 -0
  857. data/ext/third_party/json/.clang-format +84 -0
  858. data/ext/third_party/json/.conan/build.py +80 -0
  859. data/ext/third_party/json/.conan/test_package/CMakeLists.txt +12 -0
  860. data/ext/third_party/json/.conan/test_package/conanfile.py +24 -0
  861. data/ext/third_party/json/.conan/test_package/test_package.cpp +16 -0
  862. data/ext/third_party/json/.gitignore +3 -0
  863. data/ext/third_party/json/.travis.yml +173 -0
  864. data/ext/third_party/json/CMakeLists.txt +44 -0
  865. data/ext/third_party/json/LICENSE +21 -0
  866. data/ext/third_party/json/LICENSE.double-conversion +32 -0
  867. data/ext/third_party/json/LICENSE.itoa +19 -0
  868. data/ext/third_party/json/LICENSE.ryu +201 -0
  869. data/ext/third_party/json/README.md +149 -0
  870. data/ext/third_party/json/conanfile.py +28 -0
  871. data/ext/third_party/json/include/tao/json.hpp +45 -0
  872. data/ext/third_party/json/include/tao/json/basic_value.hpp +941 -0
  873. data/ext/third_party/json/include/tao/json/binary.hpp +103 -0
  874. data/ext/third_party/json/include/tao/json/binary_view.hpp +31 -0
  875. data/ext/third_party/json/include/tao/json/binding.hpp +71 -0
  876. data/ext/third_party/json/include/tao/json/binding/constant.hpp +232 -0
  877. data/ext/third_party/json/include/tao/json/binding/element.hpp +182 -0
  878. data/ext/third_party/json/include/tao/json/binding/factory.hpp +250 -0
  879. data/ext/third_party/json/include/tao/json/binding/for_nothing_value.hpp +17 -0
  880. data/ext/third_party/json/include/tao/json/binding/for_unknown_key.hpp +17 -0
  881. data/ext/third_party/json/include/tao/json/binding/inherit.hpp +14 -0
  882. data/ext/third_party/json/include/tao/json/binding/internal/array.hpp +103 -0
  883. data/ext/third_party/json/include/tao/json/binding/internal/inherit.hpp +45 -0
  884. data/ext/third_party/json/include/tao/json/binding/internal/object.hpp +267 -0
  885. data/ext/third_party/json/include/tao/json/binding/internal/type_key.hpp +54 -0
  886. data/ext/third_party/json/include/tao/json/binding/member.hpp +32 -0
  887. data/ext/third_party/json/include/tao/json/binding/member_kind.hpp +17 -0
  888. data/ext/third_party/json/include/tao/json/binding/versions.hpp +127 -0
  889. data/ext/third_party/json/include/tao/json/cbor.hpp +18 -0
  890. data/ext/third_party/json/include/tao/json/cbor/consume_file.hpp +34 -0
  891. data/ext/third_party/json/include/tao/json/cbor/consume_string.hpp +32 -0
  892. data/ext/third_party/json/include/tao/json/cbor/events/from_file.hpp +27 -0
  893. data/ext/third_party/json/include/tao/json/cbor/events/from_input.hpp +43 -0
  894. data/ext/third_party/json/include/tao/json/cbor/events/from_string.hpp +37 -0
  895. data/ext/third_party/json/include/tao/json/cbor/events/to_stream.hpp +161 -0
  896. data/ext/third_party/json/include/tao/json/cbor/events/to_string.hpp +31 -0
  897. data/ext/third_party/json/include/tao/json/cbor/from_file.hpp +33 -0
  898. data/ext/third_party/json/include/tao/json/cbor/from_input.hpp +33 -0
  899. data/ext/third_party/json/include/tao/json/cbor/from_string.hpp +32 -0
  900. data/ext/third_party/json/include/tao/json/cbor/internal/grammar.hpp +417 -0
  901. data/ext/third_party/json/include/tao/json/cbor/internal/major.hpp +28 -0
  902. data/ext/third_party/json/include/tao/json/cbor/parts_parser.hpp +392 -0
  903. data/ext/third_party/json/include/tao/json/cbor/to_stream.hpp +27 -0
  904. data/ext/third_party/json/include/tao/json/cbor/to_string.hpp +28 -0
  905. data/ext/third_party/json/include/tao/json/consume.hpp +43 -0
  906. data/ext/third_party/json/include/tao/json/consume_file.hpp +33 -0
  907. data/ext/third_party/json/include/tao/json/consume_string.hpp +31 -0
  908. data/ext/third_party/json/include/tao/json/contrib/array_traits.hpp +43 -0
  909. data/ext/third_party/json/include/tao/json/contrib/deque_traits.hpp +41 -0
  910. data/ext/third_party/json/include/tao/json/contrib/diff.hpp +106 -0
  911. data/ext/third_party/json/include/tao/json/contrib/get.hpp +152 -0
  912. data/ext/third_party/json/include/tao/json/contrib/internal/array_traits.hpp +92 -0
  913. data/ext/third_party/json/include/tao/json/contrib/internal/indirect_traits.hpp +69 -0
  914. data/ext/third_party/json/include/tao/json/contrib/internal/object_traits.hpp +105 -0
  915. data/ext/third_party/json/include/tao/json/contrib/internal/type_traits.hpp +36 -0
  916. data/ext/third_party/json/include/tao/json/contrib/list_traits.hpp +41 -0
  917. data/ext/third_party/json/include/tao/json/contrib/map_traits.hpp +43 -0
  918. data/ext/third_party/json/include/tao/json/contrib/multimap_traits.hpp +43 -0
  919. data/ext/third_party/json/include/tao/json/contrib/multiset_traits.hpp +41 -0
  920. data/ext/third_party/json/include/tao/json/contrib/pair_traits.hpp +21 -0
  921. data/ext/third_party/json/include/tao/json/contrib/patch.hpp +105 -0
  922. data/ext/third_party/json/include/tao/json/contrib/pointer_traits.hpp +59 -0
  923. data/ext/third_party/json/include/tao/json/contrib/position.hpp +166 -0
  924. data/ext/third_party/json/include/tao/json/contrib/reference.hpp +115 -0
  925. data/ext/third_party/json/include/tao/json/contrib/schema.hpp +1851 -0
  926. data/ext/third_party/json/include/tao/json/contrib/set_traits.hpp +41 -0
  927. data/ext/third_party/json/include/tao/json/contrib/shared_ptr_traits.hpp +90 -0
  928. data/ext/third_party/json/include/tao/json/contrib/traits.hpp +121 -0
  929. data/ext/third_party/json/include/tao/json/contrib/tuple_traits.hpp +51 -0
  930. data/ext/third_party/json/include/tao/json/contrib/unique_ptr_traits.hpp +89 -0
  931. data/ext/third_party/json/include/tao/json/contrib/unordered_map_traits.hpp +43 -0
  932. data/ext/third_party/json/include/tao/json/contrib/unordered_set_traits.hpp +41 -0
  933. data/ext/third_party/json/include/tao/json/contrib/vector_bool_traits.hpp +45 -0
  934. data/ext/third_party/json/include/tao/json/contrib/vector_traits.hpp +51 -0
  935. data/ext/third_party/json/include/tao/json/events.hpp +47 -0
  936. data/ext/third_party/json/include/tao/json/events/apply.hpp +20 -0
  937. data/ext/third_party/json/include/tao/json/events/binary_to_base64.hpp +26 -0
  938. data/ext/third_party/json/include/tao/json/events/binary_to_base64url.hpp +28 -0
  939. data/ext/third_party/json/include/tao/json/events/binary_to_exception.hpp +27 -0
  940. data/ext/third_party/json/include/tao/json/events/binary_to_hex.hpp +26 -0
  941. data/ext/third_party/json/include/tao/json/events/compare.hpp +265 -0
  942. data/ext/third_party/json/include/tao/json/events/debug.hpp +145 -0
  943. data/ext/third_party/json/include/tao/json/events/discard.hpp +43 -0
  944. data/ext/third_party/json/include/tao/json/events/from_file.hpp +28 -0
  945. data/ext/third_party/json/include/tao/json/events/from_input.hpp +45 -0
  946. data/ext/third_party/json/include/tao/json/events/from_stream.hpp +33 -0
  947. data/ext/third_party/json/include/tao/json/events/from_string.hpp +38 -0
  948. data/ext/third_party/json/include/tao/json/events/from_value.hpp +202 -0
  949. data/ext/third_party/json/include/tao/json/events/hash.hpp +174 -0
  950. data/ext/third_party/json/include/tao/json/events/invalid_string_to_binary.hpp +50 -0
  951. data/ext/third_party/json/include/tao/json/events/invalid_string_to_exception.hpp +49 -0
  952. data/ext/third_party/json/include/tao/json/events/invalid_string_to_hex.hpp +48 -0
  953. data/ext/third_party/json/include/tao/json/events/key_camel_case_to_snake_case.hpp +62 -0
  954. data/ext/third_party/json/include/tao/json/events/key_snake_case_to_camel_case.hpp +57 -0
  955. data/ext/third_party/json/include/tao/json/events/limit_nesting_depth.hpp +82 -0
  956. data/ext/third_party/json/include/tao/json/events/limit_value_count.hpp +46 -0
  957. data/ext/third_party/json/include/tao/json/events/non_finite_to_exception.hpp +31 -0
  958. data/ext/third_party/json/include/tao/json/events/non_finite_to_null.hpp +32 -0
  959. data/ext/third_party/json/include/tao/json/events/non_finite_to_string.hpp +40 -0
  960. data/ext/third_party/json/include/tao/json/events/prefer_signed.hpp +32 -0
  961. data/ext/third_party/json/include/tao/json/events/prefer_unsigned.hpp +32 -0
  962. data/ext/third_party/json/include/tao/json/events/produce.hpp +22 -0
  963. data/ext/third_party/json/include/tao/json/events/ref.hpp +111 -0
  964. data/ext/third_party/json/include/tao/json/events/statistics.hpp +112 -0
  965. data/ext/third_party/json/include/tao/json/events/tee.hpp +386 -0
  966. data/ext/third_party/json/include/tao/json/events/to_pretty_stream.hpp +172 -0
  967. data/ext/third_party/json/include/tao/json/events/to_stream.hpp +142 -0
  968. data/ext/third_party/json/include/tao/json/events/to_string.hpp +33 -0
  969. data/ext/third_party/json/include/tao/json/events/to_value.hpp +137 -0
  970. data/ext/third_party/json/include/tao/json/events/transformer.hpp +70 -0
  971. data/ext/third_party/json/include/tao/json/events/validate_event_order.hpp +411 -0
  972. data/ext/third_party/json/include/tao/json/events/validate_keys.hpp +51 -0
  973. data/ext/third_party/json/include/tao/json/events/virtual_base.hpp +192 -0
  974. data/ext/third_party/json/include/tao/json/events/virtual_ref.hpp +170 -0
  975. data/ext/third_party/json/include/tao/json/external/double.hpp +1313 -0
  976. data/ext/third_party/json/include/tao/json/external/itoa.hpp +149 -0
  977. data/ext/third_party/json/include/tao/json/external/pegtl.hpp +53 -0
  978. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/analyze_cycles.hpp +127 -0
  979. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/counted.hpp +23 -0
  980. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/generic.hpp +31 -0
  981. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/grammar_info.hpp +32 -0
  982. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/insert_guard.hpp +51 -0
  983. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/insert_rules.hpp +25 -0
  984. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/rule_info.hpp +29 -0
  985. data/ext/third_party/json/include/tao/json/external/pegtl/analysis/rule_type.hpp +21 -0
  986. data/ext/third_party/json/include/tao/json/external/pegtl/analyze.hpp +21 -0
  987. data/ext/third_party/json/include/tao/json/external/pegtl/apply_mode.hpp +19 -0
  988. data/ext/third_party/json/include/tao/json/external/pegtl/argv_input.hpp +51 -0
  989. data/ext/third_party/json/include/tao/json/external/pegtl/ascii.hpp +67 -0
  990. data/ext/third_party/json/include/tao/json/external/pegtl/buffer_input.hpp +212 -0
  991. data/ext/third_party/json/include/tao/json/external/pegtl/change_action.hpp +38 -0
  992. data/ext/third_party/json/include/tao/json/external/pegtl/change_action_and_state.hpp +53 -0
  993. data/ext/third_party/json/include/tao/json/external/pegtl/change_action_and_states.hpp +62 -0
  994. data/ext/third_party/json/include/tao/json/external/pegtl/change_control.hpp +36 -0
  995. data/ext/third_party/json/include/tao/json/external/pegtl/change_state.hpp +50 -0
  996. data/ext/third_party/json/include/tao/json/external/pegtl/change_states.hpp +61 -0
  997. data/ext/third_party/json/include/tao/json/external/pegtl/config.hpp +11 -0
  998. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/abnf.hpp +35 -0
  999. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/alphabet.hpp +67 -0
  1000. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/counter.hpp +54 -0
  1001. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/http.hpp +253 -0
  1002. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/internal.hpp +68 -0
  1003. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf16.hpp +200 -0
  1004. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf32.hpp +200 -0
  1005. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/icu/utf8.hpp +105 -0
  1006. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/if_then.hpp +55 -0
  1007. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/integer.hpp +446 -0
  1008. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/json.hpp +88 -0
  1009. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/json_pointer.hpp +33 -0
  1010. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/parse_tree.hpp +561 -0
  1011. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/parse_tree_to_dot.hpp +104 -0
  1012. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/raw_string.hpp +225 -0
  1013. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/remove_first_state.hpp +86 -0
  1014. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/rep_one_min_max.hpp +62 -0
  1015. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/rep_string.hpp +44 -0
  1016. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/to_string.hpp +38 -0
  1017. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/tracer.hpp +158 -0
  1018. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/unescape.hpp +199 -0
  1019. data/ext/third_party/json/include/tao/json/external/pegtl/contrib/uri.hpp +106 -0
  1020. data/ext/third_party/json/include/tao/json/external/pegtl/cstream_input.hpp +33 -0
  1021. data/ext/third_party/json/include/tao/json/external/pegtl/disable_action.hpp +35 -0
  1022. data/ext/third_party/json/include/tao/json/external/pegtl/discard_input.hpp +37 -0
  1023. data/ext/third_party/json/include/tao/json/external/pegtl/discard_input_on_failure.hpp +39 -0
  1024. data/ext/third_party/json/include/tao/json/external/pegtl/discard_input_on_success.hpp +39 -0
  1025. data/ext/third_party/json/include/tao/json/external/pegtl/enable_action.hpp +35 -0
  1026. data/ext/third_party/json/include/tao/json/external/pegtl/eol.hpp +37 -0
  1027. data/ext/third_party/json/include/tao/json/external/pegtl/eol_pair.hpp +18 -0
  1028. data/ext/third_party/json/include/tao/json/external/pegtl/file_input.hpp +44 -0
  1029. data/ext/third_party/json/include/tao/json/external/pegtl/internal/action.hpp +44 -0
  1030. data/ext/third_party/json/include/tao/json/external/pegtl/internal/action_input.hpp +107 -0
  1031. data/ext/third_party/json/include/tao/json/external/pegtl/internal/alnum.hpp +18 -0
  1032. data/ext/third_party/json/include/tao/json/external/pegtl/internal/alpha.hpp +18 -0
  1033. data/ext/third_party/json/include/tao/json/external/pegtl/internal/always_false.hpp +21 -0
  1034. data/ext/third_party/json/include/tao/json/external/pegtl/internal/any.hpp +58 -0
  1035. data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply.hpp +53 -0
  1036. data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply0.hpp +50 -0
  1037. data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply0_single.hpp +34 -0
  1038. data/ext/third_party/json/include/tao/json/external/pegtl/internal/apply_single.hpp +34 -0
  1039. data/ext/third_party/json/include/tao/json/external/pegtl/internal/at.hpp +53 -0
  1040. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bof.hpp +31 -0
  1041. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bol.hpp +31 -0
  1042. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bump.hpp +45 -0
  1043. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bump_help.hpp +29 -0
  1044. data/ext/third_party/json/include/tao/json/external/pegtl/internal/bytes.hpp +36 -0
  1045. data/ext/third_party/json/include/tao/json/external/pegtl/internal/control.hpp +44 -0
  1046. data/ext/third_party/json/include/tao/json/external/pegtl/internal/cr_crlf_eol.hpp +32 -0
  1047. data/ext/third_party/json/include/tao/json/external/pegtl/internal/cr_eol.hpp +32 -0
  1048. data/ext/third_party/json/include/tao/json/external/pegtl/internal/crlf_eol.hpp +32 -0
  1049. data/ext/third_party/json/include/tao/json/external/pegtl/internal/cstream_reader.hpp +49 -0
  1050. data/ext/third_party/json/include/tao/json/external/pegtl/internal/cstring_reader.hpp +40 -0
  1051. data/ext/third_party/json/include/tao/json/external/pegtl/internal/demangle.hpp +140 -0
  1052. data/ext/third_party/json/include/tao/json/external/pegtl/internal/disable.hpp +44 -0
  1053. data/ext/third_party/json/include/tao/json/external/pegtl/internal/discard.hpp +33 -0
  1054. data/ext/third_party/json/include/tao/json/external/pegtl/internal/dusel_mode.hpp +23 -0
  1055. data/ext/third_party/json/include/tao/json/external/pegtl/internal/duseltronik.hpp +187 -0
  1056. data/ext/third_party/json/include/tao/json/external/pegtl/internal/enable.hpp +44 -0
  1057. data/ext/third_party/json/include/tao/json/external/pegtl/internal/endian.hpp +62 -0
  1058. data/ext/third_party/json/include/tao/json/external/pegtl/internal/endian_gcc.hpp +206 -0
  1059. data/ext/third_party/json/include/tao/json/external/pegtl/internal/endian_win.hpp +106 -0
  1060. data/ext/third_party/json/include/tao/json/external/pegtl/internal/eof.hpp +31 -0
  1061. data/ext/third_party/json/include/tao/json/external/pegtl/internal/eol.hpp +31 -0
  1062. data/ext/third_party/json/include/tao/json/external/pegtl/internal/eolf.hpp +32 -0
  1063. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_mapper_posix.hpp +83 -0
  1064. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_mapper_win32.hpp +219 -0
  1065. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_opener.hpp +72 -0
  1066. data/ext/third_party/json/include/tao/json/external/pegtl/internal/file_reader.hpp +114 -0
  1067. data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_apply.hpp +25 -0
  1068. data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_apply0.hpp +25 -0
  1069. data/ext/third_party/json/include/tao/json/external/pegtl/internal/has_match.hpp +56 -0
  1070. data/ext/third_party/json/include/tao/json/external/pegtl/internal/identifier.hpp +22 -0
  1071. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_apply.hpp +53 -0
  1072. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_must.hpp +48 -0
  1073. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_must_else.hpp +19 -0
  1074. data/ext/third_party/json/include/tao/json/external/pegtl/internal/if_then_else.hpp +51 -0
  1075. data/ext/third_party/json/include/tao/json/external/pegtl/internal/input_pair.hpp +29 -0
  1076. data/ext/third_party/json/include/tao/json/external/pegtl/internal/istream_reader.hpp +40 -0
  1077. data/ext/third_party/json/include/tao/json/external/pegtl/internal/istring.hpp +72 -0
  1078. data/ext/third_party/json/include/tao/json/external/pegtl/internal/iterator.hpp +52 -0
  1079. data/ext/third_party/json/include/tao/json/external/pegtl/internal/lf_crlf_eol.hpp +37 -0
  1080. data/ext/third_party/json/include/tao/json/external/pegtl/internal/lf_eol.hpp +32 -0
  1081. data/ext/third_party/json/include/tao/json/external/pegtl/internal/list.hpp +19 -0
  1082. data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_must.hpp +20 -0
  1083. data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_tail.hpp +20 -0
  1084. data/ext/third_party/json/include/tao/json/external/pegtl/internal/list_tail_pad.hpp +22 -0
  1085. data/ext/third_party/json/include/tao/json/external/pegtl/internal/marker.hpp +82 -0
  1086. data/ext/third_party/json/include/tao/json/external/pegtl/internal/missing_apply.hpp +25 -0
  1087. data/ext/third_party/json/include/tao/json/external/pegtl/internal/missing_apply0.hpp +23 -0
  1088. data/ext/third_party/json/include/tao/json/external/pegtl/internal/must.hpp +72 -0
  1089. data/ext/third_party/json/include/tao/json/external/pegtl/internal/not_at.hpp +53 -0
  1090. data/ext/third_party/json/include/tao/json/external/pegtl/internal/one.hpp +44 -0
  1091. data/ext/third_party/json/include/tao/json/external/pegtl/internal/opt.hpp +57 -0
  1092. data/ext/third_party/json/include/tao/json/external/pegtl/internal/pad.hpp +19 -0
  1093. data/ext/third_party/json/include/tao/json/external/pegtl/internal/pad_opt.hpp +20 -0
  1094. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_char.hpp +32 -0
  1095. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_mask_uint.hpp +54 -0
  1096. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_mask_uint8.hpp +34 -0
  1097. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_uint.hpp +45 -0
  1098. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_uint8.hpp +33 -0
  1099. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_utf16.hpp +54 -0
  1100. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_utf32.hpp +43 -0
  1101. data/ext/third_party/json/include/tao/json/external/pegtl/internal/peek_utf8.hpp +90 -0
  1102. data/ext/third_party/json/include/tao/json/external/pegtl/internal/pegtl_string.hpp +90 -0
  1103. data/ext/third_party/json/include/tao/json/external/pegtl/internal/plus.hpp +53 -0
  1104. data/ext/third_party/json/include/tao/json/external/pegtl/internal/raise.hpp +53 -0
  1105. data/ext/third_party/json/include/tao/json/external/pegtl/internal/range.hpp +51 -0
  1106. data/ext/third_party/json/include/tao/json/external/pegtl/internal/ranges.hpp +93 -0
  1107. data/ext/third_party/json/include/tao/json/external/pegtl/internal/read_uint.hpp +77 -0
  1108. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rematch.hpp +69 -0
  1109. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep.hpp +66 -0
  1110. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_min.hpp +20 -0
  1111. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_min_max.hpp +79 -0
  1112. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rep_opt.hpp +46 -0
  1113. data/ext/third_party/json/include/tao/json/external/pegtl/internal/require.hpp +42 -0
  1114. data/ext/third_party/json/include/tao/json/external/pegtl/internal/result_on_found.hpp +19 -0
  1115. data/ext/third_party/json/include/tao/json/external/pegtl/internal/rules.hpp +61 -0
  1116. data/ext/third_party/json/include/tao/json/external/pegtl/internal/seq.hpp +73 -0
  1117. data/ext/third_party/json/include/tao/json/external/pegtl/internal/skip_control.hpp +25 -0
  1118. data/ext/third_party/json/include/tao/json/external/pegtl/internal/sor.hpp +60 -0
  1119. data/ext/third_party/json/include/tao/json/external/pegtl/internal/star.hpp +47 -0
  1120. data/ext/third_party/json/include/tao/json/external/pegtl/internal/star_must.hpp +19 -0
  1121. data/ext/third_party/json/include/tao/json/external/pegtl/internal/state.hpp +49 -0
  1122. data/ext/third_party/json/include/tao/json/external/pegtl/internal/string.hpp +58 -0
  1123. data/ext/third_party/json/include/tao/json/external/pegtl/internal/trivial.hpp +32 -0
  1124. data/ext/third_party/json/include/tao/json/external/pegtl/internal/try_catch_type.hpp +64 -0
  1125. data/ext/third_party/json/include/tao/json/external/pegtl/internal/until.hpp +84 -0
  1126. data/ext/third_party/json/include/tao/json/external/pegtl/istream_input.hpp +33 -0
  1127. data/ext/third_party/json/include/tao/json/external/pegtl/match.hpp +73 -0
  1128. data/ext/third_party/json/include/tao/json/external/pegtl/memory_input.hpp +381 -0
  1129. data/ext/third_party/json/include/tao/json/external/pegtl/mmap_input.hpp +79 -0
  1130. data/ext/third_party/json/include/tao/json/external/pegtl/normal.hpp +87 -0
  1131. data/ext/third_party/json/include/tao/json/external/pegtl/nothing.hpp +20 -0
  1132. data/ext/third_party/json/include/tao/json/external/pegtl/parse.hpp +53 -0
  1133. data/ext/third_party/json/include/tao/json/external/pegtl/parse_error.hpp +69 -0
  1134. data/ext/third_party/json/include/tao/json/external/pegtl/position.hpp +75 -0
  1135. data/ext/third_party/json/include/tao/json/external/pegtl/read_input.hpp +74 -0
  1136. data/ext/third_party/json/include/tao/json/external/pegtl/require_apply.hpp +16 -0
  1137. data/ext/third_party/json/include/tao/json/external/pegtl/require_apply0.hpp +16 -0
  1138. data/ext/third_party/json/include/tao/json/external/pegtl/rewind_mode.hpp +20 -0
  1139. data/ext/third_party/json/include/tao/json/external/pegtl/rules.hpp +67 -0
  1140. data/ext/third_party/json/include/tao/json/external/pegtl/string_input.hpp +66 -0
  1141. data/ext/third_party/json/include/tao/json/external/pegtl/tracking_mode.hpp +19 -0
  1142. data/ext/third_party/json/include/tao/json/external/pegtl/uint16.hpp +62 -0
  1143. data/ext/third_party/json/include/tao/json/external/pegtl/uint32.hpp +62 -0
  1144. data/ext/third_party/json/include/tao/json/external/pegtl/uint64.hpp +63 -0
  1145. data/ext/third_party/json/include/tao/json/external/pegtl/uint8.hpp +36 -0
  1146. data/ext/third_party/json/include/tao/json/external/pegtl/utf16.hpp +49 -0
  1147. data/ext/third_party/json/include/tao/json/external/pegtl/utf32.hpp +49 -0
  1148. data/ext/third_party/json/include/tao/json/external/pegtl/utf8.hpp +28 -0
  1149. data/ext/third_party/json/include/tao/json/external/pegtl/version.hpp +13 -0
  1150. data/ext/third_party/json/include/tao/json/external/ryu.hpp +1216 -0
  1151. data/ext/third_party/json/include/tao/json/forward.hpp +44 -0
  1152. data/ext/third_party/json/include/tao/json/from_file.hpp +32 -0
  1153. data/ext/third_party/json/include/tao/json/from_input.hpp +32 -0
  1154. data/ext/third_party/json/include/tao/json/from_stream.hpp +45 -0
  1155. data/ext/third_party/json/include/tao/json/from_string.hpp +41 -0
  1156. data/ext/third_party/json/include/tao/json/internal/action.hpp +268 -0
  1157. data/ext/third_party/json/include/tao/json/internal/base64.hpp +55 -0
  1158. data/ext/third_party/json/include/tao/json/internal/base64url.hpp +53 -0
  1159. data/ext/third_party/json/include/tao/json/internal/endian.hpp +60 -0
  1160. data/ext/third_party/json/include/tao/json/internal/endian_gcc.hpp +198 -0
  1161. data/ext/third_party/json/include/tao/json/internal/endian_win.hpp +103 -0
  1162. data/ext/third_party/json/include/tao/json/internal/errors.hpp +85 -0
  1163. data/ext/third_party/json/include/tao/json/internal/escape.hpp +77 -0
  1164. data/ext/third_party/json/include/tao/json/internal/format.hpp +59 -0
  1165. data/ext/third_party/json/include/tao/json/internal/grammar.hpp +229 -0
  1166. data/ext/third_party/json/include/tao/json/internal/hexdump.hpp +31 -0
  1167. data/ext/third_party/json/include/tao/json/internal/identity.hpp +22 -0
  1168. data/ext/third_party/json/include/tao/json/internal/number_state.hpp +80 -0
  1169. data/ext/third_party/json/include/tao/json/internal/number_traits.hpp +267 -0
  1170. data/ext/third_party/json/include/tao/json/internal/pair.hpp +42 -0
  1171. data/ext/third_party/json/include/tao/json/internal/parse_util.hpp +112 -0
  1172. data/ext/third_party/json/include/tao/json/internal/sha256.hpp +218 -0
  1173. data/ext/third_party/json/include/tao/json/internal/single.hpp +40 -0
  1174. data/ext/third_party/json/include/tao/json/internal/string_t.hpp +35 -0
  1175. data/ext/third_party/json/include/tao/json/internal/type_traits.hpp +113 -0
  1176. data/ext/third_party/json/include/tao/json/internal/unescape_action.hpp +24 -0
  1177. data/ext/third_party/json/include/tao/json/internal/uri_fragment.hpp +182 -0
  1178. data/ext/third_party/json/include/tao/json/jaxn.hpp +19 -0
  1179. data/ext/third_party/json/include/tao/json/jaxn/consume_file.hpp +34 -0
  1180. data/ext/third_party/json/include/tao/json/jaxn/consume_string.hpp +32 -0
  1181. data/ext/third_party/json/include/tao/json/jaxn/events/from_file.hpp +28 -0
  1182. data/ext/third_party/json/include/tao/json/jaxn/events/from_input.hpp +45 -0
  1183. data/ext/third_party/json/include/tao/json/jaxn/events/from_stream.hpp +33 -0
  1184. data/ext/third_party/json/include/tao/json/jaxn/events/from_string.hpp +39 -0
  1185. data/ext/third_party/json/include/tao/json/jaxn/events/to_pretty_stream.hpp +69 -0
  1186. data/ext/third_party/json/include/tao/json/jaxn/events/to_stream.hpp +67 -0
  1187. data/ext/third_party/json/include/tao/json/jaxn/events/to_string.hpp +33 -0
  1188. data/ext/third_party/json/include/tao/json/jaxn/from_file.hpp +33 -0
  1189. data/ext/third_party/json/include/tao/json/jaxn/from_input.hpp +33 -0
  1190. data/ext/third_party/json/include/tao/json/jaxn/from_stream.hpp +48 -0
  1191. data/ext/third_party/json/include/tao/json/jaxn/from_string.hpp +42 -0
  1192. data/ext/third_party/json/include/tao/json/jaxn/internal/action.hpp +355 -0
  1193. data/ext/third_party/json/include/tao/json/jaxn/internal/bunescape_action.hpp +114 -0
  1194. data/ext/third_party/json/include/tao/json/jaxn/internal/errors.hpp +108 -0
  1195. data/ext/third_party/json/include/tao/json/jaxn/internal/grammar.hpp +375 -0
  1196. data/ext/third_party/json/include/tao/json/jaxn/internal/integer.hpp +256 -0
  1197. data/ext/third_party/json/include/tao/json/jaxn/internal/unescape_action.hpp +28 -0
  1198. data/ext/third_party/json/include/tao/json/jaxn/is_identifier.hpp +27 -0
  1199. data/ext/third_party/json/include/tao/json/jaxn/parts_parser.hpp +263 -0
  1200. data/ext/third_party/json/include/tao/json/jaxn/to_stream.hpp +36 -0
  1201. data/ext/third_party/json/include/tao/json/jaxn/to_string.hpp +33 -0
  1202. data/ext/third_party/json/include/tao/json/message_extension.hpp +49 -0
  1203. data/ext/third_party/json/include/tao/json/msgpack.hpp +18 -0
  1204. data/ext/third_party/json/include/tao/json/msgpack/consume_file.hpp +34 -0
  1205. data/ext/third_party/json/include/tao/json/msgpack/consume_string.hpp +32 -0
  1206. data/ext/third_party/json/include/tao/json/msgpack/events/from_file.hpp +27 -0
  1207. data/ext/third_party/json/include/tao/json/msgpack/events/from_input.hpp +43 -0
  1208. data/ext/third_party/json/include/tao/json/msgpack/events/from_string.hpp +37 -0
  1209. data/ext/third_party/json/include/tao/json/msgpack/events/to_stream.hpp +214 -0
  1210. data/ext/third_party/json/include/tao/json/msgpack/events/to_string.hpp +31 -0
  1211. data/ext/third_party/json/include/tao/json/msgpack/from_file.hpp +33 -0
  1212. data/ext/third_party/json/include/tao/json/msgpack/from_input.hpp +33 -0
  1213. data/ext/third_party/json/include/tao/json/msgpack/from_string.hpp +32 -0
  1214. data/ext/third_party/json/include/tao/json/msgpack/internal/format.hpp +57 -0
  1215. data/ext/third_party/json/include/tao/json/msgpack/internal/grammar.hpp +249 -0
  1216. data/ext/third_party/json/include/tao/json/msgpack/parts_parser.hpp +311 -0
  1217. data/ext/third_party/json/include/tao/json/msgpack/to_stream.hpp +27 -0
  1218. data/ext/third_party/json/include/tao/json/msgpack/to_string.hpp +28 -0
  1219. data/ext/third_party/json/include/tao/json/operators.hpp +494 -0
  1220. data/ext/third_party/json/include/tao/json/parts_parser.hpp +306 -0
  1221. data/ext/third_party/json/include/tao/json/pointer.hpp +432 -0
  1222. data/ext/third_party/json/include/tao/json/produce.hpp +61 -0
  1223. data/ext/third_party/json/include/tao/json/self_contained.hpp +143 -0
  1224. data/ext/third_party/json/include/tao/json/span.hpp +568 -0
  1225. data/ext/third_party/json/include/tao/json/stream.hpp +38 -0
  1226. data/ext/third_party/json/include/tao/json/to_stream.hpp +42 -0
  1227. data/ext/third_party/json/include/tao/json/to_string.hpp +23 -0
  1228. data/ext/third_party/json/include/tao/json/traits.hpp +971 -0
  1229. data/ext/third_party/json/include/tao/json/type.hpp +112 -0
  1230. data/ext/third_party/json/include/tao/json/ubjson.hpp +18 -0
  1231. data/ext/third_party/json/include/tao/json/ubjson/consume_file.hpp +34 -0
  1232. data/ext/third_party/json/include/tao/json/ubjson/consume_string.hpp +32 -0
  1233. data/ext/third_party/json/include/tao/json/ubjson/events/from_file.hpp +27 -0
  1234. data/ext/third_party/json/include/tao/json/ubjson/events/from_input.hpp +43 -0
  1235. data/ext/third_party/json/include/tao/json/ubjson/events/from_string.hpp +37 -0
  1236. data/ext/third_party/json/include/tao/json/ubjson/events/to_stream.hpp +174 -0
  1237. data/ext/third_party/json/include/tao/json/ubjson/events/to_string.hpp +31 -0
  1238. data/ext/third_party/json/include/tao/json/ubjson/from_file.hpp +33 -0
  1239. data/ext/third_party/json/include/tao/json/ubjson/from_input.hpp +33 -0
  1240. data/ext/third_party/json/include/tao/json/ubjson/from_string.hpp +32 -0
  1241. data/ext/third_party/json/include/tao/json/ubjson/internal/grammar.hpp +413 -0
  1242. data/ext/third_party/json/include/tao/json/ubjson/internal/marker.hpp +46 -0
  1243. data/ext/third_party/json/include/tao/json/ubjson/parts_parser.hpp +393 -0
  1244. data/ext/third_party/json/include/tao/json/ubjson/to_stream.hpp +28 -0
  1245. data/ext/third_party/json/include/tao/json/ubjson/to_string.hpp +29 -0
  1246. data/ext/third_party/json/include/tao/json/utf8.hpp +57 -0
  1247. data/ext/third_party/json/include/tao/json/value.hpp +12 -0
  1248. data/ext/third_party/snappy/.appveyor.yml +36 -0
  1249. data/ext/third_party/snappy/.gitignore +8 -0
  1250. data/ext/third_party/snappy/.travis.yml +98 -0
  1251. data/ext/third_party/snappy/AUTHORS +1 -0
  1252. data/ext/third_party/snappy/CMakeLists.txt +345 -0
  1253. data/ext/third_party/snappy/CONTRIBUTING.md +26 -0
  1254. data/ext/third_party/snappy/COPYING +54 -0
  1255. data/ext/third_party/snappy/NEWS +188 -0
  1256. data/ext/third_party/snappy/README.md +148 -0
  1257. data/ext/third_party/snappy/cmake/SnappyConfig.cmake.in +33 -0
  1258. data/ext/third_party/snappy/cmake/config.h.in +59 -0
  1259. data/ext/third_party/snappy/docs/README.md +72 -0
  1260. data/ext/third_party/snappy/format_description.txt +110 -0
  1261. data/ext/third_party/snappy/framing_format.txt +135 -0
  1262. data/ext/third_party/snappy/snappy-c.cc +90 -0
  1263. data/ext/third_party/snappy/snappy-c.h +138 -0
  1264. data/ext/third_party/snappy/snappy-internal.h +315 -0
  1265. data/ext/third_party/snappy/snappy-sinksource.cc +121 -0
  1266. data/ext/third_party/snappy/snappy-sinksource.h +182 -0
  1267. data/ext/third_party/snappy/snappy-stubs-internal.cc +42 -0
  1268. data/ext/third_party/snappy/snappy-stubs-internal.h +493 -0
  1269. data/ext/third_party/snappy/snappy-stubs-public.h.in +63 -0
  1270. data/ext/third_party/snappy/snappy-test.cc +613 -0
  1271. data/ext/third_party/snappy/snappy-test.h +526 -0
  1272. data/ext/third_party/snappy/snappy.cc +1770 -0
  1273. data/ext/third_party/snappy/snappy.h +209 -0
  1274. data/ext/third_party/snappy/snappy_compress_fuzzer.cc +60 -0
  1275. data/ext/third_party/snappy/snappy_uncompress_fuzzer.cc +58 -0
  1276. data/ext/third_party/snappy/snappy_unittest.cc +1512 -0
  1277. data/ext/third_party/spdlog/.clang-format +108 -0
  1278. data/ext/third_party/spdlog/.clang-tidy +54 -0
  1279. data/ext/third_party/spdlog/.gitattributes +1 -0
  1280. data/ext/third_party/spdlog/.gitignore +83 -0
  1281. data/ext/third_party/spdlog/.travis.yml +112 -0
  1282. data/ext/third_party/spdlog/CMakeLists.txt +324 -0
  1283. data/ext/third_party/spdlog/INSTALL +24 -0
  1284. data/ext/third_party/spdlog/LICENSE +26 -0
  1285. data/ext/third_party/spdlog/README.md +423 -0
  1286. data/ext/third_party/spdlog/appveyor.yml +51 -0
  1287. data/ext/third_party/spdlog/cmake/ide.cmake +18 -0
  1288. data/ext/third_party/spdlog/cmake/pch.h.in +258 -0
  1289. data/ext/third_party/spdlog/cmake/spdlog.pc.in +13 -0
  1290. data/ext/third_party/spdlog/cmake/spdlogCPack.cmake +46 -0
  1291. data/ext/third_party/spdlog/cmake/spdlogConfig.cmake.in +15 -0
  1292. data/ext/third_party/spdlog/cmake/utils.cmake +61 -0
  1293. data/ext/third_party/spdlog/cmake/version.rc.in +42 -0
  1294. data/ext/third_party/spdlog/include/spdlog/async.h +93 -0
  1295. data/ext/third_party/spdlog/include/spdlog/async_logger-inl.h +92 -0
  1296. data/ext/third_party/spdlog/include/spdlog/async_logger.h +68 -0
  1297. data/ext/third_party/spdlog/include/spdlog/cfg/argv.h +45 -0
  1298. data/ext/third_party/spdlog/include/spdlog/cfg/env.h +36 -0
  1299. data/ext/third_party/spdlog/include/spdlog/cfg/helpers-inl.h +103 -0
  1300. data/ext/third_party/spdlog/include/spdlog/cfg/helpers.h +28 -0
  1301. data/ext/third_party/spdlog/include/spdlog/cfg/log_levels.h +47 -0
  1302. data/ext/third_party/spdlog/include/spdlog/common-inl.h +76 -0
  1303. data/ext/third_party/spdlog/include/spdlog/common.h +246 -0
  1304. data/ext/third_party/spdlog/include/spdlog/details/backtracer-inl.h +69 -0
  1305. data/ext/third_party/spdlog/include/spdlog/details/backtracer.h +45 -0
  1306. data/ext/third_party/spdlog/include/spdlog/details/circular_q.h +141 -0
  1307. data/ext/third_party/spdlog/include/spdlog/details/console_globals.h +32 -0
  1308. data/ext/third_party/spdlog/include/spdlog/details/file_helper-inl.h +132 -0
  1309. data/ext/third_party/spdlog/include/spdlog/details/file_helper.h +59 -0
  1310. data/ext/third_party/spdlog/include/spdlog/details/fmt_helper.h +108 -0
  1311. data/ext/third_party/spdlog/include/spdlog/details/log_msg-inl.h +37 -0
  1312. data/ext/third_party/spdlog/include/spdlog/details/log_msg.h +36 -0
  1313. data/ext/third_party/spdlog/include/spdlog/details/log_msg_buffer-inl.h +58 -0
  1314. data/ext/third_party/spdlog/include/spdlog/details/log_msg_buffer.h +33 -0
  1315. data/ext/third_party/spdlog/include/spdlog/details/mpmc_blocking_q.h +120 -0
  1316. data/ext/third_party/spdlog/include/spdlog/details/null_mutex.h +49 -0
  1317. data/ext/third_party/spdlog/include/spdlog/details/os-inl.h +554 -0
  1318. data/ext/third_party/spdlog/include/spdlog/details/os.h +111 -0
  1319. data/ext/third_party/spdlog/include/spdlog/details/periodic_worker-inl.h +49 -0
  1320. data/ext/third_party/spdlog/include/spdlog/details/periodic_worker.h +40 -0
  1321. data/ext/third_party/spdlog/include/spdlog/details/registry-inl.h +299 -0
  1322. data/ext/third_party/spdlog/include/spdlog/details/registry.h +112 -0
  1323. data/ext/third_party/spdlog/include/spdlog/details/synchronous_factory.h +24 -0
  1324. data/ext/third_party/spdlog/include/spdlog/details/tcp_client-windows.h +175 -0
  1325. data/ext/third_party/spdlog/include/spdlog/details/tcp_client.h +145 -0
  1326. data/ext/third_party/spdlog/include/spdlog/details/thread_pool-inl.h +124 -0
  1327. data/ext/third_party/spdlog/include/spdlog/details/thread_pool.h +120 -0
  1328. data/ext/third_party/spdlog/include/spdlog/details/windows_include.h +11 -0
  1329. data/ext/third_party/spdlog/include/spdlog/fmt/bin_to_hex.h +216 -0
  1330. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/LICENSE.rst +27 -0
  1331. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/chrono.h +1119 -0
  1332. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/color.h +568 -0
  1333. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/compile.h +595 -0
  1334. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/core.h +1789 -0
  1335. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/format-inl.h +1403 -0
  1336. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/format.h +3648 -0
  1337. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/locale.h +78 -0
  1338. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/ostream.h +143 -0
  1339. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/posix.h +2 -0
  1340. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/printf.h +721 -0
  1341. data/ext/third_party/spdlog/include/spdlog/fmt/bundled/ranges.h +387 -0
  1342. data/ext/third_party/spdlog/include/spdlog/fmt/fmt.h +25 -0
  1343. data/ext/third_party/spdlog/include/spdlog/fmt/ostr.h +20 -0
  1344. data/ext/third_party/spdlog/include/spdlog/formatter.h +18 -0
  1345. data/ext/third_party/spdlog/include/spdlog/fwd.h +14 -0
  1346. data/ext/third_party/spdlog/include/spdlog/logger-inl.h +253 -0
  1347. data/ext/third_party/spdlog/include/spdlog/logger.h +392 -0
  1348. data/ext/third_party/spdlog/include/spdlog/pattern_formatter-inl.h +1358 -0
  1349. data/ext/third_party/spdlog/include/spdlog/pattern_formatter.h +126 -0
  1350. data/ext/third_party/spdlog/include/spdlog/sinks/android_sink.h +119 -0
  1351. data/ext/third_party/spdlog/include/spdlog/sinks/ansicolor_sink-inl.h +143 -0
  1352. data/ext/third_party/spdlog/include/spdlog/sinks/ansicolor_sink.h +118 -0
  1353. data/ext/third_party/spdlog/include/spdlog/sinks/base_sink-inl.h +63 -0
  1354. data/ext/third_party/spdlog/include/spdlog/sinks/base_sink.h +52 -0
  1355. data/ext/third_party/spdlog/include/spdlog/sinks/basic_file_sink-inl.h +43 -0
  1356. data/ext/third_party/spdlog/include/spdlog/sinks/basic_file_sink.h +58 -0
  1357. data/ext/third_party/spdlog/include/spdlog/sinks/daily_file_sink.h +204 -0
  1358. data/ext/third_party/spdlog/include/spdlog/sinks/dist_sink.h +97 -0
  1359. data/ext/third_party/spdlog/include/spdlog/sinks/dup_filter_sink.h +90 -0
  1360. data/ext/third_party/spdlog/include/spdlog/sinks/msvc_sink.h +49 -0
  1361. data/ext/third_party/spdlog/include/spdlog/sinks/null_sink.h +44 -0
  1362. data/ext/third_party/spdlog/include/spdlog/sinks/ostream_sink.h +50 -0
  1363. data/ext/third_party/spdlog/include/spdlog/sinks/ringbuffer_sink.h +72 -0
  1364. data/ext/third_party/spdlog/include/spdlog/sinks/rotating_file_sink-inl.h +131 -0
  1365. data/ext/third_party/spdlog/include/spdlog/sinks/rotating_file_sink.h +78 -0
  1366. data/ext/third_party/spdlog/include/spdlog/sinks/sink-inl.h +25 -0
  1367. data/ext/third_party/spdlog/include/spdlog/sinks/sink.h +35 -0
  1368. data/ext/third_party/spdlog/include/spdlog/sinks/stdout_color_sinks-inl.h +38 -0
  1369. data/ext/third_party/spdlog/include/spdlog/sinks/stdout_color_sinks.h +45 -0
  1370. data/ext/third_party/spdlog/include/spdlog/sinks/stdout_sinks-inl.h +94 -0
  1371. data/ext/third_party/spdlog/include/spdlog/sinks/stdout_sinks.h +80 -0
  1372. data/ext/third_party/spdlog/include/spdlog/sinks/syslog_sink.h +109 -0
  1373. data/ext/third_party/spdlog/include/spdlog/sinks/systemd_sink.h +103 -0
  1374. data/ext/third_party/spdlog/include/spdlog/sinks/tcp_sink.h +81 -0
  1375. data/ext/third_party/spdlog/include/spdlog/sinks/win_eventlog_sink.h +266 -0
  1376. data/ext/third_party/spdlog/include/spdlog/sinks/wincolor_sink-inl.h +180 -0
  1377. data/ext/third_party/spdlog/include/spdlog/sinks/wincolor_sink.h +94 -0
  1378. data/ext/third_party/spdlog/include/spdlog/spdlog-inl.h +115 -0
  1379. data/ext/third_party/spdlog/include/spdlog/spdlog.h +340 -0
  1380. data/ext/third_party/spdlog/include/spdlog/tweakme.h +116 -0
  1381. data/ext/third_party/spdlog/include/spdlog/version.h +10 -0
  1382. data/ext/third_party/spdlog/src/async.cpp +13 -0
  1383. data/ext/third_party/spdlog/src/cfg.cpp +8 -0
  1384. data/ext/third_party/spdlog/src/color_sinks.cpp +51 -0
  1385. data/ext/third_party/spdlog/src/file_sinks.cpp +20 -0
  1386. data/ext/third_party/spdlog/src/fmt.cpp +189 -0
  1387. data/ext/third_party/spdlog/src/spdlog.cpp +26 -0
  1388. data/ext/third_party/spdlog/src/stdout_sinks.cpp +29 -0
  1389. data/lib/couchbase.rb +13 -150
  1390. data/lib/couchbase/analytics_options.rb +165 -0
  1391. data/lib/couchbase/authenticator.rb +25 -0
  1392. data/lib/couchbase/binary_collection.rb +89 -0
  1393. data/lib/couchbase/binary_collection_options.rb +98 -0
  1394. data/lib/couchbase/bucket.rb +102 -420
  1395. data/lib/couchbase/cluster.rb +296 -97
  1396. data/lib/couchbase/collection.rb +331 -0
  1397. data/lib/couchbase/collection_options.rb +490 -0
  1398. data/lib/couchbase/common_options.rb +29 -0
  1399. data/lib/couchbase/errors.rb +224 -0
  1400. data/lib/couchbase/json_transcoder.rb +32 -0
  1401. data/lib/couchbase/management/analytics_index_manager.rb +433 -0
  1402. data/lib/couchbase/management/bucket_manager.rb +252 -0
  1403. data/lib/couchbase/management/collection_manager.rb +202 -0
  1404. data/lib/couchbase/management/query_index_manager.rb +297 -0
  1405. data/lib/couchbase/management/search_index_manager.rb +364 -0
  1406. data/lib/couchbase/management/user_manager.rb +323 -0
  1407. data/lib/couchbase/management/view_index_manager.rb +231 -0
  1408. data/lib/couchbase/mutation_state.rb +50 -0
  1409. data/lib/couchbase/query_options.rb +219 -0
  1410. data/lib/couchbase/scope.rb +49 -0
  1411. data/lib/couchbase/search_options.rb +1492 -0
  1412. data/lib/couchbase/subdoc.rb +287 -0
  1413. data/lib/couchbase/version.rb +12 -15
  1414. data/lib/couchbase/view_options.rb +155 -0
  1415. data/rbi/couchbase.rbi +79 -0
  1416. metadata +1440 -243
  1417. data/.travis.yml +0 -22
  1418. data/CONTRIBUTING.markdown +0 -75
  1419. data/LICENSE +0 -201
  1420. data/Makefile +0 -3
  1421. data/README.markdown +0 -592
  1422. data/RELEASE_NOTES.markdown +0 -909
  1423. data/examples/chat-em/Gemfile +0 -7
  1424. data/examples/chat-em/README.markdown +0 -45
  1425. data/examples/chat-em/server.rb +0 -82
  1426. data/examples/chat-goliath-grape/Gemfile +0 -5
  1427. data/examples/chat-goliath-grape/README.markdown +0 -50
  1428. data/examples/chat-goliath-grape/app.rb +0 -67
  1429. data/examples/chat-goliath-grape/config/app.rb +0 -20
  1430. data/examples/transcoders/Gemfile +0 -3
  1431. data/examples/transcoders/README.markdown +0 -59
  1432. data/examples/transcoders/cb-zcat +0 -40
  1433. data/examples/transcoders/cb-zcp +0 -45
  1434. data/examples/transcoders/gzip_transcoder.rb +0 -49
  1435. data/examples/transcoders/options.rb +0 -54
  1436. data/ext/couchbase_ext/.gitignore +0 -4
  1437. data/ext/couchbase_ext/arguments.c +0 -979
  1438. data/ext/couchbase_ext/arithmetic.c +0 -316
  1439. data/ext/couchbase_ext/bucket.c +0 -1436
  1440. data/ext/couchbase_ext/context.c +0 -65
  1441. data/ext/couchbase_ext/couchbase_ext.c +0 -1480
  1442. data/ext/couchbase_ext/couchbase_ext.h +0 -678
  1443. data/ext/couchbase_ext/delete.c +0 -163
  1444. data/ext/couchbase_ext/eventmachine_plugin.c +0 -466
  1445. data/ext/couchbase_ext/extconf.rb +0 -194
  1446. data/ext/couchbase_ext/get.c +0 -316
  1447. data/ext/couchbase_ext/gethrtime.c +0 -129
  1448. data/ext/couchbase_ext/http.c +0 -432
  1449. data/ext/couchbase_ext/multithread_plugin.c +0 -1085
  1450. data/ext/couchbase_ext/n1ql.c +0 -117
  1451. data/ext/couchbase_ext/observe.c +0 -171
  1452. data/ext/couchbase_ext/result.c +0 -129
  1453. data/ext/couchbase_ext/stats.c +0 -163
  1454. data/ext/couchbase_ext/store.c +0 -542
  1455. data/ext/couchbase_ext/timer.c +0 -192
  1456. data/ext/couchbase_ext/touch.c +0 -186
  1457. data/ext/couchbase_ext/unlock.c +0 -176
  1458. data/ext/couchbase_ext/utils.c +0 -558
  1459. data/ext/couchbase_ext/version.c +0 -142
  1460. data/lib/action_dispatch/middleware/session/couchbase_store.rb +0 -38
  1461. data/lib/active_support/cache/couchbase_store.rb +0 -430
  1462. data/lib/couchbase/connection_pool.rb +0 -58
  1463. data/lib/couchbase/constants.rb +0 -12
  1464. data/lib/couchbase/dns.rb +0 -76
  1465. data/lib/couchbase/result.rb +0 -26
  1466. data/lib/couchbase/transcoder.rb +0 -120
  1467. data/lib/couchbase/utils.rb +0 -62
  1468. data/lib/couchbase/view.rb +0 -506
  1469. data/lib/couchbase/view_row.rb +0 -272
  1470. data/lib/ext/multi_json_fix.rb +0 -56
  1471. data/lib/rack/session/couchbase.rb +0 -108
  1472. data/tasks/benchmark.rake +0 -6
  1473. data/tasks/compile.rake +0 -153
  1474. data/tasks/test.rake +0 -100
  1475. data/tasks/util.rake +0 -21
  1476. data/test/profile/.gitignore +0 -1
  1477. data/test/profile/Gemfile +0 -6
  1478. data/test/profile/benchmark.rb +0 -195
  1479. data/test/setup.rb +0 -178
  1480. data/test/test_arithmetic.rb +0 -185
  1481. data/test/test_async.rb +0 -316
  1482. data/test/test_bucket.rb +0 -299
  1483. data/test/test_cas.rb +0 -235
  1484. data/test/test_couchbase.rb +0 -77
  1485. data/test/test_couchbase_connection_pool.rb +0 -77
  1486. data/test/test_couchbase_rails_cache_store.rb +0 -358
  1487. data/test/test_delete.rb +0 -120
  1488. data/test/test_errors.rb +0 -82
  1489. data/test/test_eventmachine.rb +0 -78
  1490. data/test/test_format.rb +0 -164
  1491. data/test/test_get.rb +0 -407
  1492. data/test/test_stats.rb +0 -57
  1493. data/test/test_store.rb +0 -224
  1494. data/test/test_timer.rb +0 -42
  1495. data/test/test_touch.rb +0 -97
  1496. data/test/test_unlock.rb +0 -119
  1497. data/test/test_utils.rb +0 -58
  1498. data/test/test_version.rb +0 -52
@@ -0,0 +1,4600 @@
1
+ /* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
2
+ *
3
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ * of this software and associated documentation files (the "Software"), to
5
+ * deal in the Software without restriction, including without limitation the
6
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ * sell copies of the Software, and to permit persons to whom the Software is
8
+ * furnished to do so, subject to the following conditions:
9
+ *
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ * IN THE SOFTWARE.
20
+ */
21
+ #include "http_parser.h"
22
+ #include <stdlib.h>
23
+ #include <assert.h>
24
+ #include <stdio.h>
25
+ #include <stdlib.h> /* rand */
26
+ #include <string.h>
27
+ #include <stdarg.h>
28
+
29
+ #if defined(__APPLE__)
30
+ # undef strlncpy
31
+ #endif /* defined(__APPLE__) */
32
+
33
+ #undef TRUE
34
+ #define TRUE 1
35
+ #undef FALSE
36
+ #define FALSE 0
37
+
38
+ #define MAX_HEADERS 13
39
+ #define MAX_ELEMENT_SIZE 2048
40
+ #define MAX_CHUNKS 16
41
+
42
+ #define MIN(a,b) ((a) < (b) ? (a) : (b))
43
+
44
+ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))
45
+
46
+ static http_parser parser;
47
+
48
+ struct message {
49
+ const char *name; // for debugging purposes
50
+ const char *raw;
51
+ enum http_parser_type type;
52
+ enum http_method method;
53
+ int status_code;
54
+ char response_status[MAX_ELEMENT_SIZE];
55
+ char request_path[MAX_ELEMENT_SIZE];
56
+ char request_url[MAX_ELEMENT_SIZE];
57
+ char fragment[MAX_ELEMENT_SIZE];
58
+ char query_string[MAX_ELEMENT_SIZE];
59
+ char body[MAX_ELEMENT_SIZE];
60
+ size_t body_size;
61
+ const char *host;
62
+ const char *userinfo;
63
+ uint16_t port;
64
+ int num_headers;
65
+ enum { NONE=0, FIELD, VALUE } last_header_element;
66
+ char headers [MAX_HEADERS][2][MAX_ELEMENT_SIZE];
67
+ int should_keep_alive;
68
+
69
+ int num_chunks;
70
+ int num_chunks_complete;
71
+ int chunk_lengths[MAX_CHUNKS];
72
+
73
+ const char *upgrade; // upgraded body
74
+
75
+ unsigned short http_major;
76
+ unsigned short http_minor;
77
+
78
+ int message_begin_cb_called;
79
+ int headers_complete_cb_called;
80
+ int message_complete_cb_called;
81
+ int status_cb_called;
82
+ int message_complete_on_eof;
83
+ int body_is_final;
84
+ };
85
+
86
+ static int currently_parsing_eof;
87
+
88
+ static struct message messages[5];
89
+ static int num_messages;
90
+ static http_parser_settings *current_pause_parser;
91
+
92
+ /* * R E Q U E S T S * */
93
+ const struct message requests[] =
94
+ #define CURL_GET 0
95
+ { {.name= "curl get"
96
+ ,.type= HTTP_REQUEST
97
+ ,.raw= "GET /test HTTP/1.1\r\n"
98
+ "User-Agent: curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1\r\n"
99
+ "Host: 0.0.0.0=5000\r\n"
100
+ "Accept: */*\r\n"
101
+ "\r\n"
102
+ ,.should_keep_alive= TRUE
103
+ ,.message_complete_on_eof= FALSE
104
+ ,.http_major= 1
105
+ ,.http_minor= 1
106
+ ,.method= HTTP_GET
107
+ ,.query_string= ""
108
+ ,.fragment= ""
109
+ ,.request_path= "/test"
110
+ ,.request_url= "/test"
111
+ ,.num_headers= 3
112
+ ,.headers=
113
+ { { "User-Agent", "curl/7.18.0 (i486-pc-linux-gnu) libcurl/7.18.0 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.1" }
114
+ , { "Host", "0.0.0.0=5000" }
115
+ , { "Accept", "*/*" }
116
+ }
117
+ ,.body= ""
118
+ }
119
+
120
+ #define FIREFOX_GET 1
121
+ , {.name= "firefox get"
122
+ ,.type= HTTP_REQUEST
123
+ ,.raw= "GET /favicon.ico HTTP/1.1\r\n"
124
+ "Host: 0.0.0.0=5000\r\n"
125
+ "User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0\r\n"
126
+ "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
127
+ "Accept-Language: en-us,en;q=0.5\r\n"
128
+ "Accept-Encoding: gzip,deflate\r\n"
129
+ "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n"
130
+ "Keep-Alive: 300\r\n"
131
+ "Connection: keep-alive\r\n"
132
+ "\r\n"
133
+ ,.should_keep_alive= TRUE
134
+ ,.message_complete_on_eof= FALSE
135
+ ,.http_major= 1
136
+ ,.http_minor= 1
137
+ ,.method= HTTP_GET
138
+ ,.query_string= ""
139
+ ,.fragment= ""
140
+ ,.request_path= "/favicon.ico"
141
+ ,.request_url= "/favicon.ico"
142
+ ,.num_headers= 8
143
+ ,.headers=
144
+ { { "Host", "0.0.0.0=5000" }
145
+ , { "User-Agent", "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9) Gecko/2008061015 Firefox/3.0" }
146
+ , { "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" }
147
+ , { "Accept-Language", "en-us,en;q=0.5" }
148
+ , { "Accept-Encoding", "gzip,deflate" }
149
+ , { "Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7" }
150
+ , { "Keep-Alive", "300" }
151
+ , { "Connection", "keep-alive" }
152
+ }
153
+ ,.body= ""
154
+ }
155
+
156
+ #define DUMBLUCK 2
157
+ , {.name= "dumbluck"
158
+ ,.type= HTTP_REQUEST
159
+ ,.raw= "GET /dumbluck HTTP/1.1\r\n"
160
+ "aaaaaaaaaaaaa:++++++++++\r\n"
161
+ "\r\n"
162
+ ,.should_keep_alive= TRUE
163
+ ,.message_complete_on_eof= FALSE
164
+ ,.http_major= 1
165
+ ,.http_minor= 1
166
+ ,.method= HTTP_GET
167
+ ,.query_string= ""
168
+ ,.fragment= ""
169
+ ,.request_path= "/dumbluck"
170
+ ,.request_url= "/dumbluck"
171
+ ,.num_headers= 1
172
+ ,.headers=
173
+ { { "aaaaaaaaaaaaa", "++++++++++" }
174
+ }
175
+ ,.body= ""
176
+ }
177
+
178
+ #define FRAGMENT_IN_URI 3
179
+ , {.name= "fragment in url"
180
+ ,.type= HTTP_REQUEST
181
+ ,.raw= "GET /forums/1/topics/2375?page=1#posts-17408 HTTP/1.1\r\n"
182
+ "\r\n"
183
+ ,.should_keep_alive= TRUE
184
+ ,.message_complete_on_eof= FALSE
185
+ ,.http_major= 1
186
+ ,.http_minor= 1
187
+ ,.method= HTTP_GET
188
+ ,.query_string= "page=1"
189
+ ,.fragment= "posts-17408"
190
+ ,.request_path= "/forums/1/topics/2375"
191
+ /* XXX request url does include fragment? */
192
+ ,.request_url= "/forums/1/topics/2375?page=1#posts-17408"
193
+ ,.num_headers= 0
194
+ ,.body= ""
195
+ }
196
+
197
+ #define GET_NO_HEADERS_NO_BODY 4
198
+ , {.name= "get no headers no body"
199
+ ,.type= HTTP_REQUEST
200
+ ,.raw= "GET /get_no_headers_no_body/world HTTP/1.1\r\n"
201
+ "\r\n"
202
+ ,.should_keep_alive= TRUE
203
+ ,.message_complete_on_eof= FALSE /* would need Connection: close */
204
+ ,.http_major= 1
205
+ ,.http_minor= 1
206
+ ,.method= HTTP_GET
207
+ ,.query_string= ""
208
+ ,.fragment= ""
209
+ ,.request_path= "/get_no_headers_no_body/world"
210
+ ,.request_url= "/get_no_headers_no_body/world"
211
+ ,.num_headers= 0
212
+ ,.body= ""
213
+ }
214
+
215
+ #define GET_ONE_HEADER_NO_BODY 5
216
+ , {.name= "get one header no body"
217
+ ,.type= HTTP_REQUEST
218
+ ,.raw= "GET /get_one_header_no_body HTTP/1.1\r\n"
219
+ "Accept: */*\r\n"
220
+ "\r\n"
221
+ ,.should_keep_alive= TRUE
222
+ ,.message_complete_on_eof= FALSE /* would need Connection: close */
223
+ ,.http_major= 1
224
+ ,.http_minor= 1
225
+ ,.method= HTTP_GET
226
+ ,.query_string= ""
227
+ ,.fragment= ""
228
+ ,.request_path= "/get_one_header_no_body"
229
+ ,.request_url= "/get_one_header_no_body"
230
+ ,.num_headers= 1
231
+ ,.headers=
232
+ { { "Accept" , "*/*" }
233
+ }
234
+ ,.body= ""
235
+ }
236
+
237
+ #define GET_FUNKY_CONTENT_LENGTH 6
238
+ , {.name= "get funky content length body hello"
239
+ ,.type= HTTP_REQUEST
240
+ ,.raw= "GET /get_funky_content_length_body_hello HTTP/1.0\r\n"
241
+ "conTENT-Length: 5\r\n"
242
+ "\r\n"
243
+ "HELLO"
244
+ ,.should_keep_alive= FALSE
245
+ ,.message_complete_on_eof= FALSE
246
+ ,.http_major= 1
247
+ ,.http_minor= 0
248
+ ,.method= HTTP_GET
249
+ ,.query_string= ""
250
+ ,.fragment= ""
251
+ ,.request_path= "/get_funky_content_length_body_hello"
252
+ ,.request_url= "/get_funky_content_length_body_hello"
253
+ ,.num_headers= 1
254
+ ,.headers=
255
+ { { "conTENT-Length" , "5" }
256
+ }
257
+ ,.body= "HELLO"
258
+ }
259
+
260
+ #define POST_IDENTITY_BODY_WORLD 7
261
+ , {.name= "post identity body world"
262
+ ,.type= HTTP_REQUEST
263
+ ,.raw= "POST /post_identity_body_world?q=search#hey HTTP/1.1\r\n"
264
+ "Accept: */*\r\n"
265
+ "Content-Length: 5\r\n"
266
+ "\r\n"
267
+ "World"
268
+ ,.should_keep_alive= TRUE
269
+ ,.message_complete_on_eof= FALSE
270
+ ,.http_major= 1
271
+ ,.http_minor= 1
272
+ ,.method= HTTP_POST
273
+ ,.query_string= "q=search"
274
+ ,.fragment= "hey"
275
+ ,.request_path= "/post_identity_body_world"
276
+ ,.request_url= "/post_identity_body_world?q=search#hey"
277
+ ,.num_headers= 2
278
+ ,.headers=
279
+ { { "Accept", "*/*" }
280
+ , { "Content-Length", "5" }
281
+ }
282
+ ,.body= "World"
283
+ }
284
+
285
+ #define POST_CHUNKED_ALL_YOUR_BASE 8
286
+ , {.name= "post - chunked body: all your base are belong to us"
287
+ ,.type= HTTP_REQUEST
288
+ ,.raw= "POST /post_chunked_all_your_base HTTP/1.1\r\n"
289
+ "Transfer-Encoding: chunked\r\n"
290
+ "\r\n"
291
+ "1e\r\nall your base are belong to us\r\n"
292
+ "0\r\n"
293
+ "\r\n"
294
+ ,.should_keep_alive= TRUE
295
+ ,.message_complete_on_eof= FALSE
296
+ ,.http_major= 1
297
+ ,.http_minor= 1
298
+ ,.method= HTTP_POST
299
+ ,.query_string= ""
300
+ ,.fragment= ""
301
+ ,.request_path= "/post_chunked_all_your_base"
302
+ ,.request_url= "/post_chunked_all_your_base"
303
+ ,.num_headers= 1
304
+ ,.headers=
305
+ { { "Transfer-Encoding" , "chunked" }
306
+ }
307
+ ,.body= "all your base are belong to us"
308
+ ,.num_chunks_complete= 2
309
+ ,.chunk_lengths= { 0x1e }
310
+ }
311
+
312
+ #define TWO_CHUNKS_MULT_ZERO_END 9
313
+ , {.name= "two chunks ; triple zero ending"
314
+ ,.type= HTTP_REQUEST
315
+ ,.raw= "POST /two_chunks_mult_zero_end HTTP/1.1\r\n"
316
+ "Transfer-Encoding: chunked\r\n"
317
+ "\r\n"
318
+ "5\r\nhello\r\n"
319
+ "6\r\n world\r\n"
320
+ "000\r\n"
321
+ "\r\n"
322
+ ,.should_keep_alive= TRUE
323
+ ,.message_complete_on_eof= FALSE
324
+ ,.http_major= 1
325
+ ,.http_minor= 1
326
+ ,.method= HTTP_POST
327
+ ,.query_string= ""
328
+ ,.fragment= ""
329
+ ,.request_path= "/two_chunks_mult_zero_end"
330
+ ,.request_url= "/two_chunks_mult_zero_end"
331
+ ,.num_headers= 1
332
+ ,.headers=
333
+ { { "Transfer-Encoding", "chunked" }
334
+ }
335
+ ,.body= "hello world"
336
+ ,.num_chunks_complete= 3
337
+ ,.chunk_lengths= { 5, 6 }
338
+ }
339
+
340
+ #define CHUNKED_W_TRAILING_HEADERS 10
341
+ , {.name= "chunked with trailing headers. blech."
342
+ ,.type= HTTP_REQUEST
343
+ ,.raw= "POST /chunked_w_trailing_headers HTTP/1.1\r\n"
344
+ "Transfer-Encoding: chunked\r\n"
345
+ "\r\n"
346
+ "5\r\nhello\r\n"
347
+ "6\r\n world\r\n"
348
+ "0\r\n"
349
+ "Vary: *\r\n"
350
+ "Content-Type: text/plain\r\n"
351
+ "\r\n"
352
+ ,.should_keep_alive= TRUE
353
+ ,.message_complete_on_eof= FALSE
354
+ ,.http_major= 1
355
+ ,.http_minor= 1
356
+ ,.method= HTTP_POST
357
+ ,.query_string= ""
358
+ ,.fragment= ""
359
+ ,.request_path= "/chunked_w_trailing_headers"
360
+ ,.request_url= "/chunked_w_trailing_headers"
361
+ ,.num_headers= 3
362
+ ,.headers=
363
+ { { "Transfer-Encoding", "chunked" }
364
+ , { "Vary", "*" }
365
+ , { "Content-Type", "text/plain" }
366
+ }
367
+ ,.body= "hello world"
368
+ ,.num_chunks_complete= 3
369
+ ,.chunk_lengths= { 5, 6 }
370
+ }
371
+
372
+ #define CHUNKED_W_NONSENSE_AFTER_LENGTH 11
373
+ , {.name= "with nonsense after the length"
374
+ ,.type= HTTP_REQUEST
375
+ ,.raw= "POST /chunked_w_nonsense_after_length HTTP/1.1\r\n"
376
+ "Transfer-Encoding: chunked\r\n"
377
+ "\r\n"
378
+ "5; ilovew3;whattheluck=aretheseparametersfor\r\nhello\r\n"
379
+ "6; blahblah; blah\r\n world\r\n"
380
+ "0\r\n"
381
+ "\r\n"
382
+ ,.should_keep_alive= TRUE
383
+ ,.message_complete_on_eof= FALSE
384
+ ,.http_major= 1
385
+ ,.http_minor= 1
386
+ ,.method= HTTP_POST
387
+ ,.query_string= ""
388
+ ,.fragment= ""
389
+ ,.request_path= "/chunked_w_nonsense_after_length"
390
+ ,.request_url= "/chunked_w_nonsense_after_length"
391
+ ,.num_headers= 1
392
+ ,.headers=
393
+ { { "Transfer-Encoding", "chunked" }
394
+ }
395
+ ,.body= "hello world"
396
+ ,.num_chunks_complete= 3
397
+ ,.chunk_lengths= { 5, 6 }
398
+ }
399
+
400
+ #define WITH_QUOTES 12
401
+ , {.name= "with quotes"
402
+ ,.type= HTTP_REQUEST
403
+ ,.raw= "GET /with_\"stupid\"_quotes?foo=\"bar\" HTTP/1.1\r\n\r\n"
404
+ ,.should_keep_alive= TRUE
405
+ ,.message_complete_on_eof= FALSE
406
+ ,.http_major= 1
407
+ ,.http_minor= 1
408
+ ,.method= HTTP_GET
409
+ ,.query_string= "foo=\"bar\""
410
+ ,.fragment= ""
411
+ ,.request_path= "/with_\"stupid\"_quotes"
412
+ ,.request_url= "/with_\"stupid\"_quotes?foo=\"bar\""
413
+ ,.num_headers= 0
414
+ ,.headers= { }
415
+ ,.body= ""
416
+ }
417
+
418
+ #define APACHEBENCH_GET 13
419
+ /* The server receiving this request SHOULD NOT wait for EOF
420
+ * to know that content-length == 0.
421
+ * How to represent this in a unit test? message_complete_on_eof
422
+ * Compare with NO_CONTENT_LENGTH_RESPONSE.
423
+ */
424
+ , {.name = "apachebench get"
425
+ ,.type= HTTP_REQUEST
426
+ ,.raw= "GET /test HTTP/1.0\r\n"
427
+ "Host: 0.0.0.0:5000\r\n"
428
+ "User-Agent: ApacheBench/2.3\r\n"
429
+ "Accept: */*\r\n\r\n"
430
+ ,.should_keep_alive= FALSE
431
+ ,.message_complete_on_eof= FALSE
432
+ ,.http_major= 1
433
+ ,.http_minor= 0
434
+ ,.method= HTTP_GET
435
+ ,.query_string= ""
436
+ ,.fragment= ""
437
+ ,.request_path= "/test"
438
+ ,.request_url= "/test"
439
+ ,.num_headers= 3
440
+ ,.headers= { { "Host", "0.0.0.0:5000" }
441
+ , { "User-Agent", "ApacheBench/2.3" }
442
+ , { "Accept", "*/*" }
443
+ }
444
+ ,.body= ""
445
+ }
446
+
447
+ #define QUERY_URL_WITH_QUESTION_MARK_GET 14
448
+ /* Some clients include '?' characters in query strings.
449
+ */
450
+ , {.name = "query url with question mark"
451
+ ,.type= HTTP_REQUEST
452
+ ,.raw= "GET /test.cgi?foo=bar?baz HTTP/1.1\r\n\r\n"
453
+ ,.should_keep_alive= TRUE
454
+ ,.message_complete_on_eof= FALSE
455
+ ,.http_major= 1
456
+ ,.http_minor= 1
457
+ ,.method= HTTP_GET
458
+ ,.query_string= "foo=bar?baz"
459
+ ,.fragment= ""
460
+ ,.request_path= "/test.cgi"
461
+ ,.request_url= "/test.cgi?foo=bar?baz"
462
+ ,.num_headers= 0
463
+ ,.headers= {}
464
+ ,.body= ""
465
+ }
466
+
467
+ #define PREFIX_NEWLINE_GET 15
468
+ /* Some clients, especially after a POST in a keep-alive connection,
469
+ * will send an extra CRLF before the next request
470
+ */
471
+ , {.name = "newline prefix get"
472
+ ,.type= HTTP_REQUEST
473
+ ,.raw= "\r\nGET /test HTTP/1.1\r\n\r\n"
474
+ ,.should_keep_alive= TRUE
475
+ ,.message_complete_on_eof= FALSE
476
+ ,.http_major= 1
477
+ ,.http_minor= 1
478
+ ,.method= HTTP_GET
479
+ ,.query_string= ""
480
+ ,.fragment= ""
481
+ ,.request_path= "/test"
482
+ ,.request_url= "/test"
483
+ ,.num_headers= 0
484
+ ,.headers= { }
485
+ ,.body= ""
486
+ }
487
+
488
+ #define UPGRADE_REQUEST 16
489
+ , {.name = "upgrade request"
490
+ ,.type= HTTP_REQUEST
491
+ ,.raw= "GET /demo HTTP/1.1\r\n"
492
+ "Host: example.com\r\n"
493
+ "Connection: Upgrade\r\n"
494
+ "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n"
495
+ "Sec-WebSocket-Protocol: sample\r\n"
496
+ "Upgrade: WebSocket\r\n"
497
+ "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n"
498
+ "Origin: http://example.com\r\n"
499
+ "\r\n"
500
+ "Hot diggity dogg"
501
+ ,.should_keep_alive= TRUE
502
+ ,.message_complete_on_eof= FALSE
503
+ ,.http_major= 1
504
+ ,.http_minor= 1
505
+ ,.method= HTTP_GET
506
+ ,.query_string= ""
507
+ ,.fragment= ""
508
+ ,.request_path= "/demo"
509
+ ,.request_url= "/demo"
510
+ ,.num_headers= 7
511
+ ,.upgrade="Hot diggity dogg"
512
+ ,.headers= { { "Host", "example.com" }
513
+ , { "Connection", "Upgrade" }
514
+ , { "Sec-WebSocket-Key2", "12998 5 Y3 1 .P00" }
515
+ , { "Sec-WebSocket-Protocol", "sample" }
516
+ , { "Upgrade", "WebSocket" }
517
+ , { "Sec-WebSocket-Key1", "4 @1 46546xW%0l 1 5" }
518
+ , { "Origin", "http://example.com" }
519
+ }
520
+ ,.body= ""
521
+ }
522
+
523
+ #define CONNECT_REQUEST 17
524
+ , {.name = "connect request"
525
+ ,.type= HTTP_REQUEST
526
+ ,.raw= "CONNECT 0-home0.netscape.com:443 HTTP/1.0\r\n"
527
+ "User-agent: Mozilla/1.1N\r\n"
528
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
529
+ "\r\n"
530
+ "some data\r\n"
531
+ "and yet even more data"
532
+ ,.should_keep_alive= FALSE
533
+ ,.message_complete_on_eof= FALSE
534
+ ,.http_major= 1
535
+ ,.http_minor= 0
536
+ ,.method= HTTP_CONNECT
537
+ ,.query_string= ""
538
+ ,.fragment= ""
539
+ ,.request_path= ""
540
+ ,.request_url= "0-home0.netscape.com:443"
541
+ ,.num_headers= 2
542
+ ,.upgrade="some data\r\nand yet even more data"
543
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
544
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
545
+ }
546
+ ,.body= ""
547
+ }
548
+
549
+ #define REPORT_REQ 18
550
+ , {.name= "report request"
551
+ ,.type= HTTP_REQUEST
552
+ ,.raw= "REPORT /test HTTP/1.1\r\n"
553
+ "\r\n"
554
+ ,.should_keep_alive= TRUE
555
+ ,.message_complete_on_eof= FALSE
556
+ ,.http_major= 1
557
+ ,.http_minor= 1
558
+ ,.method= HTTP_REPORT
559
+ ,.query_string= ""
560
+ ,.fragment= ""
561
+ ,.request_path= "/test"
562
+ ,.request_url= "/test"
563
+ ,.num_headers= 0
564
+ ,.headers= {}
565
+ ,.body= ""
566
+ }
567
+
568
+ #define NO_HTTP_VERSION 19
569
+ , {.name= "request with no http version"
570
+ ,.type= HTTP_REQUEST
571
+ ,.raw= "GET /\r\n"
572
+ "\r\n"
573
+ ,.should_keep_alive= FALSE
574
+ ,.message_complete_on_eof= FALSE
575
+ ,.http_major= 0
576
+ ,.http_minor= 9
577
+ ,.method= HTTP_GET
578
+ ,.query_string= ""
579
+ ,.fragment= ""
580
+ ,.request_path= "/"
581
+ ,.request_url= "/"
582
+ ,.num_headers= 0
583
+ ,.headers= {}
584
+ ,.body= ""
585
+ }
586
+
587
+ #define MSEARCH_REQ 20
588
+ , {.name= "m-search request"
589
+ ,.type= HTTP_REQUEST
590
+ ,.raw= "M-SEARCH * HTTP/1.1\r\n"
591
+ "HOST: 239.255.255.250:1900\r\n"
592
+ "MAN: \"ssdp:discover\"\r\n"
593
+ "ST: \"ssdp:all\"\r\n"
594
+ "\r\n"
595
+ ,.should_keep_alive= TRUE
596
+ ,.message_complete_on_eof= FALSE
597
+ ,.http_major= 1
598
+ ,.http_minor= 1
599
+ ,.method= HTTP_MSEARCH
600
+ ,.query_string= ""
601
+ ,.fragment= ""
602
+ ,.request_path= "*"
603
+ ,.request_url= "*"
604
+ ,.num_headers= 3
605
+ ,.headers= { { "HOST", "239.255.255.250:1900" }
606
+ , { "MAN", "\"ssdp:discover\"" }
607
+ , { "ST", "\"ssdp:all\"" }
608
+ }
609
+ ,.body= ""
610
+ }
611
+
612
+ #define LINE_FOLDING_IN_HEADER 21
613
+ , {.name= "line folding in header value"
614
+ ,.type= HTTP_REQUEST
615
+ ,.raw= "GET / HTTP/1.1\r\n"
616
+ "Line1: abc\r\n"
617
+ "\tdef\r\n"
618
+ " ghi\r\n"
619
+ "\t\tjkl\r\n"
620
+ " mno \r\n"
621
+ "\t \tqrs\r\n"
622
+ "Line2: \t line2\t\r\n"
623
+ "Line3:\r\n"
624
+ " line3\r\n"
625
+ "Line4: \r\n"
626
+ " \r\n"
627
+ "Connection:\r\n"
628
+ " close\r\n"
629
+ "\r\n"
630
+ ,.should_keep_alive= FALSE
631
+ ,.message_complete_on_eof= FALSE
632
+ ,.http_major= 1
633
+ ,.http_minor= 1
634
+ ,.method= HTTP_GET
635
+ ,.query_string= ""
636
+ ,.fragment= ""
637
+ ,.request_path= "/"
638
+ ,.request_url= "/"
639
+ ,.num_headers= 5
640
+ ,.headers= { { "Line1", "abc\tdef ghi\t\tjkl mno \t \tqrs" }
641
+ , { "Line2", "line2\t" }
642
+ , { "Line3", "line3" }
643
+ , { "Line4", "" }
644
+ , { "Connection", "close" },
645
+ }
646
+ ,.body= ""
647
+ }
648
+
649
+
650
+ #define QUERY_TERMINATED_HOST 22
651
+ , {.name= "host terminated by a query string"
652
+ ,.type= HTTP_REQUEST
653
+ ,.raw= "GET http://hypnotoad.org?hail=all HTTP/1.1\r\n"
654
+ "\r\n"
655
+ ,.should_keep_alive= TRUE
656
+ ,.message_complete_on_eof= FALSE
657
+ ,.http_major= 1
658
+ ,.http_minor= 1
659
+ ,.method= HTTP_GET
660
+ ,.query_string= "hail=all"
661
+ ,.fragment= ""
662
+ ,.request_path= ""
663
+ ,.request_url= "http://hypnotoad.org?hail=all"
664
+ ,.host= "hypnotoad.org"
665
+ ,.num_headers= 0
666
+ ,.headers= { }
667
+ ,.body= ""
668
+ }
669
+
670
+ #define QUERY_TERMINATED_HOSTPORT 23
671
+ , {.name= "host:port terminated by a query string"
672
+ ,.type= HTTP_REQUEST
673
+ ,.raw= "GET http://hypnotoad.org:1234?hail=all HTTP/1.1\r\n"
674
+ "\r\n"
675
+ ,.should_keep_alive= TRUE
676
+ ,.message_complete_on_eof= FALSE
677
+ ,.http_major= 1
678
+ ,.http_minor= 1
679
+ ,.method= HTTP_GET
680
+ ,.query_string= "hail=all"
681
+ ,.fragment= ""
682
+ ,.request_path= ""
683
+ ,.request_url= "http://hypnotoad.org:1234?hail=all"
684
+ ,.host= "hypnotoad.org"
685
+ ,.port= 1234
686
+ ,.num_headers= 0
687
+ ,.headers= { }
688
+ ,.body= ""
689
+ }
690
+
691
+ #define SPACE_TERMINATED_HOSTPORT 24
692
+ , {.name= "host:port terminated by a space"
693
+ ,.type= HTTP_REQUEST
694
+ ,.raw= "GET http://hypnotoad.org:1234 HTTP/1.1\r\n"
695
+ "\r\n"
696
+ ,.should_keep_alive= TRUE
697
+ ,.message_complete_on_eof= FALSE
698
+ ,.http_major= 1
699
+ ,.http_minor= 1
700
+ ,.method= HTTP_GET
701
+ ,.query_string= ""
702
+ ,.fragment= ""
703
+ ,.request_path= ""
704
+ ,.request_url= "http://hypnotoad.org:1234"
705
+ ,.host= "hypnotoad.org"
706
+ ,.port= 1234
707
+ ,.num_headers= 0
708
+ ,.headers= { }
709
+ ,.body= ""
710
+ }
711
+
712
+ #define PATCH_REQ 25
713
+ , {.name = "PATCH request"
714
+ ,.type= HTTP_REQUEST
715
+ ,.raw= "PATCH /file.txt HTTP/1.1\r\n"
716
+ "Host: www.example.com\r\n"
717
+ "Content-Type: application/example\r\n"
718
+ "If-Match: \"e0023aa4e\"\r\n"
719
+ "Content-Length: 10\r\n"
720
+ "\r\n"
721
+ "cccccccccc"
722
+ ,.should_keep_alive= TRUE
723
+ ,.message_complete_on_eof= FALSE
724
+ ,.http_major= 1
725
+ ,.http_minor= 1
726
+ ,.method= HTTP_PATCH
727
+ ,.query_string= ""
728
+ ,.fragment= ""
729
+ ,.request_path= "/file.txt"
730
+ ,.request_url= "/file.txt"
731
+ ,.num_headers= 4
732
+ ,.headers= { { "Host", "www.example.com" }
733
+ , { "Content-Type", "application/example" }
734
+ , { "If-Match", "\"e0023aa4e\"" }
735
+ , { "Content-Length", "10" }
736
+ }
737
+ ,.body= "cccccccccc"
738
+ }
739
+
740
+ #define CONNECT_CAPS_REQUEST 26
741
+ , {.name = "connect caps request"
742
+ ,.type= HTTP_REQUEST
743
+ ,.raw= "CONNECT HOME0.NETSCAPE.COM:443 HTTP/1.0\r\n"
744
+ "User-agent: Mozilla/1.1N\r\n"
745
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
746
+ "\r\n"
747
+ ,.should_keep_alive= FALSE
748
+ ,.message_complete_on_eof= FALSE
749
+ ,.http_major= 1
750
+ ,.http_minor= 0
751
+ ,.method= HTTP_CONNECT
752
+ ,.query_string= ""
753
+ ,.fragment= ""
754
+ ,.request_path= ""
755
+ ,.request_url= "HOME0.NETSCAPE.COM:443"
756
+ ,.num_headers= 2
757
+ ,.upgrade=""
758
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
759
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
760
+ }
761
+ ,.body= ""
762
+ }
763
+
764
+ #if !HTTP_PARSER_STRICT
765
+ #define UTF8_PATH_REQ 27
766
+ , {.name= "utf-8 path request"
767
+ ,.type= HTTP_REQUEST
768
+ ,.raw= "GET /δ¶/δt/pope?q=1#narf HTTP/1.1\r\n"
769
+ "Host: github.com\r\n"
770
+ "\r\n"
771
+ ,.should_keep_alive= TRUE
772
+ ,.message_complete_on_eof= FALSE
773
+ ,.http_major= 1
774
+ ,.http_minor= 1
775
+ ,.method= HTTP_GET
776
+ ,.query_string= "q=1"
777
+ ,.fragment= "narf"
778
+ ,.request_path= "/δ¶/δt/pope"
779
+ ,.request_url= "/δ¶/δt/pope?q=1#narf"
780
+ ,.num_headers= 1
781
+ ,.headers= { {"Host", "github.com" }
782
+ }
783
+ ,.body= ""
784
+ }
785
+
786
+ #define HOSTNAME_UNDERSCORE 28
787
+ , {.name = "hostname underscore"
788
+ ,.type= HTTP_REQUEST
789
+ ,.raw= "CONNECT home_0.netscape.com:443 HTTP/1.0\r\n"
790
+ "User-agent: Mozilla/1.1N\r\n"
791
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
792
+ "\r\n"
793
+ ,.should_keep_alive= FALSE
794
+ ,.message_complete_on_eof= FALSE
795
+ ,.http_major= 1
796
+ ,.http_minor= 0
797
+ ,.method= HTTP_CONNECT
798
+ ,.query_string= ""
799
+ ,.fragment= ""
800
+ ,.request_path= ""
801
+ ,.request_url= "home_0.netscape.com:443"
802
+ ,.num_headers= 2
803
+ ,.upgrade=""
804
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
805
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
806
+ }
807
+ ,.body= ""
808
+ }
809
+ #endif /* !HTTP_PARSER_STRICT */
810
+
811
+ /* see https://github.com/ry/http-parser/issues/47 */
812
+ #define EAT_TRAILING_CRLF_NO_CONNECTION_CLOSE 29
813
+ , {.name = "eat CRLF between requests, no \"Connection: close\" header"
814
+ ,.raw= "POST / HTTP/1.1\r\n"
815
+ "Host: www.example.com\r\n"
816
+ "Content-Type: application/x-www-form-urlencoded\r\n"
817
+ "Content-Length: 4\r\n"
818
+ "\r\n"
819
+ "q=42\r\n" /* note the trailing CRLF */
820
+ ,.should_keep_alive= TRUE
821
+ ,.message_complete_on_eof= FALSE
822
+ ,.http_major= 1
823
+ ,.http_minor= 1
824
+ ,.method= HTTP_POST
825
+ ,.query_string= ""
826
+ ,.fragment= ""
827
+ ,.request_path= "/"
828
+ ,.request_url= "/"
829
+ ,.num_headers= 3
830
+ ,.upgrade= 0
831
+ ,.headers= { { "Host", "www.example.com" }
832
+ , { "Content-Type", "application/x-www-form-urlencoded" }
833
+ , { "Content-Length", "4" }
834
+ }
835
+ ,.body= "q=42"
836
+ }
837
+
838
+ /* see https://github.com/ry/http-parser/issues/47 */
839
+ #define EAT_TRAILING_CRLF_WITH_CONNECTION_CLOSE 30
840
+ , {.name = "eat CRLF between requests even if \"Connection: close\" is set"
841
+ ,.raw= "POST / HTTP/1.1\r\n"
842
+ "Host: www.example.com\r\n"
843
+ "Content-Type: application/x-www-form-urlencoded\r\n"
844
+ "Content-Length: 4\r\n"
845
+ "Connection: close\r\n"
846
+ "\r\n"
847
+ "q=42\r\n" /* note the trailing CRLF */
848
+ ,.should_keep_alive= FALSE
849
+ ,.message_complete_on_eof= FALSE /* input buffer isn't empty when on_message_complete is called */
850
+ ,.http_major= 1
851
+ ,.http_minor= 1
852
+ ,.method= HTTP_POST
853
+ ,.query_string= ""
854
+ ,.fragment= ""
855
+ ,.request_path= "/"
856
+ ,.request_url= "/"
857
+ ,.num_headers= 4
858
+ ,.upgrade= 0
859
+ ,.headers= { { "Host", "www.example.com" }
860
+ , { "Content-Type", "application/x-www-form-urlencoded" }
861
+ , { "Content-Length", "4" }
862
+ , { "Connection", "close" }
863
+ }
864
+ ,.body= "q=42"
865
+ }
866
+
867
+ #define PURGE_REQ 31
868
+ , {.name = "PURGE request"
869
+ ,.type= HTTP_REQUEST
870
+ ,.raw= "PURGE /file.txt HTTP/1.1\r\n"
871
+ "Host: www.example.com\r\n"
872
+ "\r\n"
873
+ ,.should_keep_alive= TRUE
874
+ ,.message_complete_on_eof= FALSE
875
+ ,.http_major= 1
876
+ ,.http_minor= 1
877
+ ,.method= HTTP_PURGE
878
+ ,.query_string= ""
879
+ ,.fragment= ""
880
+ ,.request_path= "/file.txt"
881
+ ,.request_url= "/file.txt"
882
+ ,.num_headers= 1
883
+ ,.headers= { { "Host", "www.example.com" } }
884
+ ,.body= ""
885
+ }
886
+
887
+ #define SEARCH_REQ 32
888
+ , {.name = "SEARCH request"
889
+ ,.type= HTTP_REQUEST
890
+ ,.raw= "SEARCH / HTTP/1.1\r\n"
891
+ "Host: www.example.com\r\n"
892
+ "\r\n"
893
+ ,.should_keep_alive= TRUE
894
+ ,.message_complete_on_eof= FALSE
895
+ ,.http_major= 1
896
+ ,.http_minor= 1
897
+ ,.method= HTTP_SEARCH
898
+ ,.query_string= ""
899
+ ,.fragment= ""
900
+ ,.request_path= "/"
901
+ ,.request_url= "/"
902
+ ,.num_headers= 1
903
+ ,.headers= { { "Host", "www.example.com" } }
904
+ ,.body= ""
905
+ }
906
+
907
+ #define PROXY_WITH_BASIC_AUTH 33
908
+ , {.name= "host:port and basic_auth"
909
+ ,.type= HTTP_REQUEST
910
+ ,.raw= "GET http://a%12:b!&*$@hypnotoad.org:1234/toto HTTP/1.1\r\n"
911
+ "\r\n"
912
+ ,.should_keep_alive= TRUE
913
+ ,.message_complete_on_eof= FALSE
914
+ ,.http_major= 1
915
+ ,.http_minor= 1
916
+ ,.method= HTTP_GET
917
+ ,.fragment= ""
918
+ ,.request_path= "/toto"
919
+ ,.request_url= "http://a%12:b!&*$@hypnotoad.org:1234/toto"
920
+ ,.host= "hypnotoad.org"
921
+ ,.userinfo= "a%12:b!&*$"
922
+ ,.port= 1234
923
+ ,.num_headers= 0
924
+ ,.headers= { }
925
+ ,.body= ""
926
+ }
927
+
928
+ #define LINE_FOLDING_IN_HEADER_WITH_LF 34
929
+ , {.name= "line folding in header value"
930
+ ,.type= HTTP_REQUEST
931
+ ,.raw= "GET / HTTP/1.1\n"
932
+ "Line1: abc\n"
933
+ "\tdef\n"
934
+ " ghi\n"
935
+ "\t\tjkl\n"
936
+ " mno \n"
937
+ "\t \tqrs\n"
938
+ "Line2: \t line2\t\n"
939
+ "Line3:\n"
940
+ " line3\n"
941
+ "Line4: \n"
942
+ " \n"
943
+ "Connection:\n"
944
+ " close\n"
945
+ "\n"
946
+ ,.should_keep_alive= FALSE
947
+ ,.message_complete_on_eof= FALSE
948
+ ,.http_major= 1
949
+ ,.http_minor= 1
950
+ ,.method= HTTP_GET
951
+ ,.query_string= ""
952
+ ,.fragment= ""
953
+ ,.request_path= "/"
954
+ ,.request_url= "/"
955
+ ,.num_headers= 5
956
+ ,.headers= { { "Line1", "abc\tdef ghi\t\tjkl mno \t \tqrs" }
957
+ , { "Line2", "line2\t" }
958
+ , { "Line3", "line3" }
959
+ , { "Line4", "" }
960
+ , { "Connection", "close" },
961
+ }
962
+ ,.body= ""
963
+ }
964
+
965
+ #define CONNECTION_MULTI 35
966
+ , {.name = "multiple connection header values with folding"
967
+ ,.type= HTTP_REQUEST
968
+ ,.raw= "GET /demo HTTP/1.1\r\n"
969
+ "Host: example.com\r\n"
970
+ "Connection: Something,\r\n"
971
+ " Upgrade, ,Keep-Alive\r\n"
972
+ "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n"
973
+ "Sec-WebSocket-Protocol: sample\r\n"
974
+ "Upgrade: WebSocket\r\n"
975
+ "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n"
976
+ "Origin: http://example.com\r\n"
977
+ "\r\n"
978
+ "Hot diggity dogg"
979
+ ,.should_keep_alive= TRUE
980
+ ,.message_complete_on_eof= FALSE
981
+ ,.http_major= 1
982
+ ,.http_minor= 1
983
+ ,.method= HTTP_GET
984
+ ,.query_string= ""
985
+ ,.fragment= ""
986
+ ,.request_path= "/demo"
987
+ ,.request_url= "/demo"
988
+ ,.num_headers= 7
989
+ ,.upgrade="Hot diggity dogg"
990
+ ,.headers= { { "Host", "example.com" }
991
+ , { "Connection", "Something, Upgrade, ,Keep-Alive" }
992
+ , { "Sec-WebSocket-Key2", "12998 5 Y3 1 .P00" }
993
+ , { "Sec-WebSocket-Protocol", "sample" }
994
+ , { "Upgrade", "WebSocket" }
995
+ , { "Sec-WebSocket-Key1", "4 @1 46546xW%0l 1 5" }
996
+ , { "Origin", "http://example.com" }
997
+ }
998
+ ,.body= ""
999
+ }
1000
+
1001
+ #define CONNECTION_MULTI_LWS 36
1002
+ , {.name = "multiple connection header values with folding and lws"
1003
+ ,.type= HTTP_REQUEST
1004
+ ,.raw= "GET /demo HTTP/1.1\r\n"
1005
+ "Connection: keep-alive, upgrade\r\n"
1006
+ "Upgrade: WebSocket\r\n"
1007
+ "\r\n"
1008
+ "Hot diggity dogg"
1009
+ ,.should_keep_alive= TRUE
1010
+ ,.message_complete_on_eof= FALSE
1011
+ ,.http_major= 1
1012
+ ,.http_minor= 1
1013
+ ,.method= HTTP_GET
1014
+ ,.query_string= ""
1015
+ ,.fragment= ""
1016
+ ,.request_path= "/demo"
1017
+ ,.request_url= "/demo"
1018
+ ,.num_headers= 2
1019
+ ,.upgrade="Hot diggity dogg"
1020
+ ,.headers= { { "Connection", "keep-alive, upgrade" }
1021
+ , { "Upgrade", "WebSocket" }
1022
+ }
1023
+ ,.body= ""
1024
+ }
1025
+
1026
+ #define CONNECTION_MULTI_LWS_CRLF 37
1027
+ , {.name = "multiple connection header values with folding and lws"
1028
+ ,.type= HTTP_REQUEST
1029
+ ,.raw= "GET /demo HTTP/1.1\r\n"
1030
+ "Connection: keep-alive, \r\n upgrade\r\n"
1031
+ "Upgrade: WebSocket\r\n"
1032
+ "\r\n"
1033
+ "Hot diggity dogg"
1034
+ ,.should_keep_alive= TRUE
1035
+ ,.message_complete_on_eof= FALSE
1036
+ ,.http_major= 1
1037
+ ,.http_minor= 1
1038
+ ,.method= HTTP_GET
1039
+ ,.query_string= ""
1040
+ ,.fragment= ""
1041
+ ,.request_path= "/demo"
1042
+ ,.request_url= "/demo"
1043
+ ,.num_headers= 2
1044
+ ,.upgrade="Hot diggity dogg"
1045
+ ,.headers= { { "Connection", "keep-alive, upgrade" }
1046
+ , { "Upgrade", "WebSocket" }
1047
+ }
1048
+ ,.body= ""
1049
+ }
1050
+
1051
+ #define UPGRADE_POST_REQUEST 38
1052
+ , {.name = "upgrade post request"
1053
+ ,.type= HTTP_REQUEST
1054
+ ,.raw= "POST /demo HTTP/1.1\r\n"
1055
+ "Host: example.com\r\n"
1056
+ "Connection: Upgrade\r\n"
1057
+ "Upgrade: HTTP/2.0\r\n"
1058
+ "Content-Length: 15\r\n"
1059
+ "\r\n"
1060
+ "sweet post body"
1061
+ "Hot diggity dogg"
1062
+ ,.should_keep_alive= TRUE
1063
+ ,.message_complete_on_eof= FALSE
1064
+ ,.http_major= 1
1065
+ ,.http_minor= 1
1066
+ ,.method= HTTP_POST
1067
+ ,.request_path= "/demo"
1068
+ ,.request_url= "/demo"
1069
+ ,.num_headers= 4
1070
+ ,.upgrade="Hot diggity dogg"
1071
+ ,.headers= { { "Host", "example.com" }
1072
+ , { "Connection", "Upgrade" }
1073
+ , { "Upgrade", "HTTP/2.0" }
1074
+ , { "Content-Length", "15" }
1075
+ }
1076
+ ,.body= "sweet post body"
1077
+ }
1078
+
1079
+ #define CONNECT_WITH_BODY_REQUEST 39
1080
+ , {.name = "connect with body request"
1081
+ ,.type= HTTP_REQUEST
1082
+ ,.raw= "CONNECT foo.bar.com:443 HTTP/1.0\r\n"
1083
+ "User-agent: Mozilla/1.1N\r\n"
1084
+ "Proxy-authorization: basic aGVsbG86d29ybGQ=\r\n"
1085
+ "Content-Length: 10\r\n"
1086
+ "\r\n"
1087
+ "blarfcicle"
1088
+ ,.should_keep_alive= FALSE
1089
+ ,.message_complete_on_eof= FALSE
1090
+ ,.http_major= 1
1091
+ ,.http_minor= 0
1092
+ ,.method= HTTP_CONNECT
1093
+ ,.request_url= "foo.bar.com:443"
1094
+ ,.num_headers= 3
1095
+ ,.upgrade="blarfcicle"
1096
+ ,.headers= { { "User-agent", "Mozilla/1.1N" }
1097
+ , { "Proxy-authorization", "basic aGVsbG86d29ybGQ=" }
1098
+ , { "Content-Length", "10" }
1099
+ }
1100
+ ,.body= ""
1101
+ }
1102
+
1103
+ /* Examples from the Internet draft for LINK/UNLINK methods:
1104
+ * https://tools.ietf.org/id/draft-snell-link-method-01.html#rfc.section.5
1105
+ */
1106
+
1107
+ #define LINK_REQUEST 40
1108
+ , {.name = "link request"
1109
+ ,.type= HTTP_REQUEST
1110
+ ,.raw= "LINK /images/my_dog.jpg HTTP/1.1\r\n"
1111
+ "Host: example.com\r\n"
1112
+ "Link: <http://example.com/profiles/joe>; rel=\"tag\"\r\n"
1113
+ "Link: <http://example.com/profiles/sally>; rel=\"tag\"\r\n"
1114
+ "\r\n"
1115
+ ,.should_keep_alive= TRUE
1116
+ ,.message_complete_on_eof= FALSE
1117
+ ,.http_major= 1
1118
+ ,.http_minor= 1
1119
+ ,.method= HTTP_LINK
1120
+ ,.request_path= "/images/my_dog.jpg"
1121
+ ,.request_url= "/images/my_dog.jpg"
1122
+ ,.query_string= ""
1123
+ ,.fragment= ""
1124
+ ,.num_headers= 3
1125
+ ,.headers= { { "Host", "example.com" }
1126
+ , { "Link", "<http://example.com/profiles/joe>; rel=\"tag\"" }
1127
+ , { "Link", "<http://example.com/profiles/sally>; rel=\"tag\"" }
1128
+ }
1129
+ ,.body= ""
1130
+ }
1131
+
1132
+ #define UNLINK_REQUEST 41
1133
+ , {.name = "unlink request"
1134
+ ,.type= HTTP_REQUEST
1135
+ ,.raw= "UNLINK /images/my_dog.jpg HTTP/1.1\r\n"
1136
+ "Host: example.com\r\n"
1137
+ "Link: <http://example.com/profiles/sally>; rel=\"tag\"\r\n"
1138
+ "\r\n"
1139
+ ,.should_keep_alive= TRUE
1140
+ ,.message_complete_on_eof= FALSE
1141
+ ,.http_major= 1
1142
+ ,.http_minor= 1
1143
+ ,.method= HTTP_UNLINK
1144
+ ,.request_path= "/images/my_dog.jpg"
1145
+ ,.request_url= "/images/my_dog.jpg"
1146
+ ,.query_string= ""
1147
+ ,.fragment= ""
1148
+ ,.num_headers= 2
1149
+ ,.headers= { { "Host", "example.com" }
1150
+ , { "Link", "<http://example.com/profiles/sally>; rel=\"tag\"" }
1151
+ }
1152
+ ,.body= ""
1153
+ }
1154
+
1155
+ #define SOURCE_REQUEST 42
1156
+ , {.name = "source request"
1157
+ ,.type= HTTP_REQUEST
1158
+ ,.raw= "SOURCE /music/sweet/music HTTP/1.1\r\n"
1159
+ "Host: example.com\r\n"
1160
+ "\r\n"
1161
+ ,.should_keep_alive= TRUE
1162
+ ,.message_complete_on_eof= FALSE
1163
+ ,.http_major= 1
1164
+ ,.http_minor= 1
1165
+ ,.method= HTTP_SOURCE
1166
+ ,.request_path= "/music/sweet/music"
1167
+ ,.request_url= "/music/sweet/music"
1168
+ ,.query_string= ""
1169
+ ,.fragment= ""
1170
+ ,.num_headers= 1
1171
+ ,.headers= { { "Host", "example.com" } }
1172
+ ,.body= ""
1173
+ }
1174
+
1175
+ #define SOURCE_ICE_REQUEST 43
1176
+ , {.name = "source request"
1177
+ ,.type= HTTP_REQUEST
1178
+ ,.raw= "SOURCE /music/sweet/music ICE/1.0\r\n"
1179
+ "Host: example.com\r\n"
1180
+ "\r\n"
1181
+ ,.should_keep_alive= FALSE
1182
+ ,.message_complete_on_eof= FALSE
1183
+ ,.http_major= 1
1184
+ ,.http_minor= 0
1185
+ ,.method= HTTP_SOURCE
1186
+ ,.request_path= "/music/sweet/music"
1187
+ ,.request_url= "/music/sweet/music"
1188
+ ,.query_string= ""
1189
+ ,.fragment= ""
1190
+ ,.num_headers= 1
1191
+ ,.headers= { { "Host", "example.com" } }
1192
+ ,.body= ""
1193
+ }
1194
+
1195
+ #define POST_MULTI_TE_LAST_CHUNKED 44
1196
+ , {.name= "post - multi coding transfer-encoding chunked body"
1197
+ ,.type= HTTP_REQUEST
1198
+ ,.raw= "POST / HTTP/1.1\r\n"
1199
+ "Transfer-Encoding: deflate, chunked\r\n"
1200
+ "\r\n"
1201
+ "1e\r\nall your base are belong to us\r\n"
1202
+ "0\r\n"
1203
+ "\r\n"
1204
+ ,.should_keep_alive= TRUE
1205
+ ,.message_complete_on_eof= FALSE
1206
+ ,.http_major= 1
1207
+ ,.http_minor= 1
1208
+ ,.method= HTTP_POST
1209
+ ,.query_string= ""
1210
+ ,.fragment= ""
1211
+ ,.request_path= "/"
1212
+ ,.request_url= "/"
1213
+ ,.num_headers= 1
1214
+ ,.headers=
1215
+ { { "Transfer-Encoding" , "deflate, chunked" }
1216
+ }
1217
+ ,.body= "all your base are belong to us"
1218
+ ,.num_chunks_complete= 2
1219
+ ,.chunk_lengths= { 0x1e }
1220
+ }
1221
+
1222
+ #define POST_MULTI_LINE_TE_LAST_CHUNKED 45
1223
+ , {.name= "post - multi line coding transfer-encoding chunked body"
1224
+ ,.type= HTTP_REQUEST
1225
+ ,.raw= "POST / HTTP/1.1\r\n"
1226
+ "Transfer-Encoding: deflate,\r\n"
1227
+ " chunked\r\n"
1228
+ "\r\n"
1229
+ "1e\r\nall your base are belong to us\r\n"
1230
+ "0\r\n"
1231
+ "\r\n"
1232
+ ,.should_keep_alive= TRUE
1233
+ ,.message_complete_on_eof= FALSE
1234
+ ,.http_major= 1
1235
+ ,.http_minor= 1
1236
+ ,.method= HTTP_POST
1237
+ ,.query_string= ""
1238
+ ,.fragment= ""
1239
+ ,.request_path= "/"
1240
+ ,.request_url= "/"
1241
+ ,.num_headers= 1
1242
+ ,.headers=
1243
+ { { "Transfer-Encoding" , "deflate, chunked" }
1244
+ }
1245
+ ,.body= "all your base are belong to us"
1246
+ ,.num_chunks_complete= 2
1247
+ ,.chunk_lengths= { 0x1e }
1248
+ }
1249
+ };
1250
+
1251
+ /* * R E S P O N S E S * */
1252
+ const struct message responses[] =
1253
+ #define GOOGLE_301 0
1254
+ { {.name= "google 301"
1255
+ ,.type= HTTP_RESPONSE
1256
+ ,.raw= "HTTP/1.1 301 Moved Permanently\r\n"
1257
+ "Location: http://www.google.com/\r\n"
1258
+ "Content-Type: text/html; charset=UTF-8\r\n"
1259
+ "Date: Sun, 26 Apr 2009 11:11:49 GMT\r\n"
1260
+ "Expires: Tue, 26 May 2009 11:11:49 GMT\r\n"
1261
+ "X-$PrototypeBI-Version: 1.6.0.3\r\n" /* $ char in header field */
1262
+ "Cache-Control: public, max-age=2592000\r\n"
1263
+ "Server: gws\r\n"
1264
+ "Content-Length: 219 \r\n"
1265
+ "\r\n"
1266
+ "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n"
1267
+ "<TITLE>301 Moved</TITLE></HEAD><BODY>\n"
1268
+ "<H1>301 Moved</H1>\n"
1269
+ "The document has moved\n"
1270
+ "<A HREF=\"http://www.google.com/\">here</A>.\r\n"
1271
+ "</BODY></HTML>\r\n"
1272
+ ,.should_keep_alive= TRUE
1273
+ ,.message_complete_on_eof= FALSE
1274
+ ,.http_major= 1
1275
+ ,.http_minor= 1
1276
+ ,.status_code= 301
1277
+ ,.response_status= "Moved Permanently"
1278
+ ,.num_headers= 8
1279
+ ,.headers=
1280
+ { { "Location", "http://www.google.com/" }
1281
+ , { "Content-Type", "text/html; charset=UTF-8" }
1282
+ , { "Date", "Sun, 26 Apr 2009 11:11:49 GMT" }
1283
+ , { "Expires", "Tue, 26 May 2009 11:11:49 GMT" }
1284
+ , { "X-$PrototypeBI-Version", "1.6.0.3" }
1285
+ , { "Cache-Control", "public, max-age=2592000" }
1286
+ , { "Server", "gws" }
1287
+ , { "Content-Length", "219 " }
1288
+ }
1289
+ ,.body= "<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n"
1290
+ "<TITLE>301 Moved</TITLE></HEAD><BODY>\n"
1291
+ "<H1>301 Moved</H1>\n"
1292
+ "The document has moved\n"
1293
+ "<A HREF=\"http://www.google.com/\">here</A>.\r\n"
1294
+ "</BODY></HTML>\r\n"
1295
+ }
1296
+
1297
+ #define NO_CONTENT_LENGTH_RESPONSE 1
1298
+ /* The client should wait for the server's EOF. That is, when content-length
1299
+ * is not specified, and "Connection: close", the end of body is specified
1300
+ * by the EOF.
1301
+ * Compare with APACHEBENCH_GET
1302
+ */
1303
+ , {.name= "no content-length response"
1304
+ ,.type= HTTP_RESPONSE
1305
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1306
+ "Date: Tue, 04 Aug 2009 07:59:32 GMT\r\n"
1307
+ "Server: Apache\r\n"
1308
+ "X-Powered-By: Servlet/2.5 JSP/2.1\r\n"
1309
+ "Content-Type: text/xml; charset=utf-8\r\n"
1310
+ "Connection: close\r\n"
1311
+ "\r\n"
1312
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1313
+ "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
1314
+ " <SOAP-ENV:Body>\n"
1315
+ " <SOAP-ENV:Fault>\n"
1316
+ " <faultcode>SOAP-ENV:Client</faultcode>\n"
1317
+ " <faultstring>Client Error</faultstring>\n"
1318
+ " </SOAP-ENV:Fault>\n"
1319
+ " </SOAP-ENV:Body>\n"
1320
+ "</SOAP-ENV:Envelope>"
1321
+ ,.should_keep_alive= FALSE
1322
+ ,.message_complete_on_eof= TRUE
1323
+ ,.http_major= 1
1324
+ ,.http_minor= 1
1325
+ ,.status_code= 200
1326
+ ,.response_status= "OK"
1327
+ ,.num_headers= 5
1328
+ ,.headers=
1329
+ { { "Date", "Tue, 04 Aug 2009 07:59:32 GMT" }
1330
+ , { "Server", "Apache" }
1331
+ , { "X-Powered-By", "Servlet/2.5 JSP/2.1" }
1332
+ , { "Content-Type", "text/xml; charset=utf-8" }
1333
+ , { "Connection", "close" }
1334
+ }
1335
+ ,.body= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1336
+ "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
1337
+ " <SOAP-ENV:Body>\n"
1338
+ " <SOAP-ENV:Fault>\n"
1339
+ " <faultcode>SOAP-ENV:Client</faultcode>\n"
1340
+ " <faultstring>Client Error</faultstring>\n"
1341
+ " </SOAP-ENV:Fault>\n"
1342
+ " </SOAP-ENV:Body>\n"
1343
+ "</SOAP-ENV:Envelope>"
1344
+ }
1345
+
1346
+ #define NO_HEADERS_NO_BODY_404 2
1347
+ , {.name= "404 no headers no body"
1348
+ ,.type= HTTP_RESPONSE
1349
+ ,.raw= "HTTP/1.1 404 Not Found\r\n\r\n"
1350
+ ,.should_keep_alive= FALSE
1351
+ ,.message_complete_on_eof= TRUE
1352
+ ,.http_major= 1
1353
+ ,.http_minor= 1
1354
+ ,.status_code= 404
1355
+ ,.response_status= "Not Found"
1356
+ ,.num_headers= 0
1357
+ ,.headers= {}
1358
+ ,.body_size= 0
1359
+ ,.body= ""
1360
+ }
1361
+
1362
+ #define NO_REASON_PHRASE 3
1363
+ , {.name= "301 no response phrase"
1364
+ ,.type= HTTP_RESPONSE
1365
+ ,.raw= "HTTP/1.1 301\r\n\r\n"
1366
+ ,.should_keep_alive = FALSE
1367
+ ,.message_complete_on_eof= TRUE
1368
+ ,.http_major= 1
1369
+ ,.http_minor= 1
1370
+ ,.status_code= 301
1371
+ ,.response_status= ""
1372
+ ,.num_headers= 0
1373
+ ,.headers= {}
1374
+ ,.body= ""
1375
+ }
1376
+
1377
+ #define TRAILING_SPACE_ON_CHUNKED_BODY 4
1378
+ , {.name="200 trailing space on chunked body"
1379
+ ,.type= HTTP_RESPONSE
1380
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1381
+ "Content-Type: text/plain\r\n"
1382
+ "Transfer-Encoding: chunked\r\n"
1383
+ "\r\n"
1384
+ "25 \r\n"
1385
+ "This is the data in the first chunk\r\n"
1386
+ "\r\n"
1387
+ "1C\r\n"
1388
+ "and this is the second one\r\n"
1389
+ "\r\n"
1390
+ "0 \r\n"
1391
+ "\r\n"
1392
+ ,.should_keep_alive= TRUE
1393
+ ,.message_complete_on_eof= FALSE
1394
+ ,.http_major= 1
1395
+ ,.http_minor= 1
1396
+ ,.status_code= 200
1397
+ ,.response_status= "OK"
1398
+ ,.num_headers= 2
1399
+ ,.headers=
1400
+ { {"Content-Type", "text/plain" }
1401
+ , {"Transfer-Encoding", "chunked" }
1402
+ }
1403
+ ,.body_size = 37+28
1404
+ ,.body =
1405
+ "This is the data in the first chunk\r\n"
1406
+ "and this is the second one\r\n"
1407
+ ,.num_chunks_complete= 3
1408
+ ,.chunk_lengths= { 0x25, 0x1c }
1409
+ }
1410
+
1411
+ #define NO_CARRIAGE_RET 5
1412
+ , {.name="no carriage ret"
1413
+ ,.type= HTTP_RESPONSE
1414
+ ,.raw= "HTTP/1.1 200 OK\n"
1415
+ "Content-Type: text/html; charset=utf-8\n"
1416
+ "Connection: close\n"
1417
+ "\n"
1418
+ "these headers are from http://news.ycombinator.com/"
1419
+ ,.should_keep_alive= FALSE
1420
+ ,.message_complete_on_eof= TRUE
1421
+ ,.http_major= 1
1422
+ ,.http_minor= 1
1423
+ ,.status_code= 200
1424
+ ,.response_status= "OK"
1425
+ ,.num_headers= 2
1426
+ ,.headers=
1427
+ { {"Content-Type", "text/html; charset=utf-8" }
1428
+ , {"Connection", "close" }
1429
+ }
1430
+ ,.body= "these headers are from http://news.ycombinator.com/"
1431
+ }
1432
+
1433
+ #define PROXY_CONNECTION 6
1434
+ , {.name="proxy connection"
1435
+ ,.type= HTTP_RESPONSE
1436
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1437
+ "Content-Type: text/html; charset=UTF-8\r\n"
1438
+ "Content-Length: 11\r\n"
1439
+ "Proxy-Connection: close\r\n"
1440
+ "Date: Thu, 31 Dec 2009 20:55:48 +0000\r\n"
1441
+ "\r\n"
1442
+ "hello world"
1443
+ ,.should_keep_alive= FALSE
1444
+ ,.message_complete_on_eof= FALSE
1445
+ ,.http_major= 1
1446
+ ,.http_minor= 1
1447
+ ,.status_code= 200
1448
+ ,.response_status= "OK"
1449
+ ,.num_headers= 4
1450
+ ,.headers=
1451
+ { {"Content-Type", "text/html; charset=UTF-8" }
1452
+ , {"Content-Length", "11" }
1453
+ , {"Proxy-Connection", "close" }
1454
+ , {"Date", "Thu, 31 Dec 2009 20:55:48 +0000"}
1455
+ }
1456
+ ,.body= "hello world"
1457
+ }
1458
+
1459
+ #define UNDERSTORE_HEADER_KEY 7
1460
+ // shown by
1461
+ // curl -o /dev/null -v "http://ad.doubleclick.net/pfadx/DARTSHELLCONFIGXML;dcmt=text/xml;"
1462
+ , {.name="underscore header key"
1463
+ ,.type= HTTP_RESPONSE
1464
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1465
+ "Server: DCLK-AdSvr\r\n"
1466
+ "Content-Type: text/xml\r\n"
1467
+ "Content-Length: 0\r\n"
1468
+ "DCLK_imp: v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o\r\n\r\n"
1469
+ ,.should_keep_alive= TRUE
1470
+ ,.message_complete_on_eof= FALSE
1471
+ ,.http_major= 1
1472
+ ,.http_minor= 1
1473
+ ,.status_code= 200
1474
+ ,.response_status= "OK"
1475
+ ,.num_headers= 4
1476
+ ,.headers=
1477
+ { {"Server", "DCLK-AdSvr" }
1478
+ , {"Content-Type", "text/xml" }
1479
+ , {"Content-Length", "0" }
1480
+ , {"DCLK_imp", "v7;x;114750856;0-0;0;17820020;0/0;21603567/21621457/1;;~okv=;dcmt=text/xml;;~cs=o" }
1481
+ }
1482
+ ,.body= ""
1483
+ }
1484
+
1485
+ #define BONJOUR_MADAME_FR 8
1486
+ /* The client should not merge two headers fields when the first one doesn't
1487
+ * have a value.
1488
+ */
1489
+ , {.name= "bonjourmadame.fr"
1490
+ ,.type= HTTP_RESPONSE
1491
+ ,.raw= "HTTP/1.0 301 Moved Permanently\r\n"
1492
+ "Date: Thu, 03 Jun 2010 09:56:32 GMT\r\n"
1493
+ "Server: Apache/2.2.3 (Red Hat)\r\n"
1494
+ "Cache-Control: public\r\n"
1495
+ "Pragma: \r\n"
1496
+ "Location: http://www.bonjourmadame.fr/\r\n"
1497
+ "Vary: Accept-Encoding\r\n"
1498
+ "Content-Length: 0\r\n"
1499
+ "Content-Type: text/html; charset=UTF-8\r\n"
1500
+ "Connection: keep-alive\r\n"
1501
+ "\r\n"
1502
+ ,.should_keep_alive= TRUE
1503
+ ,.message_complete_on_eof= FALSE
1504
+ ,.http_major= 1
1505
+ ,.http_minor= 0
1506
+ ,.status_code= 301
1507
+ ,.response_status= "Moved Permanently"
1508
+ ,.num_headers= 9
1509
+ ,.headers=
1510
+ { { "Date", "Thu, 03 Jun 2010 09:56:32 GMT" }
1511
+ , { "Server", "Apache/2.2.3 (Red Hat)" }
1512
+ , { "Cache-Control", "public" }
1513
+ , { "Pragma", "" }
1514
+ , { "Location", "http://www.bonjourmadame.fr/" }
1515
+ , { "Vary", "Accept-Encoding" }
1516
+ , { "Content-Length", "0" }
1517
+ , { "Content-Type", "text/html; charset=UTF-8" }
1518
+ , { "Connection", "keep-alive" }
1519
+ }
1520
+ ,.body= ""
1521
+ }
1522
+
1523
+ #define RES_FIELD_UNDERSCORE 9
1524
+ /* Should handle spaces in header fields */
1525
+ , {.name= "field underscore"
1526
+ ,.type= HTTP_RESPONSE
1527
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1528
+ "Date: Tue, 28 Sep 2010 01:14:13 GMT\r\n"
1529
+ "Server: Apache\r\n"
1530
+ "Cache-Control: no-cache, must-revalidate\r\n"
1531
+ "Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n"
1532
+ ".et-Cookie: PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com\r\n"
1533
+ "Vary: Accept-Encoding\r\n"
1534
+ "_eep-Alive: timeout=45\r\n" /* semantic value ignored */
1535
+ "_onnection: Keep-Alive\r\n" /* semantic value ignored */
1536
+ "Transfer-Encoding: chunked\r\n"
1537
+ "Content-Type: text/html\r\n"
1538
+ "Connection: close\r\n"
1539
+ "\r\n"
1540
+ "0\r\n\r\n"
1541
+ ,.should_keep_alive= FALSE
1542
+ ,.message_complete_on_eof= FALSE
1543
+ ,.http_major= 1
1544
+ ,.http_minor= 1
1545
+ ,.status_code= 200
1546
+ ,.response_status= "OK"
1547
+ ,.num_headers= 11
1548
+ ,.headers=
1549
+ { { "Date", "Tue, 28 Sep 2010 01:14:13 GMT" }
1550
+ , { "Server", "Apache" }
1551
+ , { "Cache-Control", "no-cache, must-revalidate" }
1552
+ , { "Expires", "Mon, 26 Jul 1997 05:00:00 GMT" }
1553
+ , { ".et-Cookie", "PlaxoCS=1274804622353690521; path=/; domain=.plaxo.com" }
1554
+ , { "Vary", "Accept-Encoding" }
1555
+ , { "_eep-Alive", "timeout=45" }
1556
+ , { "_onnection", "Keep-Alive" }
1557
+ , { "Transfer-Encoding", "chunked" }
1558
+ , { "Content-Type", "text/html" }
1559
+ , { "Connection", "close" }
1560
+ }
1561
+ ,.body= ""
1562
+ ,.num_chunks_complete= 1
1563
+ ,.chunk_lengths= {}
1564
+ }
1565
+
1566
+ #define NON_ASCII_IN_STATUS_LINE 10
1567
+ /* Should handle non-ASCII in status line */
1568
+ , {.name= "non-ASCII in status line"
1569
+ ,.type= HTTP_RESPONSE
1570
+ ,.raw= "HTTP/1.1 500 Oriëntatieprobleem\r\n"
1571
+ "Date: Fri, 5 Nov 2010 23:07:12 GMT+2\r\n"
1572
+ "Content-Length: 0\r\n"
1573
+ "Connection: close\r\n"
1574
+ "\r\n"
1575
+ ,.should_keep_alive= FALSE
1576
+ ,.message_complete_on_eof= FALSE
1577
+ ,.http_major= 1
1578
+ ,.http_minor= 1
1579
+ ,.status_code= 500
1580
+ ,.response_status= "Oriëntatieprobleem"
1581
+ ,.num_headers= 3
1582
+ ,.headers=
1583
+ { { "Date", "Fri, 5 Nov 2010 23:07:12 GMT+2" }
1584
+ , { "Content-Length", "0" }
1585
+ , { "Connection", "close" }
1586
+ }
1587
+ ,.body= ""
1588
+ }
1589
+
1590
+ #define HTTP_VERSION_0_9 11
1591
+ /* Should handle HTTP/0.9 */
1592
+ , {.name= "http version 0.9"
1593
+ ,.type= HTTP_RESPONSE
1594
+ ,.raw= "HTTP/0.9 200 OK\r\n"
1595
+ "\r\n"
1596
+ ,.should_keep_alive= FALSE
1597
+ ,.message_complete_on_eof= TRUE
1598
+ ,.http_major= 0
1599
+ ,.http_minor= 9
1600
+ ,.status_code= 200
1601
+ ,.response_status= "OK"
1602
+ ,.num_headers= 0
1603
+ ,.headers=
1604
+ {}
1605
+ ,.body= ""
1606
+ }
1607
+
1608
+ #define NO_CONTENT_LENGTH_NO_TRANSFER_ENCODING_RESPONSE 12
1609
+ /* The client should wait for the server's EOF. That is, when neither
1610
+ * content-length nor transfer-encoding is specified, the end of body
1611
+ * is specified by the EOF.
1612
+ */
1613
+ , {.name= "neither content-length nor transfer-encoding response"
1614
+ ,.type= HTTP_RESPONSE
1615
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1616
+ "Content-Type: text/plain\r\n"
1617
+ "\r\n"
1618
+ "hello world"
1619
+ ,.should_keep_alive= FALSE
1620
+ ,.message_complete_on_eof= TRUE
1621
+ ,.http_major= 1
1622
+ ,.http_minor= 1
1623
+ ,.status_code= 200
1624
+ ,.response_status= "OK"
1625
+ ,.num_headers= 1
1626
+ ,.headers=
1627
+ { { "Content-Type", "text/plain" }
1628
+ }
1629
+ ,.body= "hello world"
1630
+ }
1631
+
1632
+ #define NO_BODY_HTTP10_KA_200 13
1633
+ , {.name= "HTTP/1.0 with keep-alive and EOF-terminated 200 status"
1634
+ ,.type= HTTP_RESPONSE
1635
+ ,.raw= "HTTP/1.0 200 OK\r\n"
1636
+ "Connection: keep-alive\r\n"
1637
+ "\r\n"
1638
+ ,.should_keep_alive= FALSE
1639
+ ,.message_complete_on_eof= TRUE
1640
+ ,.http_major= 1
1641
+ ,.http_minor= 0
1642
+ ,.status_code= 200
1643
+ ,.response_status= "OK"
1644
+ ,.num_headers= 1
1645
+ ,.headers=
1646
+ { { "Connection", "keep-alive" }
1647
+ }
1648
+ ,.body_size= 0
1649
+ ,.body= ""
1650
+ }
1651
+
1652
+ #define NO_BODY_HTTP10_KA_204 14
1653
+ , {.name= "HTTP/1.0 with keep-alive and a 204 status"
1654
+ ,.type= HTTP_RESPONSE
1655
+ ,.raw= "HTTP/1.0 204 No content\r\n"
1656
+ "Connection: keep-alive\r\n"
1657
+ "\r\n"
1658
+ ,.should_keep_alive= TRUE
1659
+ ,.message_complete_on_eof= FALSE
1660
+ ,.http_major= 1
1661
+ ,.http_minor= 0
1662
+ ,.status_code= 204
1663
+ ,.response_status= "No content"
1664
+ ,.num_headers= 1
1665
+ ,.headers=
1666
+ { { "Connection", "keep-alive" }
1667
+ }
1668
+ ,.body_size= 0
1669
+ ,.body= ""
1670
+ }
1671
+
1672
+ #define NO_BODY_HTTP11_KA_200 15
1673
+ , {.name= "HTTP/1.1 with an EOF-terminated 200 status"
1674
+ ,.type= HTTP_RESPONSE
1675
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1676
+ "\r\n"
1677
+ ,.should_keep_alive= FALSE
1678
+ ,.message_complete_on_eof= TRUE
1679
+ ,.http_major= 1
1680
+ ,.http_minor= 1
1681
+ ,.status_code= 200
1682
+ ,.response_status= "OK"
1683
+ ,.num_headers= 0
1684
+ ,.headers={}
1685
+ ,.body_size= 0
1686
+ ,.body= ""
1687
+ }
1688
+
1689
+ #define NO_BODY_HTTP11_KA_204 16
1690
+ , {.name= "HTTP/1.1 with a 204 status"
1691
+ ,.type= HTTP_RESPONSE
1692
+ ,.raw= "HTTP/1.1 204 No content\r\n"
1693
+ "\r\n"
1694
+ ,.should_keep_alive= TRUE
1695
+ ,.message_complete_on_eof= FALSE
1696
+ ,.http_major= 1
1697
+ ,.http_minor= 1
1698
+ ,.status_code= 204
1699
+ ,.response_status= "No content"
1700
+ ,.num_headers= 0
1701
+ ,.headers={}
1702
+ ,.body_size= 0
1703
+ ,.body= ""
1704
+ }
1705
+
1706
+ #define NO_BODY_HTTP11_NOKA_204 17
1707
+ , {.name= "HTTP/1.1 with a 204 status and keep-alive disabled"
1708
+ ,.type= HTTP_RESPONSE
1709
+ ,.raw= "HTTP/1.1 204 No content\r\n"
1710
+ "Connection: close\r\n"
1711
+ "\r\n"
1712
+ ,.should_keep_alive= FALSE
1713
+ ,.message_complete_on_eof= FALSE
1714
+ ,.http_major= 1
1715
+ ,.http_minor= 1
1716
+ ,.status_code= 204
1717
+ ,.response_status= "No content"
1718
+ ,.num_headers= 1
1719
+ ,.headers=
1720
+ { { "Connection", "close" }
1721
+ }
1722
+ ,.body_size= 0
1723
+ ,.body= ""
1724
+ }
1725
+
1726
+ #define NO_BODY_HTTP11_KA_CHUNKED_200 18
1727
+ , {.name= "HTTP/1.1 with chunked endocing and a 200 response"
1728
+ ,.type= HTTP_RESPONSE
1729
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1730
+ "Transfer-Encoding: chunked\r\n"
1731
+ "\r\n"
1732
+ "0\r\n"
1733
+ "\r\n"
1734
+ ,.should_keep_alive= TRUE
1735
+ ,.message_complete_on_eof= FALSE
1736
+ ,.http_major= 1
1737
+ ,.http_minor= 1
1738
+ ,.status_code= 200
1739
+ ,.response_status= "OK"
1740
+ ,.num_headers= 1
1741
+ ,.headers=
1742
+ { { "Transfer-Encoding", "chunked" }
1743
+ }
1744
+ ,.body_size= 0
1745
+ ,.body= ""
1746
+ ,.num_chunks_complete= 1
1747
+ }
1748
+
1749
+ #if !HTTP_PARSER_STRICT
1750
+ #define SPACE_IN_FIELD_RES 19
1751
+ /* Should handle spaces in header fields */
1752
+ , {.name= "field space"
1753
+ ,.type= HTTP_RESPONSE
1754
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1755
+ "Server: Microsoft-IIS/6.0\r\n"
1756
+ "X-Powered-By: ASP.NET\r\n"
1757
+ "en-US Content-Type: text/xml\r\n" /* this is the problem */
1758
+ "Content-Type: text/xml\r\n"
1759
+ "Content-Length: 16\r\n"
1760
+ "Date: Fri, 23 Jul 2010 18:45:38 GMT\r\n"
1761
+ "Connection: keep-alive\r\n"
1762
+ "\r\n"
1763
+ "<xml>hello</xml>" /* fake body */
1764
+ ,.should_keep_alive= TRUE
1765
+ ,.message_complete_on_eof= FALSE
1766
+ ,.http_major= 1
1767
+ ,.http_minor= 1
1768
+ ,.status_code= 200
1769
+ ,.response_status= "OK"
1770
+ ,.num_headers= 7
1771
+ ,.headers=
1772
+ { { "Server", "Microsoft-IIS/6.0" }
1773
+ , { "X-Powered-By", "ASP.NET" }
1774
+ , { "en-US Content-Type", "text/xml" }
1775
+ , { "Content-Type", "text/xml" }
1776
+ , { "Content-Length", "16" }
1777
+ , { "Date", "Fri, 23 Jul 2010 18:45:38 GMT" }
1778
+ , { "Connection", "keep-alive" }
1779
+ }
1780
+ ,.body= "<xml>hello</xml>"
1781
+ }
1782
+ #endif /* !HTTP_PARSER_STRICT */
1783
+
1784
+ #define AMAZON_COM 20
1785
+ , {.name= "amazon.com"
1786
+ ,.type= HTTP_RESPONSE
1787
+ ,.raw= "HTTP/1.1 301 MovedPermanently\r\n"
1788
+ "Date: Wed, 15 May 2013 17:06:33 GMT\r\n"
1789
+ "Server: Server\r\n"
1790
+ "x-amz-id-1: 0GPHKXSJQ826RK7GZEB2\r\n"
1791
+ "p3p: policyref=\"http://www.amazon.com/w3c/p3p.xml\",CP=\"CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC \"\r\n"
1792
+ "x-amz-id-2: STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD\r\n"
1793
+ "Location: http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846\r\n"
1794
+ "Vary: Accept-Encoding,User-Agent\r\n"
1795
+ "Content-Type: text/html; charset=ISO-8859-1\r\n"
1796
+ "Transfer-Encoding: chunked\r\n"
1797
+ "\r\n"
1798
+ "1\r\n"
1799
+ "\n\r\n"
1800
+ "0\r\n"
1801
+ "\r\n"
1802
+ ,.should_keep_alive= TRUE
1803
+ ,.message_complete_on_eof= FALSE
1804
+ ,.http_major= 1
1805
+ ,.http_minor= 1
1806
+ ,.status_code= 301
1807
+ ,.response_status= "MovedPermanently"
1808
+ ,.num_headers= 9
1809
+ ,.headers= { { "Date", "Wed, 15 May 2013 17:06:33 GMT" }
1810
+ , { "Server", "Server" }
1811
+ , { "x-amz-id-1", "0GPHKXSJQ826RK7GZEB2" }
1812
+ , { "p3p", "policyref=\"http://www.amazon.com/w3c/p3p.xml\",CP=\"CAO DSP LAW CUR ADM IVAo IVDo CONo OTPo OUR DELi PUBi OTRi BUS PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA HEA PRE LOC GOV OTC \"" }
1813
+ , { "x-amz-id-2", "STN69VZxIFSz9YJLbz1GDbxpbjG6Qjmmq5E3DxRhOUw+Et0p4hr7c/Q8qNcx4oAD" }
1814
+ , { "Location", "http://www.amazon.com/Dan-Brown/e/B000AP9DSU/ref=s9_pop_gw_al1?_encoding=UTF8&refinementId=618073011&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0SHYY5BZXN3KR20BNFAY&pf_rd_t=101&pf_rd_p=1263340922&pf_rd_i=507846" }
1815
+ , { "Vary", "Accept-Encoding,User-Agent" }
1816
+ , { "Content-Type", "text/html; charset=ISO-8859-1" }
1817
+ , { "Transfer-Encoding", "chunked" }
1818
+ }
1819
+ ,.body= "\n"
1820
+ ,.num_chunks_complete= 2
1821
+ ,.chunk_lengths= { 1 }
1822
+ }
1823
+
1824
+ #define EMPTY_REASON_PHRASE_AFTER_SPACE 21
1825
+ , {.name= "empty reason phrase after space"
1826
+ ,.type= HTTP_RESPONSE
1827
+ ,.raw= "HTTP/1.1 200 \r\n"
1828
+ "\r\n"
1829
+ ,.should_keep_alive= FALSE
1830
+ ,.message_complete_on_eof= TRUE
1831
+ ,.http_major= 1
1832
+ ,.http_minor= 1
1833
+ ,.status_code= 200
1834
+ ,.response_status= ""
1835
+ ,.num_headers= 0
1836
+ ,.headers= {}
1837
+ ,.body= ""
1838
+ }
1839
+
1840
+ #define CONTENT_LENGTH_X 22
1841
+ , {.name= "Content-Length-X"
1842
+ ,.type= HTTP_RESPONSE
1843
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1844
+ "Content-Length-X: 0\r\n"
1845
+ "Transfer-Encoding: chunked\r\n"
1846
+ "\r\n"
1847
+ "2\r\n"
1848
+ "OK\r\n"
1849
+ "0\r\n"
1850
+ "\r\n"
1851
+ ,.should_keep_alive= TRUE
1852
+ ,.message_complete_on_eof= FALSE
1853
+ ,.http_major= 1
1854
+ ,.http_minor= 1
1855
+ ,.status_code= 200
1856
+ ,.response_status= "OK"
1857
+ ,.num_headers= 2
1858
+ ,.headers= { { "Content-Length-X", "0" }
1859
+ , { "Transfer-Encoding", "chunked" }
1860
+ }
1861
+ ,.body= "OK"
1862
+ ,.num_chunks_complete= 2
1863
+ ,.chunk_lengths= { 2 }
1864
+ }
1865
+
1866
+ #define HTTP_101_RESPONSE_WITH_UPGRADE_HEADER 23
1867
+ , {.name= "HTTP 101 response with Upgrade header"
1868
+ ,.type= HTTP_RESPONSE
1869
+ ,.raw= "HTTP/1.1 101 Switching Protocols\r\n"
1870
+ "Connection: upgrade\r\n"
1871
+ "Upgrade: h2c\r\n"
1872
+ "\r\n"
1873
+ "proto"
1874
+ ,.should_keep_alive= TRUE
1875
+ ,.message_complete_on_eof= FALSE
1876
+ ,.http_major= 1
1877
+ ,.http_minor= 1
1878
+ ,.status_code= 101
1879
+ ,.response_status= "Switching Protocols"
1880
+ ,.upgrade= "proto"
1881
+ ,.num_headers= 2
1882
+ ,.headers=
1883
+ { { "Connection", "upgrade" }
1884
+ , { "Upgrade", "h2c" }
1885
+ }
1886
+ }
1887
+
1888
+ #define HTTP_101_RESPONSE_WITH_UPGRADE_HEADER_AND_CONTENT_LENGTH 24
1889
+ , {.name= "HTTP 101 response with Upgrade and Content-Length header"
1890
+ ,.type= HTTP_RESPONSE
1891
+ ,.raw= "HTTP/1.1 101 Switching Protocols\r\n"
1892
+ "Connection: upgrade\r\n"
1893
+ "Upgrade: h2c\r\n"
1894
+ "Content-Length: 4\r\n"
1895
+ "\r\n"
1896
+ "body"
1897
+ "proto"
1898
+ ,.should_keep_alive= TRUE
1899
+ ,.message_complete_on_eof= FALSE
1900
+ ,.http_major= 1
1901
+ ,.http_minor= 1
1902
+ ,.status_code= 101
1903
+ ,.response_status= "Switching Protocols"
1904
+ ,.body= "body"
1905
+ ,.upgrade= "proto"
1906
+ ,.num_headers= 3
1907
+ ,.headers=
1908
+ { { "Connection", "upgrade" }
1909
+ , { "Upgrade", "h2c" }
1910
+ , { "Content-Length", "4" }
1911
+ }
1912
+ }
1913
+
1914
+ #define HTTP_101_RESPONSE_WITH_UPGRADE_HEADER_AND_TRANSFER_ENCODING 25
1915
+ , {.name= "HTTP 101 response with Upgrade and Transfer-Encoding header"
1916
+ ,.type= HTTP_RESPONSE
1917
+ ,.raw= "HTTP/1.1 101 Switching Protocols\r\n"
1918
+ "Connection: upgrade\r\n"
1919
+ "Upgrade: h2c\r\n"
1920
+ "Transfer-Encoding: chunked\r\n"
1921
+ "\r\n"
1922
+ "2\r\n"
1923
+ "bo\r\n"
1924
+ "2\r\n"
1925
+ "dy\r\n"
1926
+ "0\r\n"
1927
+ "\r\n"
1928
+ "proto"
1929
+ ,.should_keep_alive= TRUE
1930
+ ,.message_complete_on_eof= FALSE
1931
+ ,.http_major= 1
1932
+ ,.http_minor= 1
1933
+ ,.status_code= 101
1934
+ ,.response_status= "Switching Protocols"
1935
+ ,.body= "body"
1936
+ ,.upgrade= "proto"
1937
+ ,.num_headers= 3
1938
+ ,.headers=
1939
+ { { "Connection", "upgrade" }
1940
+ , { "Upgrade", "h2c" }
1941
+ , { "Transfer-Encoding", "chunked" }
1942
+ }
1943
+ ,.num_chunks_complete= 3
1944
+ ,.chunk_lengths= { 2, 2 }
1945
+ }
1946
+
1947
+ #define HTTP_200_RESPONSE_WITH_UPGRADE_HEADER 26
1948
+ , {.name= "HTTP 200 response with Upgrade header"
1949
+ ,.type= HTTP_RESPONSE
1950
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1951
+ "Connection: upgrade\r\n"
1952
+ "Upgrade: h2c\r\n"
1953
+ "\r\n"
1954
+ "body"
1955
+ ,.should_keep_alive= FALSE
1956
+ ,.message_complete_on_eof= TRUE
1957
+ ,.http_major= 1
1958
+ ,.http_minor= 1
1959
+ ,.status_code= 200
1960
+ ,.response_status= "OK"
1961
+ ,.body= "body"
1962
+ ,.upgrade= NULL
1963
+ ,.num_headers= 2
1964
+ ,.headers=
1965
+ { { "Connection", "upgrade" }
1966
+ , { "Upgrade", "h2c" }
1967
+ }
1968
+ }
1969
+
1970
+ #define HTTP_200_RESPONSE_WITH_UPGRADE_HEADER_AND_CONTENT_LENGTH 27
1971
+ , {.name= "HTTP 200 response with Upgrade and Content-Length header"
1972
+ ,.type= HTTP_RESPONSE
1973
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1974
+ "Connection: upgrade\r\n"
1975
+ "Upgrade: h2c\r\n"
1976
+ "Content-Length: 4\r\n"
1977
+ "\r\n"
1978
+ "body"
1979
+ ,.should_keep_alive= TRUE
1980
+ ,.message_complete_on_eof= FALSE
1981
+ ,.http_major= 1
1982
+ ,.http_minor= 1
1983
+ ,.status_code= 200
1984
+ ,.response_status= "OK"
1985
+ ,.num_headers= 3
1986
+ ,.body= "body"
1987
+ ,.upgrade= NULL
1988
+ ,.headers=
1989
+ { { "Connection", "upgrade" }
1990
+ , { "Upgrade", "h2c" }
1991
+ , { "Content-Length", "4" }
1992
+ }
1993
+ }
1994
+
1995
+ #define HTTP_200_RESPONSE_WITH_UPGRADE_HEADER_AND_TRANSFER_ENCODING 28
1996
+ , {.name= "HTTP 200 response with Upgrade and Transfer-Encoding header"
1997
+ ,.type= HTTP_RESPONSE
1998
+ ,.raw= "HTTP/1.1 200 OK\r\n"
1999
+ "Connection: upgrade\r\n"
2000
+ "Upgrade: h2c\r\n"
2001
+ "Transfer-Encoding: chunked\r\n"
2002
+ "\r\n"
2003
+ "2\r\n"
2004
+ "bo\r\n"
2005
+ "2\r\n"
2006
+ "dy\r\n"
2007
+ "0\r\n"
2008
+ "\r\n"
2009
+ ,.should_keep_alive= TRUE
2010
+ ,.message_complete_on_eof= FALSE
2011
+ ,.http_major= 1
2012
+ ,.http_minor= 1
2013
+ ,.status_code= 200
2014
+ ,.response_status= "OK"
2015
+ ,.num_headers= 3
2016
+ ,.body= "body"
2017
+ ,.upgrade= NULL
2018
+ ,.headers=
2019
+ { { "Connection", "upgrade" }
2020
+ , { "Upgrade", "h2c" }
2021
+ , { "Transfer-Encoding", "chunked" }
2022
+ }
2023
+ ,.num_chunks_complete= 3
2024
+ ,.chunk_lengths= { 2, 2 }
2025
+ }
2026
+ #define HTTP_200_MULTI_TE_NOT_LAST_CHUNKED 29
2027
+ , {.name= "HTTP 200 response with `chunked` being *not last* Transfer-Encoding"
2028
+ ,.type= HTTP_RESPONSE
2029
+ ,.raw= "HTTP/1.1 200 OK\r\n"
2030
+ "Transfer-Encoding: chunked, identity\r\n"
2031
+ "\r\n"
2032
+ "2\r\n"
2033
+ "OK\r\n"
2034
+ "0\r\n"
2035
+ "\r\n"
2036
+ ,.should_keep_alive= FALSE
2037
+ ,.message_complete_on_eof= TRUE
2038
+ ,.http_major= 1
2039
+ ,.http_minor= 1
2040
+ ,.status_code= 200
2041
+ ,.response_status= "OK"
2042
+ ,.num_headers= 1
2043
+ ,.headers= { { "Transfer-Encoding", "chunked, identity" }
2044
+ }
2045
+ ,.body= "2\r\nOK\r\n0\r\n\r\n"
2046
+ ,.num_chunks_complete= 0
2047
+ }
2048
+ };
2049
+
2050
+ /* strnlen() is a POSIX.2008 addition. Can't rely on it being available so
2051
+ * define it ourselves.
2052
+ */
2053
+ size_t
2054
+ strnlen(const char *s, size_t maxlen)
2055
+ {
2056
+ const char *p;
2057
+
2058
+ p = memchr(s, '\0', maxlen);
2059
+ if (p == NULL)
2060
+ return maxlen;
2061
+
2062
+ return p - s;
2063
+ }
2064
+
2065
+ size_t
2066
+ strlncat(char *dst, size_t len, const char *src, size_t n)
2067
+ {
2068
+ size_t slen;
2069
+ size_t dlen;
2070
+ size_t rlen;
2071
+ size_t ncpy;
2072
+
2073
+ slen = strnlen(src, n);
2074
+ dlen = strnlen(dst, len);
2075
+
2076
+ if (dlen < len) {
2077
+ rlen = len - dlen;
2078
+ ncpy = slen < rlen ? slen : (rlen - 1);
2079
+ memcpy(dst + dlen, src, ncpy);
2080
+ dst[dlen + ncpy] = '\0';
2081
+ }
2082
+
2083
+ assert(len > slen + dlen);
2084
+ return slen + dlen;
2085
+ }
2086
+
2087
+ size_t
2088
+ strlncpy(char *dst, size_t len, const char *src, size_t n)
2089
+ {
2090
+ size_t slen;
2091
+ size_t ncpy;
2092
+
2093
+ slen = strnlen(src, n);
2094
+
2095
+ if (len > 0) {
2096
+ ncpy = slen < len ? slen : (len - 1);
2097
+ memcpy(dst, src, ncpy);
2098
+ dst[ncpy] = '\0';
2099
+ }
2100
+
2101
+ assert(len > slen);
2102
+ return slen;
2103
+ }
2104
+
2105
+ int
2106
+ request_url_cb (http_parser *p, const char *buf, size_t len)
2107
+ {
2108
+ assert(p == &parser);
2109
+ strlncat(messages[num_messages].request_url,
2110
+ sizeof(messages[num_messages].request_url),
2111
+ buf,
2112
+ len);
2113
+ return 0;
2114
+ }
2115
+
2116
+ int
2117
+ header_field_cb (http_parser *p, const char *buf, size_t len)
2118
+ {
2119
+ assert(p == &parser);
2120
+ struct message *m = &messages[num_messages];
2121
+
2122
+ if (m->last_header_element != FIELD)
2123
+ m->num_headers++;
2124
+
2125
+ strlncat(m->headers[m->num_headers-1][0],
2126
+ sizeof(m->headers[m->num_headers-1][0]),
2127
+ buf,
2128
+ len);
2129
+
2130
+ m->last_header_element = FIELD;
2131
+
2132
+ return 0;
2133
+ }
2134
+
2135
+ int
2136
+ header_value_cb (http_parser *p, const char *buf, size_t len)
2137
+ {
2138
+ assert(p == &parser);
2139
+ struct message *m = &messages[num_messages];
2140
+
2141
+ strlncat(m->headers[m->num_headers-1][1],
2142
+ sizeof(m->headers[m->num_headers-1][1]),
2143
+ buf,
2144
+ len);
2145
+
2146
+ m->last_header_element = VALUE;
2147
+
2148
+ return 0;
2149
+ }
2150
+
2151
+ void
2152
+ check_body_is_final (const http_parser *p)
2153
+ {
2154
+ if (messages[num_messages].body_is_final) {
2155
+ fprintf(stderr, "\n\n *** Error http_body_is_final() should return 1 "
2156
+ "on last on_body callback call "
2157
+ "but it doesn't! ***\n\n");
2158
+ assert(0);
2159
+ abort();
2160
+ }
2161
+ messages[num_messages].body_is_final = http_body_is_final(p);
2162
+ }
2163
+
2164
+ int
2165
+ body_cb (http_parser *p, const char *buf, size_t len)
2166
+ {
2167
+ assert(p == &parser);
2168
+ strlncat(messages[num_messages].body,
2169
+ sizeof(messages[num_messages].body),
2170
+ buf,
2171
+ len);
2172
+ messages[num_messages].body_size += len;
2173
+ check_body_is_final(p);
2174
+ // printf("body_cb: '%s'\n", requests[num_messages].body);
2175
+ return 0;
2176
+ }
2177
+
2178
+ int
2179
+ count_body_cb (http_parser *p, const char *buf, size_t len)
2180
+ {
2181
+ assert(p == &parser);
2182
+ assert(buf);
2183
+ messages[num_messages].body_size += len;
2184
+ check_body_is_final(p);
2185
+ return 0;
2186
+ }
2187
+
2188
+ int
2189
+ message_begin_cb (http_parser *p)
2190
+ {
2191
+ assert(p == &parser);
2192
+ assert(!messages[num_messages].message_begin_cb_called);
2193
+ messages[num_messages].message_begin_cb_called = TRUE;
2194
+ return 0;
2195
+ }
2196
+
2197
+ int
2198
+ headers_complete_cb (http_parser *p)
2199
+ {
2200
+ assert(p == &parser);
2201
+ messages[num_messages].method = parser.method;
2202
+ messages[num_messages].status_code = parser.status_code;
2203
+ messages[num_messages].http_major = parser.http_major;
2204
+ messages[num_messages].http_minor = parser.http_minor;
2205
+ messages[num_messages].headers_complete_cb_called = TRUE;
2206
+ messages[num_messages].should_keep_alive = http_should_keep_alive(&parser);
2207
+ return 0;
2208
+ }
2209
+
2210
+ int
2211
+ message_complete_cb (http_parser *p)
2212
+ {
2213
+ assert(p == &parser);
2214
+ if (messages[num_messages].should_keep_alive !=
2215
+ http_should_keep_alive(&parser))
2216
+ {
2217
+ fprintf(stderr, "\n\n *** Error http_should_keep_alive() should have same "
2218
+ "value in both on_message_complete and on_headers_complete "
2219
+ "but it doesn't! ***\n\n");
2220
+ assert(0);
2221
+ abort();
2222
+ }
2223
+
2224
+ if (messages[num_messages].body_size &&
2225
+ http_body_is_final(p) &&
2226
+ !messages[num_messages].body_is_final)
2227
+ {
2228
+ fprintf(stderr, "\n\n *** Error http_body_is_final() should return 1 "
2229
+ "on last on_body callback call "
2230
+ "but it doesn't! ***\n\n");
2231
+ assert(0);
2232
+ abort();
2233
+ }
2234
+
2235
+ messages[num_messages].message_complete_cb_called = TRUE;
2236
+
2237
+ messages[num_messages].message_complete_on_eof = currently_parsing_eof;
2238
+
2239
+ num_messages++;
2240
+ return 0;
2241
+ }
2242
+
2243
+ int
2244
+ response_status_cb (http_parser *p, const char *buf, size_t len)
2245
+ {
2246
+ assert(p == &parser);
2247
+
2248
+ messages[num_messages].status_cb_called = TRUE;
2249
+
2250
+ strlncat(messages[num_messages].response_status,
2251
+ sizeof(messages[num_messages].response_status),
2252
+ buf,
2253
+ len);
2254
+ return 0;
2255
+ }
2256
+
2257
+ int
2258
+ chunk_header_cb (http_parser *p)
2259
+ {
2260
+ assert(p == &parser);
2261
+ int chunk_idx = messages[num_messages].num_chunks;
2262
+ messages[num_messages].num_chunks++;
2263
+ if (chunk_idx < MAX_CHUNKS) {
2264
+ messages[num_messages].chunk_lengths[chunk_idx] = p->content_length;
2265
+ }
2266
+
2267
+ return 0;
2268
+ }
2269
+
2270
+ int
2271
+ chunk_complete_cb (http_parser *p)
2272
+ {
2273
+ assert(p == &parser);
2274
+
2275
+ /* Here we want to verify that each chunk_header_cb is matched by a
2276
+ * chunk_complete_cb, so not only should the total number of calls to
2277
+ * both callbacks be the same, but they also should be interleaved
2278
+ * properly */
2279
+ assert(messages[num_messages].num_chunks ==
2280
+ messages[num_messages].num_chunks_complete + 1);
2281
+
2282
+ messages[num_messages].num_chunks_complete++;
2283
+ return 0;
2284
+ }
2285
+
2286
+ /* These dontcall_* callbacks exist so that we can verify that when we're
2287
+ * paused, no additional callbacks are invoked */
2288
+ int
2289
+ dontcall_message_begin_cb (http_parser *p)
2290
+ {
2291
+ if (p) { } // gcc
2292
+ fprintf(stderr, "\n\n*** on_message_begin() called on paused parser ***\n\n");
2293
+ abort();
2294
+ }
2295
+
2296
+ int
2297
+ dontcall_header_field_cb (http_parser *p, const char *buf, size_t len)
2298
+ {
2299
+ if (p || buf || len) { } // gcc
2300
+ fprintf(stderr, "\n\n*** on_header_field() called on paused parser ***\n\n");
2301
+ abort();
2302
+ }
2303
+
2304
+ int
2305
+ dontcall_header_value_cb (http_parser *p, const char *buf, size_t len)
2306
+ {
2307
+ if (p || buf || len) { } // gcc
2308
+ fprintf(stderr, "\n\n*** on_header_value() called on paused parser ***\n\n");
2309
+ abort();
2310
+ }
2311
+
2312
+ int
2313
+ dontcall_request_url_cb (http_parser *p, const char *buf, size_t len)
2314
+ {
2315
+ if (p || buf || len) { } // gcc
2316
+ fprintf(stderr, "\n\n*** on_request_url() called on paused parser ***\n\n");
2317
+ abort();
2318
+ }
2319
+
2320
+ int
2321
+ dontcall_body_cb (http_parser *p, const char *buf, size_t len)
2322
+ {
2323
+ if (p || buf || len) { } // gcc
2324
+ fprintf(stderr, "\n\n*** on_body_cb() called on paused parser ***\n\n");
2325
+ abort();
2326
+ }
2327
+
2328
+ int
2329
+ dontcall_headers_complete_cb (http_parser *p)
2330
+ {
2331
+ if (p) { } // gcc
2332
+ fprintf(stderr, "\n\n*** on_headers_complete() called on paused "
2333
+ "parser ***\n\n");
2334
+ abort();
2335
+ }
2336
+
2337
+ int
2338
+ dontcall_message_complete_cb (http_parser *p)
2339
+ {
2340
+ if (p) { } // gcc
2341
+ fprintf(stderr, "\n\n*** on_message_complete() called on paused "
2342
+ "parser ***\n\n");
2343
+ abort();
2344
+ }
2345
+
2346
+ int
2347
+ dontcall_response_status_cb (http_parser *p, const char *buf, size_t len)
2348
+ {
2349
+ if (p || buf || len) { } // gcc
2350
+ fprintf(stderr, "\n\n*** on_status() called on paused parser ***\n\n");
2351
+ abort();
2352
+ }
2353
+
2354
+ int
2355
+ dontcall_chunk_header_cb (http_parser *p)
2356
+ {
2357
+ if (p) { } // gcc
2358
+ fprintf(stderr, "\n\n*** on_chunk_header() called on paused parser ***\n\n");
2359
+ exit(1);
2360
+ }
2361
+
2362
+ int
2363
+ dontcall_chunk_complete_cb (http_parser *p)
2364
+ {
2365
+ if (p) { } // gcc
2366
+ fprintf(stderr, "\n\n*** on_chunk_complete() "
2367
+ "called on paused parser ***\n\n");
2368
+ exit(1);
2369
+ }
2370
+
2371
+ static http_parser_settings settings_dontcall =
2372
+ {.on_message_begin = dontcall_message_begin_cb
2373
+ ,.on_header_field = dontcall_header_field_cb
2374
+ ,.on_header_value = dontcall_header_value_cb
2375
+ ,.on_url = dontcall_request_url_cb
2376
+ ,.on_status = dontcall_response_status_cb
2377
+ ,.on_body = dontcall_body_cb
2378
+ ,.on_headers_complete = dontcall_headers_complete_cb
2379
+ ,.on_message_complete = dontcall_message_complete_cb
2380
+ ,.on_chunk_header = dontcall_chunk_header_cb
2381
+ ,.on_chunk_complete = dontcall_chunk_complete_cb
2382
+ };
2383
+
2384
+ /* These pause_* callbacks always pause the parser and just invoke the regular
2385
+ * callback that tracks content. Before returning, we overwrite the parser
2386
+ * settings to point to the _dontcall variety so that we can verify that
2387
+ * the pause actually did, you know, pause. */
2388
+ int
2389
+ pause_message_begin_cb (http_parser *p)
2390
+ {
2391
+ http_parser_pause(p, 1);
2392
+ *current_pause_parser = settings_dontcall;
2393
+ return message_begin_cb(p);
2394
+ }
2395
+
2396
+ int
2397
+ pause_header_field_cb (http_parser *p, const char *buf, size_t len)
2398
+ {
2399
+ http_parser_pause(p, 1);
2400
+ *current_pause_parser = settings_dontcall;
2401
+ return header_field_cb(p, buf, len);
2402
+ }
2403
+
2404
+ int
2405
+ pause_header_value_cb (http_parser *p, const char *buf, size_t len)
2406
+ {
2407
+ http_parser_pause(p, 1);
2408
+ *current_pause_parser = settings_dontcall;
2409
+ return header_value_cb(p, buf, len);
2410
+ }
2411
+
2412
+ int
2413
+ pause_request_url_cb (http_parser *p, const char *buf, size_t len)
2414
+ {
2415
+ http_parser_pause(p, 1);
2416
+ *current_pause_parser = settings_dontcall;
2417
+ return request_url_cb(p, buf, len);
2418
+ }
2419
+
2420
+ int
2421
+ pause_body_cb (http_parser *p, const char *buf, size_t len)
2422
+ {
2423
+ http_parser_pause(p, 1);
2424
+ *current_pause_parser = settings_dontcall;
2425
+ return body_cb(p, buf, len);
2426
+ }
2427
+
2428
+ int
2429
+ pause_headers_complete_cb (http_parser *p)
2430
+ {
2431
+ http_parser_pause(p, 1);
2432
+ *current_pause_parser = settings_dontcall;
2433
+ return headers_complete_cb(p);
2434
+ }
2435
+
2436
+ int
2437
+ pause_message_complete_cb (http_parser *p)
2438
+ {
2439
+ http_parser_pause(p, 1);
2440
+ *current_pause_parser = settings_dontcall;
2441
+ return message_complete_cb(p);
2442
+ }
2443
+
2444
+ int
2445
+ pause_response_status_cb (http_parser *p, const char *buf, size_t len)
2446
+ {
2447
+ http_parser_pause(p, 1);
2448
+ *current_pause_parser = settings_dontcall;
2449
+ return response_status_cb(p, buf, len);
2450
+ }
2451
+
2452
+ int
2453
+ pause_chunk_header_cb (http_parser *p)
2454
+ {
2455
+ http_parser_pause(p, 1);
2456
+ *current_pause_parser = settings_dontcall;
2457
+ return chunk_header_cb(p);
2458
+ }
2459
+
2460
+ int
2461
+ pause_chunk_complete_cb (http_parser *p)
2462
+ {
2463
+ http_parser_pause(p, 1);
2464
+ *current_pause_parser = settings_dontcall;
2465
+ return chunk_complete_cb(p);
2466
+ }
2467
+
2468
+ int
2469
+ connect_headers_complete_cb (http_parser *p)
2470
+ {
2471
+ headers_complete_cb(p);
2472
+ return 1;
2473
+ }
2474
+
2475
+ int
2476
+ connect_message_complete_cb (http_parser *p)
2477
+ {
2478
+ messages[num_messages].should_keep_alive = http_should_keep_alive(&parser);
2479
+ return message_complete_cb(p);
2480
+ }
2481
+
2482
+ static http_parser_settings settings_pause =
2483
+ {.on_message_begin = pause_message_begin_cb
2484
+ ,.on_header_field = pause_header_field_cb
2485
+ ,.on_header_value = pause_header_value_cb
2486
+ ,.on_url = pause_request_url_cb
2487
+ ,.on_status = pause_response_status_cb
2488
+ ,.on_body = pause_body_cb
2489
+ ,.on_headers_complete = pause_headers_complete_cb
2490
+ ,.on_message_complete = pause_message_complete_cb
2491
+ ,.on_chunk_header = pause_chunk_header_cb
2492
+ ,.on_chunk_complete = pause_chunk_complete_cb
2493
+ };
2494
+
2495
+ static http_parser_settings settings =
2496
+ {.on_message_begin = message_begin_cb
2497
+ ,.on_header_field = header_field_cb
2498
+ ,.on_header_value = header_value_cb
2499
+ ,.on_url = request_url_cb
2500
+ ,.on_status = response_status_cb
2501
+ ,.on_body = body_cb
2502
+ ,.on_headers_complete = headers_complete_cb
2503
+ ,.on_message_complete = message_complete_cb
2504
+ ,.on_chunk_header = chunk_header_cb
2505
+ ,.on_chunk_complete = chunk_complete_cb
2506
+ };
2507
+
2508
+ static http_parser_settings settings_count_body =
2509
+ {.on_message_begin = message_begin_cb
2510
+ ,.on_header_field = header_field_cb
2511
+ ,.on_header_value = header_value_cb
2512
+ ,.on_url = request_url_cb
2513
+ ,.on_status = response_status_cb
2514
+ ,.on_body = count_body_cb
2515
+ ,.on_headers_complete = headers_complete_cb
2516
+ ,.on_message_complete = message_complete_cb
2517
+ ,.on_chunk_header = chunk_header_cb
2518
+ ,.on_chunk_complete = chunk_complete_cb
2519
+ };
2520
+
2521
+ static http_parser_settings settings_connect =
2522
+ {.on_message_begin = message_begin_cb
2523
+ ,.on_header_field = header_field_cb
2524
+ ,.on_header_value = header_value_cb
2525
+ ,.on_url = request_url_cb
2526
+ ,.on_status = response_status_cb
2527
+ ,.on_body = dontcall_body_cb
2528
+ ,.on_headers_complete = connect_headers_complete_cb
2529
+ ,.on_message_complete = connect_message_complete_cb
2530
+ ,.on_chunk_header = chunk_header_cb
2531
+ ,.on_chunk_complete = chunk_complete_cb
2532
+ };
2533
+
2534
+ static http_parser_settings settings_null =
2535
+ {.on_message_begin = 0
2536
+ ,.on_header_field = 0
2537
+ ,.on_header_value = 0
2538
+ ,.on_url = 0
2539
+ ,.on_status = 0
2540
+ ,.on_body = 0
2541
+ ,.on_headers_complete = 0
2542
+ ,.on_message_complete = 0
2543
+ ,.on_chunk_header = 0
2544
+ ,.on_chunk_complete = 0
2545
+ };
2546
+
2547
+ void
2548
+ parser_init (enum http_parser_type type)
2549
+ {
2550
+ num_messages = 0;
2551
+ http_parser_init(&parser, type);
2552
+ memset(&messages, 0, sizeof messages);
2553
+ }
2554
+
2555
+ size_t parse (const char *buf, size_t len)
2556
+ {
2557
+ size_t nparsed;
2558
+ currently_parsing_eof = (len == 0);
2559
+ nparsed = http_parser_execute(&parser, &settings, buf, len);
2560
+ return nparsed;
2561
+ }
2562
+
2563
+ size_t parse_count_body (const char *buf, size_t len)
2564
+ {
2565
+ size_t nparsed;
2566
+ currently_parsing_eof = (len == 0);
2567
+ nparsed = http_parser_execute(&parser, &settings_count_body, buf, len);
2568
+ return nparsed;
2569
+ }
2570
+
2571
+ size_t parse_pause (const char *buf, size_t len)
2572
+ {
2573
+ size_t nparsed;
2574
+ http_parser_settings s = settings_pause;
2575
+
2576
+ currently_parsing_eof = (len == 0);
2577
+ current_pause_parser = &s;
2578
+ nparsed = http_parser_execute(&parser, current_pause_parser, buf, len);
2579
+ return nparsed;
2580
+ }
2581
+
2582
+ size_t parse_connect (const char *buf, size_t len)
2583
+ {
2584
+ size_t nparsed;
2585
+ currently_parsing_eof = (len == 0);
2586
+ nparsed = http_parser_execute(&parser, &settings_connect, buf, len);
2587
+ return nparsed;
2588
+ }
2589
+
2590
+ static inline int
2591
+ check_str_eq (const struct message *m,
2592
+ const char *prop,
2593
+ const char *expected,
2594
+ const char *found) {
2595
+ if ((expected == NULL) != (found == NULL)) {
2596
+ printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name);
2597
+ printf("expected %s\n", (expected == NULL) ? "NULL" : expected);
2598
+ printf(" found %s\n", (found == NULL) ? "NULL" : found);
2599
+ return 0;
2600
+ }
2601
+ if (expected != NULL && 0 != strcmp(expected, found)) {
2602
+ printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name);
2603
+ printf("expected '%s'\n", expected);
2604
+ printf(" found '%s'\n", found);
2605
+ return 0;
2606
+ }
2607
+ return 1;
2608
+ }
2609
+
2610
+ static inline int
2611
+ check_num_eq (const struct message *m,
2612
+ const char *prop,
2613
+ int expected,
2614
+ int found) {
2615
+ if (expected != found) {
2616
+ printf("\n*** Error: %s in '%s' ***\n\n", prop, m->name);
2617
+ printf("expected %d\n", expected);
2618
+ printf(" found %d\n", found);
2619
+ return 0;
2620
+ }
2621
+ return 1;
2622
+ }
2623
+
2624
+ #define MESSAGE_CHECK_STR_EQ(expected, found, prop) \
2625
+ if (!check_str_eq(expected, #prop, expected->prop, found->prop)) return 0
2626
+
2627
+ #define MESSAGE_CHECK_NUM_EQ(expected, found, prop) \
2628
+ if (!check_num_eq(expected, #prop, expected->prop, found->prop)) return 0
2629
+
2630
+ #define MESSAGE_CHECK_URL_EQ(u, expected, found, prop, fn) \
2631
+ do { \
2632
+ char ubuf[256]; \
2633
+ \
2634
+ if ((u)->field_set & (1 << (fn))) { \
2635
+ memcpy(ubuf, (found)->request_url + (u)->field_data[(fn)].off, \
2636
+ (u)->field_data[(fn)].len); \
2637
+ ubuf[(u)->field_data[(fn)].len] = '\0'; \
2638
+ } else { \
2639
+ ubuf[0] = '\0'; \
2640
+ } \
2641
+ \
2642
+ check_str_eq(expected, #prop, expected->prop, ubuf); \
2643
+ } while(0)
2644
+
2645
+ int
2646
+ message_eq (int index, int connect, const struct message *expected)
2647
+ {
2648
+ int i;
2649
+ struct message *m = &messages[index];
2650
+
2651
+ MESSAGE_CHECK_NUM_EQ(expected, m, http_major);
2652
+ MESSAGE_CHECK_NUM_EQ(expected, m, http_minor);
2653
+
2654
+ if (expected->type == HTTP_REQUEST) {
2655
+ MESSAGE_CHECK_NUM_EQ(expected, m, method);
2656
+ } else {
2657
+ MESSAGE_CHECK_NUM_EQ(expected, m, status_code);
2658
+ MESSAGE_CHECK_STR_EQ(expected, m, response_status);
2659
+ assert(m->status_cb_called);
2660
+ }
2661
+
2662
+ if (!connect) {
2663
+ MESSAGE_CHECK_NUM_EQ(expected, m, should_keep_alive);
2664
+ MESSAGE_CHECK_NUM_EQ(expected, m, message_complete_on_eof);
2665
+ }
2666
+
2667
+ assert(m->message_begin_cb_called);
2668
+ assert(m->headers_complete_cb_called);
2669
+ assert(m->message_complete_cb_called);
2670
+
2671
+
2672
+ MESSAGE_CHECK_STR_EQ(expected, m, request_url);
2673
+
2674
+ /* Check URL components; we can't do this w/ CONNECT since it doesn't
2675
+ * send us a well-formed URL.
2676
+ */
2677
+ if (*m->request_url && m->method != HTTP_CONNECT) {
2678
+ struct http_parser_url u;
2679
+
2680
+ if (http_parser_parse_url(m->request_url, strlen(m->request_url), 0, &u)) {
2681
+ fprintf(stderr, "\n\n*** failed to parse URL %s ***\n\n",
2682
+ m->request_url);
2683
+ abort();
2684
+ }
2685
+
2686
+ if (expected->host) {
2687
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, host, UF_HOST);
2688
+ }
2689
+
2690
+ if (expected->userinfo) {
2691
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, userinfo, UF_USERINFO);
2692
+ }
2693
+
2694
+ m->port = (u.field_set & (1 << UF_PORT)) ?
2695
+ u.port : 0;
2696
+
2697
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, query_string, UF_QUERY);
2698
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, fragment, UF_FRAGMENT);
2699
+ MESSAGE_CHECK_URL_EQ(&u, expected, m, request_path, UF_PATH);
2700
+ MESSAGE_CHECK_NUM_EQ(expected, m, port);
2701
+ }
2702
+
2703
+ if (connect) {
2704
+ check_num_eq(m, "body_size", 0, m->body_size);
2705
+ } else if (expected->body_size) {
2706
+ MESSAGE_CHECK_NUM_EQ(expected, m, body_size);
2707
+ } else {
2708
+ MESSAGE_CHECK_STR_EQ(expected, m, body);
2709
+ }
2710
+
2711
+ if (connect) {
2712
+ check_num_eq(m, "num_chunks_complete", 0, m->num_chunks_complete);
2713
+ } else {
2714
+ assert(m->num_chunks == m->num_chunks_complete);
2715
+ MESSAGE_CHECK_NUM_EQ(expected, m, num_chunks_complete);
2716
+ for (i = 0; i < m->num_chunks && i < MAX_CHUNKS; i++) {
2717
+ MESSAGE_CHECK_NUM_EQ(expected, m, chunk_lengths[i]);
2718
+ }
2719
+ }
2720
+
2721
+ MESSAGE_CHECK_NUM_EQ(expected, m, num_headers);
2722
+
2723
+ int r;
2724
+ for (i = 0; i < m->num_headers; i++) {
2725
+ r = check_str_eq(expected, "header field", expected->headers[i][0], m->headers[i][0]);
2726
+ if (!r) return 0;
2727
+ r = check_str_eq(expected, "header value", expected->headers[i][1], m->headers[i][1]);
2728
+ if (!r) return 0;
2729
+ }
2730
+
2731
+ if (!connect) {
2732
+ MESSAGE_CHECK_STR_EQ(expected, m, upgrade);
2733
+ }
2734
+
2735
+ return 1;
2736
+ }
2737
+
2738
+ /* Given a sequence of varargs messages, return the number of them that the
2739
+ * parser should successfully parse, taking into account that upgraded
2740
+ * messages prevent all subsequent messages from being parsed.
2741
+ */
2742
+ size_t
2743
+ count_parsed_messages(const size_t nmsgs, ...) {
2744
+ size_t i;
2745
+ va_list ap;
2746
+
2747
+ va_start(ap, nmsgs);
2748
+
2749
+ for (i = 0; i < nmsgs; i++) {
2750
+ struct message *m = va_arg(ap, struct message *);
2751
+
2752
+ if (m->upgrade) {
2753
+ va_end(ap);
2754
+ return i + 1;
2755
+ }
2756
+ }
2757
+
2758
+ va_end(ap);
2759
+ return nmsgs;
2760
+ }
2761
+
2762
+ /* Given a sequence of bytes and the number of these that we were able to
2763
+ * parse, verify that upgrade bodies are correct.
2764
+ */
2765
+ void
2766
+ upgrade_message_fix(char *body, const size_t nread, const size_t nmsgs, ...) {
2767
+ va_list ap;
2768
+ size_t i;
2769
+ size_t off = 0;
2770
+
2771
+ va_start(ap, nmsgs);
2772
+
2773
+ for (i = 0; i < nmsgs; i++) {
2774
+ struct message *m = va_arg(ap, struct message *);
2775
+
2776
+ off += strlen(m->raw);
2777
+
2778
+ if (m->upgrade) {
2779
+ off -= strlen(m->upgrade);
2780
+
2781
+ /* Check the portion of the response after its specified upgrade */
2782
+ if (!check_str_eq(m, "upgrade", body + off, body + nread)) {
2783
+ abort();
2784
+ }
2785
+
2786
+ /* Fix up the response so that message_eq() will verify the beginning
2787
+ * of the upgrade */
2788
+ *(body + nread + strlen(m->upgrade)) = '\0';
2789
+ messages[num_messages -1 ].upgrade = body + nread;
2790
+
2791
+ va_end(ap);
2792
+ return;
2793
+ }
2794
+ }
2795
+
2796
+ va_end(ap);
2797
+ printf("\n\n*** Error: expected a message with upgrade ***\n");
2798
+
2799
+ abort();
2800
+ }
2801
+
2802
+ static void
2803
+ print_error (const char *raw, size_t error_location)
2804
+ {
2805
+ fprintf(stderr, "\n*** %s ***\n\n",
2806
+ http_errno_description(HTTP_PARSER_ERRNO(&parser)));
2807
+
2808
+ int this_line = 0, char_len = 0;
2809
+ size_t i, j, len = strlen(raw), error_location_line = 0;
2810
+ for (i = 0; i < len; i++) {
2811
+ if (i == error_location) this_line = 1;
2812
+ switch (raw[i]) {
2813
+ case '\r':
2814
+ char_len = 2;
2815
+ fprintf(stderr, "\\r");
2816
+ break;
2817
+
2818
+ case '\n':
2819
+ fprintf(stderr, "\\n\n");
2820
+
2821
+ if (this_line) goto print;
2822
+
2823
+ error_location_line = 0;
2824
+ continue;
2825
+
2826
+ default:
2827
+ char_len = 1;
2828
+ fputc(raw[i], stderr);
2829
+ break;
2830
+ }
2831
+ if (!this_line) error_location_line += char_len;
2832
+ }
2833
+
2834
+ fprintf(stderr, "[eof]\n");
2835
+
2836
+ print:
2837
+ for (j = 0; j < error_location_line; j++) {
2838
+ fputc(' ', stderr);
2839
+ }
2840
+ fprintf(stderr, "^\n\nerror location: %u\n", (unsigned int)error_location);
2841
+ }
2842
+
2843
+ void
2844
+ test_preserve_data (void)
2845
+ {
2846
+ char my_data[] = "application-specific data";
2847
+ http_parser parser;
2848
+ parser.data = my_data;
2849
+ http_parser_init(&parser, HTTP_REQUEST);
2850
+ if (parser.data != my_data) {
2851
+ printf("\n*** parser.data not preserved accross http_parser_init ***\n\n");
2852
+ abort();
2853
+ }
2854
+ }
2855
+
2856
+ struct url_test {
2857
+ const char *name;
2858
+ const char *url;
2859
+ int is_connect;
2860
+ struct http_parser_url u;
2861
+ int rv;
2862
+ };
2863
+
2864
+ const struct url_test url_tests[] =
2865
+ { {.name="proxy request"
2866
+ ,.url="http://hostname/"
2867
+ ,.is_connect=0
2868
+ ,.u=
2869
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH)
2870
+ ,.port=0
2871
+ ,.field_data=
2872
+ {{ 0, 4 } /* UF_SCHEMA */
2873
+ ,{ 7, 8 } /* UF_HOST */
2874
+ ,{ 0, 0 } /* UF_PORT */
2875
+ ,{ 15, 1 } /* UF_PATH */
2876
+ ,{ 0, 0 } /* UF_QUERY */
2877
+ ,{ 0, 0 } /* UF_FRAGMENT */
2878
+ ,{ 0, 0 } /* UF_USERINFO */
2879
+ }
2880
+ }
2881
+ ,.rv=0
2882
+ }
2883
+
2884
+ , {.name="proxy request with port"
2885
+ ,.url="http://hostname:444/"
2886
+ ,.is_connect=0
2887
+ ,.u=
2888
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH)
2889
+ ,.port=444
2890
+ ,.field_data=
2891
+ {{ 0, 4 } /* UF_SCHEMA */
2892
+ ,{ 7, 8 } /* UF_HOST */
2893
+ ,{ 16, 3 } /* UF_PORT */
2894
+ ,{ 19, 1 } /* UF_PATH */
2895
+ ,{ 0, 0 } /* UF_QUERY */
2896
+ ,{ 0, 0 } /* UF_FRAGMENT */
2897
+ ,{ 0, 0 } /* UF_USERINFO */
2898
+ }
2899
+ }
2900
+ ,.rv=0
2901
+ }
2902
+
2903
+ , {.name="CONNECT request"
2904
+ ,.url="hostname:443"
2905
+ ,.is_connect=1
2906
+ ,.u=
2907
+ {.field_set=(1 << UF_HOST) | (1 << UF_PORT)
2908
+ ,.port=443
2909
+ ,.field_data=
2910
+ {{ 0, 0 } /* UF_SCHEMA */
2911
+ ,{ 0, 8 } /* UF_HOST */
2912
+ ,{ 9, 3 } /* UF_PORT */
2913
+ ,{ 0, 0 } /* UF_PATH */
2914
+ ,{ 0, 0 } /* UF_QUERY */
2915
+ ,{ 0, 0 } /* UF_FRAGMENT */
2916
+ ,{ 0, 0 } /* UF_USERINFO */
2917
+ }
2918
+ }
2919
+ ,.rv=0
2920
+ }
2921
+
2922
+ , {.name="CONNECT request but not connect"
2923
+ ,.url="hostname:443"
2924
+ ,.is_connect=0
2925
+ ,.rv=1
2926
+ }
2927
+
2928
+ , {.name="proxy ipv6 request"
2929
+ ,.url="http://[1:2::3:4]/"
2930
+ ,.is_connect=0
2931
+ ,.u=
2932
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH)
2933
+ ,.port=0
2934
+ ,.field_data=
2935
+ {{ 0, 4 } /* UF_SCHEMA */
2936
+ ,{ 8, 8 } /* UF_HOST */
2937
+ ,{ 0, 0 } /* UF_PORT */
2938
+ ,{ 17, 1 } /* UF_PATH */
2939
+ ,{ 0, 0 } /* UF_QUERY */
2940
+ ,{ 0, 0 } /* UF_FRAGMENT */
2941
+ ,{ 0, 0 } /* UF_USERINFO */
2942
+ }
2943
+ }
2944
+ ,.rv=0
2945
+ }
2946
+
2947
+ , {.name="proxy ipv6 request with port"
2948
+ ,.url="http://[1:2::3:4]:67/"
2949
+ ,.is_connect=0
2950
+ ,.u=
2951
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PORT) | (1 << UF_PATH)
2952
+ ,.port=67
2953
+ ,.field_data=
2954
+ {{ 0, 4 } /* UF_SCHEMA */
2955
+ ,{ 8, 8 } /* UF_HOST */
2956
+ ,{ 18, 2 } /* UF_PORT */
2957
+ ,{ 20, 1 } /* UF_PATH */
2958
+ ,{ 0, 0 } /* UF_QUERY */
2959
+ ,{ 0, 0 } /* UF_FRAGMENT */
2960
+ ,{ 0, 0 } /* UF_USERINFO */
2961
+ }
2962
+ }
2963
+ ,.rv=0
2964
+ }
2965
+
2966
+ , {.name="CONNECT ipv6 address"
2967
+ ,.url="[1:2::3:4]:443"
2968
+ ,.is_connect=1
2969
+ ,.u=
2970
+ {.field_set=(1 << UF_HOST) | (1 << UF_PORT)
2971
+ ,.port=443
2972
+ ,.field_data=
2973
+ {{ 0, 0 } /* UF_SCHEMA */
2974
+ ,{ 1, 8 } /* UF_HOST */
2975
+ ,{ 11, 3 } /* UF_PORT */
2976
+ ,{ 0, 0 } /* UF_PATH */
2977
+ ,{ 0, 0 } /* UF_QUERY */
2978
+ ,{ 0, 0 } /* UF_FRAGMENT */
2979
+ ,{ 0, 0 } /* UF_USERINFO */
2980
+ }
2981
+ }
2982
+ ,.rv=0
2983
+ }
2984
+
2985
+ , {.name="ipv4 in ipv6 address"
2986
+ ,.url="http://[2001:0000:0000:0000:0000:0000:1.9.1.1]/"
2987
+ ,.is_connect=0
2988
+ ,.u=
2989
+ {.field_set=(1 << UF_SCHEMA) | (1 << UF_HOST) | (1 << UF_PATH)
2990
+ ,.port=0
2991
+ ,.field_data=
2992
+ {{ 0, 4 } /* UF_SCHEMA */
2993
+ ,{ 8, 37 } /* UF_HOST */
2994
+ ,{ 0, 0 } /* UF_PORT */
2995
+ ,{ 46, 1 } /* UF_PATH */
2996
+ ,{ 0, 0 } /* UF_QUERY */
2997
+ ,{ 0, 0 } /* UF_FRAGMENT */
2998
+ ,{ 0, 0 } /* UF_USERINFO */
2999
+ }
3000
+ }
3001
+ ,.rv=0
3002
+ }
3003
+
3004
+ , {.name="extra ? in query string"
3005
+ ,.url="http://a.tbcdn.cn/p/fp/2010c/??fp-header-min.css,fp-base-min.css,"
3006
+ "fp-channel-min.css,fp-product-min.css,fp-mall-min.css,fp-category-min.css,"
3007
+ "fp-sub-min.css,fp-gdp4p-min.css,fp-css3-min.css,fp-misc-min.css?t=20101022.css"
3008
+ ,.is_connect=0
3009
+ ,.u=
3010
+ {.field_set=(1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_QUERY)
3011
+ ,.port=0
3012
+ ,.field_data=
3013
+ {{ 0, 4 } /* UF_SCHEMA */
3014
+ ,{ 7, 10 } /* UF_HOST */
3015
+ ,{ 0, 0 } /* UF_PORT */
3016
+ ,{ 17, 12 } /* UF_PATH */
3017
+ ,{ 30,187 } /* UF_QUERY */
3018
+ ,{ 0, 0 } /* UF_FRAGMENT */
3019
+ ,{ 0, 0 } /* UF_USERINFO */
3020
+ }
3021
+ }
3022
+ ,.rv=0
3023
+ }
3024
+
3025
+ , {.name="space URL encoded"
3026
+ ,.url="/toto.html?toto=a%20b"
3027
+ ,.is_connect=0
3028
+ ,.u=
3029
+ {.field_set= (1<<UF_PATH) | (1<<UF_QUERY)
3030
+ ,.port=0
3031
+ ,.field_data=
3032
+ {{ 0, 0 } /* UF_SCHEMA */
3033
+ ,{ 0, 0 } /* UF_HOST */
3034
+ ,{ 0, 0 } /* UF_PORT */
3035
+ ,{ 0, 10 } /* UF_PATH */
3036
+ ,{ 11, 10 } /* UF_QUERY */
3037
+ ,{ 0, 0 } /* UF_FRAGMENT */
3038
+ ,{ 0, 0 } /* UF_USERINFO */
3039
+ }
3040
+ }
3041
+ ,.rv=0
3042
+ }
3043
+
3044
+
3045
+ , {.name="URL fragment"
3046
+ ,.url="/toto.html#titi"
3047
+ ,.is_connect=0
3048
+ ,.u=
3049
+ {.field_set= (1<<UF_PATH) | (1<<UF_FRAGMENT)
3050
+ ,.port=0
3051
+ ,.field_data=
3052
+ {{ 0, 0 } /* UF_SCHEMA */
3053
+ ,{ 0, 0 } /* UF_HOST */
3054
+ ,{ 0, 0 } /* UF_PORT */
3055
+ ,{ 0, 10 } /* UF_PATH */
3056
+ ,{ 0, 0 } /* UF_QUERY */
3057
+ ,{ 11, 4 } /* UF_FRAGMENT */
3058
+ ,{ 0, 0 } /* UF_USERINFO */
3059
+ }
3060
+ }
3061
+ ,.rv=0
3062
+ }
3063
+
3064
+ , {.name="complex URL fragment"
3065
+ ,.url="http://www.webmasterworld.com/r.cgi?f=21&d=8405&url="
3066
+ "http://www.example.com/index.html?foo=bar&hello=world#midpage"
3067
+ ,.is_connect=0
3068
+ ,.u=
3069
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_QUERY) |\
3070
+ (1<<UF_FRAGMENT)
3071
+ ,.port=0
3072
+ ,.field_data=
3073
+ {{ 0, 4 } /* UF_SCHEMA */
3074
+ ,{ 7, 22 } /* UF_HOST */
3075
+ ,{ 0, 0 } /* UF_PORT */
3076
+ ,{ 29, 6 } /* UF_PATH */
3077
+ ,{ 36, 69 } /* UF_QUERY */
3078
+ ,{106, 7 } /* UF_FRAGMENT */
3079
+ ,{ 0, 0 } /* UF_USERINFO */
3080
+ }
3081
+ }
3082
+ ,.rv=0
3083
+ }
3084
+
3085
+ , {.name="complex URL from node js url parser doc"
3086
+ ,.url="http://host.com:8080/p/a/t/h?query=string#hash"
3087
+ ,.is_connect=0
3088
+ ,.u=
3089
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PORT) | (1<<UF_PATH) |\
3090
+ (1<<UF_QUERY) | (1<<UF_FRAGMENT)
3091
+ ,.port=8080
3092
+ ,.field_data=
3093
+ {{ 0, 4 } /* UF_SCHEMA */
3094
+ ,{ 7, 8 } /* UF_HOST */
3095
+ ,{ 16, 4 } /* UF_PORT */
3096
+ ,{ 20, 8 } /* UF_PATH */
3097
+ ,{ 29, 12 } /* UF_QUERY */
3098
+ ,{ 42, 4 } /* UF_FRAGMENT */
3099
+ ,{ 0, 0 } /* UF_USERINFO */
3100
+ }
3101
+ }
3102
+ ,.rv=0
3103
+ }
3104
+
3105
+ , {.name="complex URL with basic auth from node js url parser doc"
3106
+ ,.url="http://a:b@host.com:8080/p/a/t/h?query=string#hash"
3107
+ ,.is_connect=0
3108
+ ,.u=
3109
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PORT) | (1<<UF_PATH) |\
3110
+ (1<<UF_QUERY) | (1<<UF_FRAGMENT) | (1<<UF_USERINFO)
3111
+ ,.port=8080
3112
+ ,.field_data=
3113
+ {{ 0, 4 } /* UF_SCHEMA */
3114
+ ,{ 11, 8 } /* UF_HOST */
3115
+ ,{ 20, 4 } /* UF_PORT */
3116
+ ,{ 24, 8 } /* UF_PATH */
3117
+ ,{ 33, 12 } /* UF_QUERY */
3118
+ ,{ 46, 4 } /* UF_FRAGMENT */
3119
+ ,{ 7, 3 } /* UF_USERINFO */
3120
+ }
3121
+ }
3122
+ ,.rv=0
3123
+ }
3124
+
3125
+ , {.name="double @"
3126
+ ,.url="http://a:b@@hostname:443/"
3127
+ ,.is_connect=0
3128
+ ,.rv=1
3129
+ }
3130
+
3131
+ , {.name="proxy empty host"
3132
+ ,.url="http://:443/"
3133
+ ,.is_connect=0
3134
+ ,.rv=1
3135
+ }
3136
+
3137
+ , {.name="proxy empty port"
3138
+ ,.url="http://hostname:/"
3139
+ ,.is_connect=0
3140
+ ,.rv=1
3141
+ }
3142
+
3143
+ , {.name="CONNECT with basic auth"
3144
+ ,.url="a:b@hostname:443"
3145
+ ,.is_connect=1
3146
+ ,.rv=1
3147
+ }
3148
+
3149
+ , {.name="CONNECT empty host"
3150
+ ,.url=":443"
3151
+ ,.is_connect=1
3152
+ ,.rv=1
3153
+ }
3154
+
3155
+ , {.name="CONNECT empty port"
3156
+ ,.url="hostname:"
3157
+ ,.is_connect=1
3158
+ ,.rv=1
3159
+ }
3160
+
3161
+ , {.name="CONNECT with extra bits"
3162
+ ,.url="hostname:443/"
3163
+ ,.is_connect=1
3164
+ ,.rv=1
3165
+ }
3166
+
3167
+ , {.name="space in URL"
3168
+ ,.url="/foo bar/"
3169
+ ,.rv=1 /* s_dead */
3170
+ }
3171
+
3172
+ , {.name="proxy basic auth with space url encoded"
3173
+ ,.url="http://a%20:b@host.com/"
3174
+ ,.is_connect=0
3175
+ ,.u=
3176
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
3177
+ ,.port=0
3178
+ ,.field_data=
3179
+ {{ 0, 4 } /* UF_SCHEMA */
3180
+ ,{ 14, 8 } /* UF_HOST */
3181
+ ,{ 0, 0 } /* UF_PORT */
3182
+ ,{ 22, 1 } /* UF_PATH */
3183
+ ,{ 0, 0 } /* UF_QUERY */
3184
+ ,{ 0, 0 } /* UF_FRAGMENT */
3185
+ ,{ 7, 6 } /* UF_USERINFO */
3186
+ }
3187
+ }
3188
+ ,.rv=0
3189
+ }
3190
+
3191
+ , {.name="carriage return in URL"
3192
+ ,.url="/foo\rbar/"
3193
+ ,.rv=1 /* s_dead */
3194
+ }
3195
+
3196
+ , {.name="proxy double : in URL"
3197
+ ,.url="http://hostname::443/"
3198
+ ,.rv=1 /* s_dead */
3199
+ }
3200
+
3201
+ , {.name="proxy basic auth with double :"
3202
+ ,.url="http://a::b@host.com/"
3203
+ ,.is_connect=0
3204
+ ,.u=
3205
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
3206
+ ,.port=0
3207
+ ,.field_data=
3208
+ {{ 0, 4 } /* UF_SCHEMA */
3209
+ ,{ 12, 8 } /* UF_HOST */
3210
+ ,{ 0, 0 } /* UF_PORT */
3211
+ ,{ 20, 1 } /* UF_PATH */
3212
+ ,{ 0, 0 } /* UF_QUERY */
3213
+ ,{ 0, 0 } /* UF_FRAGMENT */
3214
+ ,{ 7, 4 } /* UF_USERINFO */
3215
+ }
3216
+ }
3217
+ ,.rv=0
3218
+ }
3219
+
3220
+ , {.name="line feed in URL"
3221
+ ,.url="/foo\nbar/"
3222
+ ,.rv=1 /* s_dead */
3223
+ }
3224
+
3225
+ , {.name="proxy empty basic auth"
3226
+ ,.url="http://@hostname/fo"
3227
+ ,.u=
3228
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH)
3229
+ ,.port=0
3230
+ ,.field_data=
3231
+ {{ 0, 4 } /* UF_SCHEMA */
3232
+ ,{ 8, 8 } /* UF_HOST */
3233
+ ,{ 0, 0 } /* UF_PORT */
3234
+ ,{ 16, 3 } /* UF_PATH */
3235
+ ,{ 0, 0 } /* UF_QUERY */
3236
+ ,{ 0, 0 } /* UF_FRAGMENT */
3237
+ ,{ 0, 0 } /* UF_USERINFO */
3238
+ }
3239
+ }
3240
+ ,.rv=0
3241
+ }
3242
+ , {.name="proxy line feed in hostname"
3243
+ ,.url="http://host\name/fo"
3244
+ ,.rv=1 /* s_dead */
3245
+ }
3246
+
3247
+ , {.name="proxy % in hostname"
3248
+ ,.url="http://host%name/fo"
3249
+ ,.rv=1 /* s_dead */
3250
+ }
3251
+
3252
+ , {.name="proxy ; in hostname"
3253
+ ,.url="http://host;ame/fo"
3254
+ ,.rv=1 /* s_dead */
3255
+ }
3256
+
3257
+ , {.name="proxy basic auth with unreservedchars"
3258
+ ,.url="http://a!;-_!=+$@host.com/"
3259
+ ,.is_connect=0
3260
+ ,.u=
3261
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH) | (1<<UF_USERINFO)
3262
+ ,.port=0
3263
+ ,.field_data=
3264
+ {{ 0, 4 } /* UF_SCHEMA */
3265
+ ,{ 17, 8 } /* UF_HOST */
3266
+ ,{ 0, 0 } /* UF_PORT */
3267
+ ,{ 25, 1 } /* UF_PATH */
3268
+ ,{ 0, 0 } /* UF_QUERY */
3269
+ ,{ 0, 0 } /* UF_FRAGMENT */
3270
+ ,{ 7, 9 } /* UF_USERINFO */
3271
+ }
3272
+ }
3273
+ ,.rv=0
3274
+ }
3275
+
3276
+ , {.name="proxy only empty basic auth"
3277
+ ,.url="http://@/fo"
3278
+ ,.rv=1 /* s_dead */
3279
+ }
3280
+
3281
+ , {.name="proxy only basic auth"
3282
+ ,.url="http://toto@/fo"
3283
+ ,.rv=1 /* s_dead */
3284
+ }
3285
+
3286
+ , {.name="proxy emtpy hostname"
3287
+ ,.url="http:///fo"
3288
+ ,.rv=1 /* s_dead */
3289
+ }
3290
+
3291
+ , {.name="proxy = in URL"
3292
+ ,.url="http://host=ame/fo"
3293
+ ,.rv=1 /* s_dead */
3294
+ }
3295
+
3296
+ , {.name="ipv6 address with Zone ID"
3297
+ ,.url="http://[fe80::a%25eth0]/"
3298
+ ,.is_connect=0
3299
+ ,.u=
3300
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH)
3301
+ ,.port=0
3302
+ ,.field_data=
3303
+ {{ 0, 4 } /* UF_SCHEMA */
3304
+ ,{ 8, 14 } /* UF_HOST */
3305
+ ,{ 0, 0 } /* UF_PORT */
3306
+ ,{ 23, 1 } /* UF_PATH */
3307
+ ,{ 0, 0 } /* UF_QUERY */
3308
+ ,{ 0, 0 } /* UF_FRAGMENT */
3309
+ ,{ 0, 0 } /* UF_USERINFO */
3310
+ }
3311
+ }
3312
+ ,.rv=0
3313
+ }
3314
+
3315
+ , {.name="ipv6 address with Zone ID, but '%' is not percent-encoded"
3316
+ ,.url="http://[fe80::a%eth0]/"
3317
+ ,.is_connect=0
3318
+ ,.u=
3319
+ {.field_set= (1<<UF_SCHEMA) | (1<<UF_HOST) | (1<<UF_PATH)
3320
+ ,.port=0
3321
+ ,.field_data=
3322
+ {{ 0, 4 } /* UF_SCHEMA */
3323
+ ,{ 8, 12 } /* UF_HOST */
3324
+ ,{ 0, 0 } /* UF_PORT */
3325
+ ,{ 21, 1 } /* UF_PATH */
3326
+ ,{ 0, 0 } /* UF_QUERY */
3327
+ ,{ 0, 0 } /* UF_FRAGMENT */
3328
+ ,{ 0, 0 } /* UF_USERINFO */
3329
+ }
3330
+ }
3331
+ ,.rv=0
3332
+ }
3333
+
3334
+ , {.name="ipv6 address ending with '%'"
3335
+ ,.url="http://[fe80::a%]/"
3336
+ ,.rv=1 /* s_dead */
3337
+ }
3338
+
3339
+ , {.name="ipv6 address with Zone ID including bad character"
3340
+ ,.url="http://[fe80::a%$HOME]/"
3341
+ ,.rv=1 /* s_dead */
3342
+ }
3343
+
3344
+ , {.name="just ipv6 Zone ID"
3345
+ ,.url="http://[%eth0]/"
3346
+ ,.rv=1 /* s_dead */
3347
+ }
3348
+
3349
+ , {.name="empty url"
3350
+ ,.url=""
3351
+ ,.is_connect=0
3352
+ ,.rv=1
3353
+ }
3354
+
3355
+ , {.name="NULL url"
3356
+ ,.url=NULL
3357
+ ,.is_connect=0
3358
+ ,.rv=1
3359
+ }
3360
+
3361
+ , {.name="full of spaces url"
3362
+ ,.url=" "
3363
+ ,.is_connect=0
3364
+ ,.rv=1
3365
+ }
3366
+
3367
+ #if HTTP_PARSER_STRICT
3368
+
3369
+ , {.name="tab in URL"
3370
+ ,.url="/foo\tbar/"
3371
+ ,.rv=1 /* s_dead */
3372
+ }
3373
+
3374
+ , {.name="form feed in URL"
3375
+ ,.url="/foo\fbar/"
3376
+ ,.rv=1 /* s_dead */
3377
+ }
3378
+
3379
+ #else /* !HTTP_PARSER_STRICT */
3380
+
3381
+ , {.name="tab in URL"
3382
+ ,.url="/foo\tbar/"
3383
+ ,.u=
3384
+ {.field_set=(1 << UF_PATH)
3385
+ ,.field_data=
3386
+ {{ 0, 0 } /* UF_SCHEMA */
3387
+ ,{ 0, 0 } /* UF_HOST */
3388
+ ,{ 0, 0 } /* UF_PORT */
3389
+ ,{ 0, 9 } /* UF_PATH */
3390
+ ,{ 0, 0 } /* UF_QUERY */
3391
+ ,{ 0, 0 } /* UF_FRAGMENT */
3392
+ ,{ 0, 0 } /* UF_USERINFO */
3393
+ }
3394
+ }
3395
+ ,.rv=0
3396
+ }
3397
+
3398
+ , {.name="form feed in URL"
3399
+ ,.url="/foo\fbar/"
3400
+ ,.u=
3401
+ {.field_set=(1 << UF_PATH)
3402
+ ,.field_data=
3403
+ {{ 0, 0 } /* UF_SCHEMA */
3404
+ ,{ 0, 0 } /* UF_HOST */
3405
+ ,{ 0, 0 } /* UF_PORT */
3406
+ ,{ 0, 9 } /* UF_PATH */
3407
+ ,{ 0, 0 } /* UF_QUERY */
3408
+ ,{ 0, 0 } /* UF_FRAGMENT */
3409
+ ,{ 0, 0 } /* UF_USERINFO */
3410
+ }
3411
+ }
3412
+ ,.rv=0
3413
+ }
3414
+ #endif
3415
+ };
3416
+
3417
+ void
3418
+ dump_url (const char *url, const struct http_parser_url *u)
3419
+ {
3420
+ unsigned int i;
3421
+
3422
+ printf("\tfield_set: 0x%x, port: %u\n", u->field_set, u->port);
3423
+ for (i = 0; i < UF_MAX; i++) {
3424
+ if ((u->field_set & (1 << i)) == 0) {
3425
+ printf("\tfield_data[%u]: unset\n", i);
3426
+ continue;
3427
+ }
3428
+
3429
+ printf("\tfield_data[%u]: off: %u len: %u part: \"%.*s\n\"",
3430
+ i,
3431
+ u->field_data[i].off,
3432
+ u->field_data[i].len,
3433
+ u->field_data[i].len,
3434
+ url + u->field_data[i].off);
3435
+ }
3436
+ }
3437
+
3438
+ void
3439
+ test_parse_url (void)
3440
+ {
3441
+ struct http_parser_url u;
3442
+ const struct url_test *test;
3443
+ unsigned int i;
3444
+ int rv;
3445
+
3446
+ for (i = 0; i < (sizeof(url_tests) / sizeof(url_tests[0])); i++) {
3447
+ test = &url_tests[i];
3448
+ memset(&u, 0, sizeof(u));
3449
+
3450
+ rv = http_parser_parse_url(test->url,
3451
+ test->url ? strlen(test->url) : 0,
3452
+ test->is_connect,
3453
+ &u);
3454
+
3455
+ if (test->rv == 0) {
3456
+ if (rv != 0) {
3457
+ printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, "
3458
+ "unexpected rv %d ***\n\n", test->url, test->name, rv);
3459
+ abort();
3460
+ }
3461
+
3462
+ if (memcmp(&u, &test->u, sizeof(u)) != 0) {
3463
+ printf("\n*** http_parser_parse_url(\"%s\") \"%s\" failed ***\n",
3464
+ test->url, test->name);
3465
+
3466
+ printf("target http_parser_url:\n");
3467
+ dump_url(test->url, &test->u);
3468
+ printf("result http_parser_url:\n");
3469
+ dump_url(test->url, &u);
3470
+
3471
+ abort();
3472
+ }
3473
+ } else {
3474
+ /* test->rv != 0 */
3475
+ if (rv == 0) {
3476
+ printf("\n*** http_parser_parse_url(\"%s\") \"%s\" test failed, "
3477
+ "unexpected rv %d ***\n\n", test->url, test->name, rv);
3478
+ abort();
3479
+ }
3480
+ }
3481
+ }
3482
+ }
3483
+
3484
+ void
3485
+ test_method_str (void)
3486
+ {
3487
+ assert(0 == strcmp("GET", http_method_str(HTTP_GET)));
3488
+ assert(0 == strcmp("<unknown>", http_method_str(1337)));
3489
+ }
3490
+
3491
+ void
3492
+ test_status_str (void)
3493
+ {
3494
+ assert(0 == strcmp("OK", http_status_str(HTTP_STATUS_OK)));
3495
+ assert(0 == strcmp("Not Found", http_status_str(HTTP_STATUS_NOT_FOUND)));
3496
+ assert(0 == strcmp("<unknown>", http_status_str(1337)));
3497
+ }
3498
+
3499
+ void
3500
+ test_message (const struct message *message)
3501
+ {
3502
+ size_t raw_len = strlen(message->raw);
3503
+ size_t msg1len;
3504
+ for (msg1len = 0; msg1len < raw_len; msg1len++) {
3505
+ parser_init(message->type);
3506
+
3507
+ size_t read;
3508
+ const char *msg1 = message->raw;
3509
+ const char *msg2 = msg1 + msg1len;
3510
+ size_t msg2len = raw_len - msg1len;
3511
+
3512
+ if (msg1len) {
3513
+ assert(num_messages == 0);
3514
+ messages[0].headers_complete_cb_called = FALSE;
3515
+
3516
+ read = parse(msg1, msg1len);
3517
+
3518
+ if (!messages[0].headers_complete_cb_called && parser.nread != read) {
3519
+ assert(parser.nread == read);
3520
+ print_error(msg1, read);
3521
+ abort();
3522
+ }
3523
+
3524
+ if (message->upgrade && parser.upgrade && num_messages > 0) {
3525
+ messages[num_messages - 1].upgrade = msg1 + read;
3526
+ goto test;
3527
+ }
3528
+
3529
+ if (read != msg1len) {
3530
+ print_error(msg1, read);
3531
+ abort();
3532
+ }
3533
+ }
3534
+
3535
+
3536
+ read = parse(msg2, msg2len);
3537
+
3538
+ if (message->upgrade && parser.upgrade) {
3539
+ messages[num_messages - 1].upgrade = msg2 + read;
3540
+ goto test;
3541
+ }
3542
+
3543
+ if (read != msg2len) {
3544
+ print_error(msg2, read);
3545
+ abort();
3546
+ }
3547
+
3548
+ read = parse(NULL, 0);
3549
+
3550
+ if (read != 0) {
3551
+ print_error(message->raw, read);
3552
+ abort();
3553
+ }
3554
+
3555
+ test:
3556
+
3557
+ if (num_messages != 1) {
3558
+ printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name);
3559
+ abort();
3560
+ }
3561
+
3562
+ if(!message_eq(0, 0, message)) abort();
3563
+ }
3564
+ }
3565
+
3566
+ void
3567
+ test_message_count_body (const struct message *message)
3568
+ {
3569
+ parser_init(message->type);
3570
+
3571
+ size_t read;
3572
+ size_t l = strlen(message->raw);
3573
+ size_t i, toread;
3574
+ size_t chunk = 4024;
3575
+
3576
+ for (i = 0; i < l; i+= chunk) {
3577
+ toread = MIN(l-i, chunk);
3578
+ read = parse_count_body(message->raw + i, toread);
3579
+ if (read != toread) {
3580
+ print_error(message->raw, read);
3581
+ abort();
3582
+ }
3583
+ }
3584
+
3585
+
3586
+ read = parse_count_body(NULL, 0);
3587
+ if (read != 0) {
3588
+ print_error(message->raw, read);
3589
+ abort();
3590
+ }
3591
+
3592
+ if (num_messages != 1) {
3593
+ printf("\n*** num_messages != 1 after testing '%s' ***\n\n", message->name);
3594
+ abort();
3595
+ }
3596
+
3597
+ if(!message_eq(0, 0, message)) abort();
3598
+ }
3599
+
3600
+ void
3601
+ test_simple_type (const char *buf,
3602
+ enum http_errno err_expected,
3603
+ enum http_parser_type type)
3604
+ {
3605
+ parser_init(type);
3606
+
3607
+ enum http_errno err;
3608
+
3609
+ parse(buf, strlen(buf));
3610
+ err = HTTP_PARSER_ERRNO(&parser);
3611
+ parse(NULL, 0);
3612
+
3613
+ /* In strict mode, allow us to pass with an unexpected HPE_STRICT as
3614
+ * long as the caller isn't expecting success.
3615
+ */
3616
+ #if HTTP_PARSER_STRICT
3617
+ if (err_expected != err && err_expected != HPE_OK && err != HPE_STRICT) {
3618
+ #else
3619
+ if (err_expected != err) {
3620
+ #endif
3621
+ fprintf(stderr, "\n*** test_simple expected %s, but saw %s ***\n\n%s\n",
3622
+ http_errno_name(err_expected), http_errno_name(err), buf);
3623
+ abort();
3624
+ }
3625
+ }
3626
+
3627
+ void
3628
+ test_simple (const char *buf, enum http_errno err_expected)
3629
+ {
3630
+ test_simple_type(buf, err_expected, HTTP_REQUEST);
3631
+ }
3632
+
3633
+ void
3634
+ test_invalid_header_content (int req, const char* str)
3635
+ {
3636
+ http_parser parser;
3637
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3638
+ size_t parsed;
3639
+ const char *buf;
3640
+ buf = req ?
3641
+ "GET / HTTP/1.1\r\n" :
3642
+ "HTTP/1.1 200 OK\r\n";
3643
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3644
+ assert(parsed == strlen(buf));
3645
+
3646
+ buf = str;
3647
+ size_t buflen = strlen(buf);
3648
+
3649
+ parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
3650
+ if (parsed != buflen) {
3651
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_INVALID_HEADER_TOKEN);
3652
+ return;
3653
+ }
3654
+
3655
+ fprintf(stderr,
3656
+ "\n*** Error expected but none in invalid header content test ***\n");
3657
+ abort();
3658
+ }
3659
+
3660
+ void
3661
+ test_invalid_header_field_content_error (int req)
3662
+ {
3663
+ test_invalid_header_content(req, "Foo: F\01ailure");
3664
+ test_invalid_header_content(req, "Foo: B\02ar");
3665
+ }
3666
+
3667
+ void
3668
+ test_invalid_header_field (int req, const char* str)
3669
+ {
3670
+ http_parser parser;
3671
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3672
+ size_t parsed;
3673
+ const char *buf;
3674
+ buf = req ?
3675
+ "GET / HTTP/1.1\r\n" :
3676
+ "HTTP/1.1 200 OK\r\n";
3677
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3678
+ assert(parsed == strlen(buf));
3679
+
3680
+ buf = str;
3681
+ size_t buflen = strlen(buf);
3682
+
3683
+ parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
3684
+ if (parsed != buflen) {
3685
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_INVALID_HEADER_TOKEN);
3686
+ return;
3687
+ }
3688
+
3689
+ fprintf(stderr,
3690
+ "\n*** Error expected but none in invalid header token test ***\n");
3691
+ abort();
3692
+ }
3693
+
3694
+ void
3695
+ test_invalid_header_field_token_error (int req)
3696
+ {
3697
+ test_invalid_header_field(req, "Fo@: Failure");
3698
+ test_invalid_header_field(req, "Foo\01\test: Bar");
3699
+ }
3700
+
3701
+ void
3702
+ test_double_content_length_error (int req)
3703
+ {
3704
+ http_parser parser;
3705
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3706
+ size_t parsed;
3707
+ const char *buf;
3708
+ buf = req ?
3709
+ "GET / HTTP/1.1\r\n" :
3710
+ "HTTP/1.1 200 OK\r\n";
3711
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3712
+ assert(parsed == strlen(buf));
3713
+
3714
+ buf = "Content-Length: 0\r\nContent-Length: 1\r\n\r\n";
3715
+ size_t buflen = strlen(buf);
3716
+
3717
+ parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
3718
+ if (parsed != buflen) {
3719
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_UNEXPECTED_CONTENT_LENGTH);
3720
+ return;
3721
+ }
3722
+
3723
+ fprintf(stderr,
3724
+ "\n*** Error expected but none in double content-length test ***\n");
3725
+ abort();
3726
+ }
3727
+
3728
+ void
3729
+ test_chunked_content_length_error (int req)
3730
+ {
3731
+ http_parser parser;
3732
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3733
+ size_t parsed;
3734
+ const char *buf;
3735
+ buf = req ?
3736
+ "GET / HTTP/1.1\r\n" :
3737
+ "HTTP/1.1 200 OK\r\n";
3738
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3739
+ assert(parsed == strlen(buf));
3740
+
3741
+ buf = "Transfer-Encoding: anything\r\nContent-Length: 1\r\n\r\n";
3742
+ size_t buflen = strlen(buf);
3743
+
3744
+ parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
3745
+ if (parsed != buflen) {
3746
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_UNEXPECTED_CONTENT_LENGTH);
3747
+ return;
3748
+ }
3749
+
3750
+ fprintf(stderr,
3751
+ "\n*** Error expected but none in chunked content-length test ***\n");
3752
+ abort();
3753
+ }
3754
+
3755
+ void
3756
+ test_header_cr_no_lf_error (int req)
3757
+ {
3758
+ http_parser parser;
3759
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3760
+ size_t parsed;
3761
+ const char *buf;
3762
+ buf = req ?
3763
+ "GET / HTTP/1.1\r\n" :
3764
+ "HTTP/1.1 200 OK\r\n";
3765
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3766
+ assert(parsed == strlen(buf));
3767
+
3768
+ buf = "Foo: 1\rBar: 1\r\n\r\n";
3769
+ size_t buflen = strlen(buf);
3770
+
3771
+ parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
3772
+ if (parsed != buflen) {
3773
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_LF_EXPECTED);
3774
+ return;
3775
+ }
3776
+
3777
+ fprintf(stderr,
3778
+ "\n*** Error expected but none in header whitespace test ***\n");
3779
+ abort();
3780
+ }
3781
+
3782
+ void
3783
+ test_no_overflow_parse_url (void)
3784
+ {
3785
+ int rv;
3786
+ struct http_parser_url u;
3787
+
3788
+ http_parser_url_init(&u);
3789
+ rv = http_parser_parse_url("http://example.com:8001", 22, 0, &u);
3790
+
3791
+ if (rv != 0) {
3792
+ fprintf(stderr,
3793
+ "\n*** test_no_overflow_parse_url invalid return value=%d\n",
3794
+ rv);
3795
+ abort();
3796
+ }
3797
+
3798
+ if (u.port != 800) {
3799
+ fprintf(stderr,
3800
+ "\n*** test_no_overflow_parse_url invalid port number=%d\n",
3801
+ u.port);
3802
+ abort();
3803
+ }
3804
+ }
3805
+
3806
+ void
3807
+ test_header_overflow_error (int req)
3808
+ {
3809
+ http_parser parser;
3810
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3811
+ size_t parsed;
3812
+ const char *buf;
3813
+ buf = req ? "GET / HTTP/1.1\r\n" : "HTTP/1.0 200 OK\r\n";
3814
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3815
+ assert(parsed == strlen(buf));
3816
+
3817
+ buf = "header-key: header-value\r\n";
3818
+ size_t buflen = strlen(buf);
3819
+
3820
+ int i;
3821
+ for (i = 0; i < 10000; i++) {
3822
+ parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
3823
+ if (parsed != buflen) {
3824
+ //fprintf(stderr, "error found on iter %d\n", i);
3825
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_HEADER_OVERFLOW);
3826
+ return;
3827
+ }
3828
+ }
3829
+
3830
+ fprintf(stderr, "\n*** Error expected but none in header overflow test ***\n");
3831
+ abort();
3832
+ }
3833
+
3834
+
3835
+ void
3836
+ test_header_nread_value ()
3837
+ {
3838
+ http_parser parser;
3839
+ http_parser_init(&parser, HTTP_REQUEST);
3840
+ size_t parsed;
3841
+ const char *buf;
3842
+ buf = "GET / HTTP/1.1\r\nheader: value\nhdr: value\r\n";
3843
+ parsed = http_parser_execute(&parser, &settings_null, buf, strlen(buf));
3844
+ assert(parsed == strlen(buf));
3845
+
3846
+ assert(parser.nread == strlen(buf));
3847
+ }
3848
+
3849
+
3850
+ static void
3851
+ test_content_length_overflow (const char *buf, size_t buflen, int expect_ok)
3852
+ {
3853
+ http_parser parser;
3854
+ http_parser_init(&parser, HTTP_RESPONSE);
3855
+ http_parser_execute(&parser, &settings_null, buf, buflen);
3856
+
3857
+ if (expect_ok)
3858
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_OK);
3859
+ else
3860
+ assert(HTTP_PARSER_ERRNO(&parser) == HPE_INVALID_CONTENT_LENGTH);
3861
+ }
3862
+
3863
+ void
3864
+ test_header_content_length_overflow_error (void)
3865
+ {
3866
+ #define X(size) \
3867
+ "HTTP/1.1 200 OK\r\n" \
3868
+ "Content-Length: " #size "\r\n" \
3869
+ "\r\n"
3870
+ const char a[] = X(1844674407370955160); /* 2^64 / 10 - 1 */
3871
+ const char b[] = X(18446744073709551615); /* 2^64-1 */
3872
+ const char c[] = X(18446744073709551616); /* 2^64 */
3873
+ #undef X
3874
+ test_content_length_overflow(a, sizeof(a) - 1, 1); /* expect ok */
3875
+ test_content_length_overflow(b, sizeof(b) - 1, 0); /* expect failure */
3876
+ test_content_length_overflow(c, sizeof(c) - 1, 0); /* expect failure */
3877
+ }
3878
+
3879
+ void
3880
+ test_chunk_content_length_overflow_error (void)
3881
+ {
3882
+ #define X(size) \
3883
+ "HTTP/1.1 200 OK\r\n" \
3884
+ "Transfer-Encoding: chunked\r\n" \
3885
+ "\r\n" \
3886
+ #size "\r\n" \
3887
+ "..."
3888
+ const char a[] = X(FFFFFFFFFFFFFFE); /* 2^64 / 16 - 1 */
3889
+ const char b[] = X(FFFFFFFFFFFFFFFF); /* 2^64-1 */
3890
+ const char c[] = X(10000000000000000); /* 2^64 */
3891
+ #undef X
3892
+ test_content_length_overflow(a, sizeof(a) - 1, 1); /* expect ok */
3893
+ test_content_length_overflow(b, sizeof(b) - 1, 0); /* expect failure */
3894
+ test_content_length_overflow(c, sizeof(c) - 1, 0); /* expect failure */
3895
+ }
3896
+
3897
+ void
3898
+ test_no_overflow_long_body (int req, size_t length)
3899
+ {
3900
+ http_parser parser;
3901
+ http_parser_init(&parser, req ? HTTP_REQUEST : HTTP_RESPONSE);
3902
+ size_t parsed;
3903
+ size_t i;
3904
+ char buf1[3000];
3905
+ size_t buf1len = sprintf(buf1, "%s\r\nConnection: Keep-Alive\r\nContent-Length: %lu\r\n\r\n",
3906
+ req ? "POST / HTTP/1.0" : "HTTP/1.0 200 OK", (unsigned long)length);
3907
+ parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
3908
+ if (parsed != buf1len)
3909
+ goto err;
3910
+
3911
+ for (i = 0; i < length; i++) {
3912
+ char foo = 'a';
3913
+ parsed = http_parser_execute(&parser, &settings_null, &foo, 1);
3914
+ if (parsed != 1)
3915
+ goto err;
3916
+ }
3917
+
3918
+ parsed = http_parser_execute(&parser, &settings_null, buf1, buf1len);
3919
+ if (parsed != buf1len) goto err;
3920
+ return;
3921
+
3922
+ err:
3923
+ fprintf(stderr,
3924
+ "\n*** error in test_no_overflow_long_body %s of length %lu ***\n",
3925
+ req ? "REQUEST" : "RESPONSE",
3926
+ (unsigned long)length);
3927
+ abort();
3928
+ }
3929
+
3930
+ void
3931
+ test_multiple3 (const struct message *r1, const struct message *r2, const struct message *r3)
3932
+ {
3933
+ int message_count = count_parsed_messages(3, r1, r2, r3);
3934
+
3935
+ char total[ strlen(r1->raw)
3936
+ + strlen(r2->raw)
3937
+ + strlen(r3->raw)
3938
+ + 1
3939
+ ];
3940
+ total[0] = '\0';
3941
+
3942
+ strcat(total, r1->raw);
3943
+ strcat(total, r2->raw);
3944
+ strcat(total, r3->raw);
3945
+
3946
+ parser_init(r1->type);
3947
+
3948
+ size_t read;
3949
+
3950
+ read = parse(total, strlen(total));
3951
+
3952
+ if (parser.upgrade) {
3953
+ upgrade_message_fix(total, read, 3, r1, r2, r3);
3954
+ goto test;
3955
+ }
3956
+
3957
+ if (read != strlen(total)) {
3958
+ print_error(total, read);
3959
+ abort();
3960
+ }
3961
+
3962
+ read = parse(NULL, 0);
3963
+
3964
+ if (read != 0) {
3965
+ print_error(total, read);
3966
+ abort();
3967
+ }
3968
+
3969
+ test:
3970
+
3971
+ if (message_count != num_messages) {
3972
+ fprintf(stderr, "\n\n*** Parser didn't see 3 messages only %d *** \n", num_messages);
3973
+ abort();
3974
+ }
3975
+
3976
+ if (!message_eq(0, 0, r1)) abort();
3977
+ if (message_count > 1 && !message_eq(1, 0, r2)) abort();
3978
+ if (message_count > 2 && !message_eq(2, 0, r3)) abort();
3979
+ }
3980
+
3981
+ /* SCAN through every possible breaking to make sure the
3982
+ * parser can handle getting the content in any chunks that
3983
+ * might come from the socket
3984
+ */
3985
+ void
3986
+ test_scan (const struct message *r1, const struct message *r2, const struct message *r3)
3987
+ {
3988
+ char total[80*1024] = "\0";
3989
+ char buf1[80*1024] = "\0";
3990
+ char buf2[80*1024] = "\0";
3991
+ char buf3[80*1024] = "\0";
3992
+
3993
+ strcat(total, r1->raw);
3994
+ strcat(total, r2->raw);
3995
+ strcat(total, r3->raw);
3996
+
3997
+ size_t read;
3998
+
3999
+ int total_len = strlen(total);
4000
+
4001
+ int total_ops = 2 * (total_len - 1) * (total_len - 2) / 2;
4002
+ int ops = 0 ;
4003
+
4004
+ size_t buf1_len, buf2_len, buf3_len;
4005
+ int message_count = count_parsed_messages(3, r1, r2, r3);
4006
+
4007
+ int i,j,type_both;
4008
+ for (type_both = 0; type_both < 2; type_both ++ ) {
4009
+ for (j = 2; j < total_len; j ++ ) {
4010
+ for (i = 1; i < j; i ++ ) {
4011
+
4012
+ if (ops % 1000 == 0) {
4013
+ printf("\b\b\b\b%3.0f%%", 100 * (float)ops /(float)total_ops);
4014
+ fflush(stdout);
4015
+ }
4016
+ ops += 1;
4017
+
4018
+ parser_init(type_both ? HTTP_BOTH : r1->type);
4019
+
4020
+ buf1_len = i;
4021
+ strlncpy(buf1, sizeof(buf1), total, buf1_len);
4022
+ buf1[buf1_len] = 0;
4023
+
4024
+ buf2_len = j - i;
4025
+ strlncpy(buf2, sizeof(buf1), total+i, buf2_len);
4026
+ buf2[buf2_len] = 0;
4027
+
4028
+ buf3_len = total_len - j;
4029
+ strlncpy(buf3, sizeof(buf1), total+j, buf3_len);
4030
+ buf3[buf3_len] = 0;
4031
+
4032
+ assert(num_messages == 0);
4033
+ messages[0].headers_complete_cb_called = FALSE;
4034
+
4035
+ read = parse(buf1, buf1_len);
4036
+
4037
+ if (!messages[0].headers_complete_cb_called && parser.nread != read) {
4038
+ print_error(buf1, read);
4039
+ goto error;
4040
+ }
4041
+
4042
+ if (parser.upgrade) goto test;
4043
+
4044
+ if (read != buf1_len) {
4045
+ print_error(buf1, read);
4046
+ goto error;
4047
+ }
4048
+
4049
+ read += parse(buf2, buf2_len);
4050
+
4051
+ if (parser.upgrade) goto test;
4052
+
4053
+ if (read != buf1_len + buf2_len) {
4054
+ print_error(buf2, read);
4055
+ goto error;
4056
+ }
4057
+
4058
+ read += parse(buf3, buf3_len);
4059
+
4060
+ if (parser.upgrade) goto test;
4061
+
4062
+ if (read != buf1_len + buf2_len + buf3_len) {
4063
+ print_error(buf3, read);
4064
+ goto error;
4065
+ }
4066
+
4067
+ parse(NULL, 0);
4068
+
4069
+ test:
4070
+ if (parser.upgrade) {
4071
+ upgrade_message_fix(total, read, 3, r1, r2, r3);
4072
+ }
4073
+
4074
+ if (message_count != num_messages) {
4075
+ fprintf(stderr, "\n\nParser didn't see %d messages only %d\n",
4076
+ message_count, num_messages);
4077
+ goto error;
4078
+ }
4079
+
4080
+ if (!message_eq(0, 0, r1)) {
4081
+ fprintf(stderr, "\n\nError matching messages[0] in test_scan.\n");
4082
+ goto error;
4083
+ }
4084
+
4085
+ if (message_count > 1 && !message_eq(1, 0, r2)) {
4086
+ fprintf(stderr, "\n\nError matching messages[1] in test_scan.\n");
4087
+ goto error;
4088
+ }
4089
+
4090
+ if (message_count > 2 && !message_eq(2, 0, r3)) {
4091
+ fprintf(stderr, "\n\nError matching messages[2] in test_scan.\n");
4092
+ goto error;
4093
+ }
4094
+ }
4095
+ }
4096
+ }
4097
+ puts("\b\b\b\b100%");
4098
+ return;
4099
+
4100
+ error:
4101
+ fprintf(stderr, "i=%d j=%d\n", i, j);
4102
+ fprintf(stderr, "buf1 (%u) %s\n\n", (unsigned int)buf1_len, buf1);
4103
+ fprintf(stderr, "buf2 (%u) %s\n\n", (unsigned int)buf2_len , buf2);
4104
+ fprintf(stderr, "buf3 (%u) %s\n", (unsigned int)buf3_len, buf3);
4105
+ abort();
4106
+ }
4107
+
4108
+ // user required to free the result
4109
+ // string terminated by \0
4110
+ char *
4111
+ create_large_chunked_message (int body_size_in_kb, const char* headers)
4112
+ {
4113
+ int i;
4114
+ size_t wrote = 0;
4115
+ size_t headers_len = strlen(headers);
4116
+ size_t bufsize = headers_len + (5+1024+2)*body_size_in_kb + 6;
4117
+ char * buf = malloc(bufsize);
4118
+
4119
+ memcpy(buf, headers, headers_len);
4120
+ wrote += headers_len;
4121
+
4122
+ for (i = 0; i < body_size_in_kb; i++) {
4123
+ // write 1kb chunk into the body.
4124
+ memcpy(buf + wrote, "400\r\n", 5);
4125
+ wrote += 5;
4126
+ memset(buf + wrote, 'C', 1024);
4127
+ wrote += 1024;
4128
+ strcpy(buf + wrote, "\r\n");
4129
+ wrote += 2;
4130
+ }
4131
+
4132
+ memcpy(buf + wrote, "0\r\n\r\n", 6);
4133
+ wrote += 6;
4134
+ assert(wrote == bufsize);
4135
+
4136
+ return buf;
4137
+ }
4138
+
4139
+ /* Verify that we can pause parsing at any of the bytes in the
4140
+ * message and still get the result that we're expecting. */
4141
+ void
4142
+ test_message_pause (const struct message *msg)
4143
+ {
4144
+ char *buf = (char*) msg->raw;
4145
+ size_t buflen = strlen(msg->raw);
4146
+ size_t nread;
4147
+
4148
+ parser_init(msg->type);
4149
+
4150
+ do {
4151
+ nread = parse_pause(buf, buflen);
4152
+
4153
+ // We can only set the upgrade buffer once we've gotten our message
4154
+ // completion callback.
4155
+ if (messages[0].message_complete_cb_called &&
4156
+ msg->upgrade &&
4157
+ parser.upgrade) {
4158
+ messages[0].upgrade = buf + nread;
4159
+ goto test;
4160
+ }
4161
+
4162
+ if (nread < buflen) {
4163
+
4164
+ // Not much do to if we failed a strict-mode check
4165
+ if (HTTP_PARSER_ERRNO(&parser) == HPE_STRICT) {
4166
+ return;
4167
+ }
4168
+
4169
+ assert (HTTP_PARSER_ERRNO(&parser) == HPE_PAUSED);
4170
+ }
4171
+
4172
+ buf += nread;
4173
+ buflen -= nread;
4174
+ http_parser_pause(&parser, 0);
4175
+ } while (buflen > 0);
4176
+
4177
+ nread = parse_pause(NULL, 0);
4178
+ assert (nread == 0);
4179
+
4180
+ test:
4181
+ if (num_messages != 1) {
4182
+ printf("\n*** num_messages != 1 after testing '%s' ***\n\n", msg->name);
4183
+ abort();
4184
+ }
4185
+
4186
+ if(!message_eq(0, 0, msg)) abort();
4187
+ }
4188
+
4189
+ /* Verify that body and next message won't be parsed in responses to CONNECT */
4190
+ void
4191
+ test_message_connect (const struct message *msg)
4192
+ {
4193
+ char *buf = (char*) msg->raw;
4194
+ size_t buflen = strlen(msg->raw);
4195
+
4196
+ parser_init(msg->type);
4197
+
4198
+ parse_connect(buf, buflen);
4199
+
4200
+ if (num_messages != 1) {
4201
+ printf("\n*** num_messages != 1 after testing '%s' ***\n\n", msg->name);
4202
+ abort();
4203
+ }
4204
+
4205
+ if(!message_eq(0, 1, msg)) abort();
4206
+ }
4207
+
4208
+ int
4209
+ main (void)
4210
+ {
4211
+ unsigned i, j, k;
4212
+ unsigned long version;
4213
+ unsigned major;
4214
+ unsigned minor;
4215
+ unsigned patch;
4216
+
4217
+ version = http_parser_version();
4218
+ major = (version >> 16) & 255;
4219
+ minor = (version >> 8) & 255;
4220
+ patch = version & 255;
4221
+ printf("http_parser v%u.%u.%u (0x%06lx)\n", major, minor, patch, version);
4222
+
4223
+ printf("sizeof(http_parser) = %u\n", (unsigned int)sizeof(http_parser));
4224
+ assert(sizeof(http_parser) == 4 + 4 + 8 + 2 + 2 + 4 + sizeof(void *));
4225
+
4226
+ //// API
4227
+ test_preserve_data();
4228
+ test_parse_url();
4229
+ test_method_str();
4230
+ test_status_str();
4231
+
4232
+ //// NREAD
4233
+ test_header_nread_value();
4234
+
4235
+ //// OVERFLOW CONDITIONS
4236
+ test_no_overflow_parse_url();
4237
+
4238
+ test_header_overflow_error(HTTP_REQUEST);
4239
+ test_no_overflow_long_body(HTTP_REQUEST, 1000);
4240
+ test_no_overflow_long_body(HTTP_REQUEST, 100000);
4241
+
4242
+ test_header_overflow_error(HTTP_RESPONSE);
4243
+ test_no_overflow_long_body(HTTP_RESPONSE, 1000);
4244
+ test_no_overflow_long_body(HTTP_RESPONSE, 100000);
4245
+
4246
+ test_header_content_length_overflow_error();
4247
+ test_chunk_content_length_overflow_error();
4248
+
4249
+ //// HEADER FIELD CONDITIONS
4250
+ test_double_content_length_error(HTTP_REQUEST);
4251
+ test_chunked_content_length_error(HTTP_REQUEST);
4252
+ test_header_cr_no_lf_error(HTTP_REQUEST);
4253
+ test_invalid_header_field_token_error(HTTP_REQUEST);
4254
+ test_invalid_header_field_content_error(HTTP_REQUEST);
4255
+ test_double_content_length_error(HTTP_RESPONSE);
4256
+ test_chunked_content_length_error(HTTP_RESPONSE);
4257
+ test_header_cr_no_lf_error(HTTP_RESPONSE);
4258
+ test_invalid_header_field_token_error(HTTP_RESPONSE);
4259
+ test_invalid_header_field_content_error(HTTP_RESPONSE);
4260
+
4261
+ test_simple_type(
4262
+ "POST / HTTP/1.1\r\n"
4263
+ "Content-Length:\r\n" // empty
4264
+ "\r\n",
4265
+ HPE_INVALID_CONTENT_LENGTH,
4266
+ HTTP_REQUEST);
4267
+
4268
+ test_simple_type(
4269
+ "POST / HTTP/1.1\r\n"
4270
+ "Content-Length: 42 \r\n" // Note the surrounding whitespace.
4271
+ "\r\n",
4272
+ HPE_OK,
4273
+ HTTP_REQUEST);
4274
+
4275
+ test_simple_type(
4276
+ "POST / HTTP/1.1\r\n"
4277
+ "Content-Length: 4 2\r\n"
4278
+ "\r\n",
4279
+ HPE_INVALID_CONTENT_LENGTH,
4280
+ HTTP_REQUEST);
4281
+
4282
+ test_simple_type(
4283
+ "POST / HTTP/1.1\r\n"
4284
+ "Content-Length: 13 37\r\n"
4285
+ "\r\n",
4286
+ HPE_INVALID_CONTENT_LENGTH,
4287
+ HTTP_REQUEST);
4288
+
4289
+ test_simple_type(
4290
+ "POST / HTTP/1.1\r\n"
4291
+ "Content-Length: 42\r\n"
4292
+ " Hello world!\r\n",
4293
+ HPE_INVALID_CONTENT_LENGTH,
4294
+ HTTP_REQUEST);
4295
+
4296
+ test_simple_type(
4297
+ "POST / HTTP/1.1\r\n"
4298
+ "Content-Length: 42\r\n"
4299
+ " \r\n",
4300
+ HPE_OK,
4301
+ HTTP_REQUEST);
4302
+
4303
+ //// RESPONSES
4304
+
4305
+ test_simple_type("HTP/1.1 200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
4306
+ test_simple_type("HTTP/01.1 200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
4307
+ test_simple_type("HTTP/11.1 200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
4308
+ test_simple_type("HTTP/1.01 200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
4309
+ test_simple_type("HTTP/1.1\t200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
4310
+ test_simple_type("\rHTTP/1.1\t200 OK\r\n\r\n", HPE_INVALID_VERSION, HTTP_RESPONSE);
4311
+
4312
+ for (i = 0; i < ARRAY_SIZE(responses); i++) {
4313
+ test_message(&responses[i]);
4314
+ }
4315
+
4316
+ for (i = 0; i < ARRAY_SIZE(responses); i++) {
4317
+ test_message_pause(&responses[i]);
4318
+ }
4319
+
4320
+ for (i = 0; i < ARRAY_SIZE(responses); i++) {
4321
+ test_message_connect(&responses[i]);
4322
+ }
4323
+
4324
+ for (i = 0; i < ARRAY_SIZE(responses); i++) {
4325
+ if (!responses[i].should_keep_alive) continue;
4326
+ for (j = 0; j < ARRAY_SIZE(responses); j++) {
4327
+ if (!responses[j].should_keep_alive) continue;
4328
+ for (k = 0; k < ARRAY_SIZE(responses); k++) {
4329
+ test_multiple3(&responses[i], &responses[j], &responses[k]);
4330
+ }
4331
+ }
4332
+ }
4333
+
4334
+ test_message_count_body(&responses[NO_HEADERS_NO_BODY_404]);
4335
+ test_message_count_body(&responses[TRAILING_SPACE_ON_CHUNKED_BODY]);
4336
+
4337
+ // test very large chunked response
4338
+ {
4339
+ char * msg = create_large_chunked_message(31337,
4340
+ "HTTP/1.0 200 OK\r\n"
4341
+ "Transfer-Encoding: chunked\r\n"
4342
+ "Content-Type: text/plain\r\n"
4343
+ "\r\n");
4344
+ struct message large_chunked =
4345
+ {.name= "large chunked"
4346
+ ,.type= HTTP_RESPONSE
4347
+ ,.raw= msg
4348
+ ,.should_keep_alive= FALSE
4349
+ ,.message_complete_on_eof= FALSE
4350
+ ,.http_major= 1
4351
+ ,.http_minor= 0
4352
+ ,.status_code= 200
4353
+ ,.response_status= "OK"
4354
+ ,.num_headers= 2
4355
+ ,.headers=
4356
+ { { "Transfer-Encoding", "chunked" }
4357
+ , { "Content-Type", "text/plain" }
4358
+ }
4359
+ ,.body_size= 31337*1024
4360
+ ,.num_chunks_complete= 31338
4361
+ };
4362
+ for (i = 0; i < MAX_CHUNKS; i++) {
4363
+ large_chunked.chunk_lengths[i] = 1024;
4364
+ }
4365
+ test_message_count_body(&large_chunked);
4366
+ free(msg);
4367
+ }
4368
+
4369
+
4370
+
4371
+ printf("response scan 1/2 ");
4372
+ test_scan( &responses[TRAILING_SPACE_ON_CHUNKED_BODY]
4373
+ , &responses[NO_BODY_HTTP10_KA_204]
4374
+ , &responses[NO_REASON_PHRASE]
4375
+ );
4376
+
4377
+ printf("response scan 2/2 ");
4378
+ test_scan( &responses[BONJOUR_MADAME_FR]
4379
+ , &responses[UNDERSTORE_HEADER_KEY]
4380
+ , &responses[NO_CARRIAGE_RET]
4381
+ );
4382
+
4383
+ puts("responses okay");
4384
+
4385
+
4386
+ /// REQUESTS
4387
+
4388
+ test_simple("GET / IHTTP/1.0\r\n\r\n", HPE_INVALID_CONSTANT);
4389
+ test_simple("GET / ICE/1.0\r\n\r\n", HPE_INVALID_CONSTANT);
4390
+ test_simple("GET / HTP/1.1\r\n\r\n", HPE_INVALID_VERSION);
4391
+ test_simple("GET / HTTP/01.1\r\n\r\n", HPE_INVALID_VERSION);
4392
+ test_simple("GET / HTTP/11.1\r\n\r\n", HPE_INVALID_VERSION);
4393
+ test_simple("GET / HTTP/1.01\r\n\r\n", HPE_INVALID_VERSION);
4394
+
4395
+ test_simple("GET / HTTP/1.0\r\nHello: w\1rld\r\n\r\n", HPE_INVALID_HEADER_TOKEN);
4396
+ test_simple("GET / HTTP/1.0\r\nHello: woooo\2rld\r\n\r\n", HPE_INVALID_HEADER_TOKEN);
4397
+
4398
+ // Extended characters - see nodejs/test/parallel/test-http-headers-obstext.js
4399
+ test_simple("GET / HTTP/1.1\r\n"
4400
+ "Test: Düsseldorf\r\n",
4401
+ HPE_OK);
4402
+
4403
+ // Well-formed but incomplete
4404
+ test_simple("GET / HTTP/1.1\r\n"
4405
+ "Content-Type: text/plain\r\n"
4406
+ "Content-Length: 6\r\n"
4407
+ "\r\n"
4408
+ "fooba",
4409
+ HPE_OK);
4410
+
4411
+ // Unknown Transfer-Encoding in request
4412
+ test_simple("GET / HTTP/1.1\r\n"
4413
+ "Transfer-Encoding: unknown\r\n"
4414
+ "\r\n",
4415
+ HPE_INVALID_TRANSFER_ENCODING);
4416
+
4417
+ static const char *all_methods[] = {
4418
+ "DELETE",
4419
+ "GET",
4420
+ "HEAD",
4421
+ "POST",
4422
+ "PUT",
4423
+ //"CONNECT", //CONNECT can't be tested like other methods, it's a tunnel
4424
+ "OPTIONS",
4425
+ "TRACE",
4426
+ "COPY",
4427
+ "LOCK",
4428
+ "MKCOL",
4429
+ "MOVE",
4430
+ "PROPFIND",
4431
+ "PROPPATCH",
4432
+ "SEARCH",
4433
+ "UNLOCK",
4434
+ "BIND",
4435
+ "REBIND",
4436
+ "UNBIND",
4437
+ "ACL",
4438
+ "REPORT",
4439
+ "MKACTIVITY",
4440
+ "CHECKOUT",
4441
+ "MERGE",
4442
+ "M-SEARCH",
4443
+ "NOTIFY",
4444
+ "SUBSCRIBE",
4445
+ "UNSUBSCRIBE",
4446
+ "PATCH",
4447
+ "PURGE",
4448
+ "MKCALENDAR",
4449
+ "LINK",
4450
+ "UNLINK",
4451
+ 0 };
4452
+ const char **this_method;
4453
+ for (this_method = all_methods; *this_method; this_method++) {
4454
+ char buf[200];
4455
+ sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method);
4456
+ test_simple(buf, HPE_OK);
4457
+ }
4458
+
4459
+ static const char *bad_methods[] = {
4460
+ "ASDF",
4461
+ "C******",
4462
+ "COLA",
4463
+ "GEM",
4464
+ "GETA",
4465
+ "M****",
4466
+ "MKCOLA",
4467
+ "PROPPATCHA",
4468
+ "PUN",
4469
+ "PX",
4470
+ "SA",
4471
+ "hello world",
4472
+ 0 };
4473
+ for (this_method = bad_methods; *this_method; this_method++) {
4474
+ char buf[200];
4475
+ sprintf(buf, "%s / HTTP/1.1\r\n\r\n", *this_method);
4476
+ test_simple(buf, HPE_INVALID_METHOD);
4477
+ }
4478
+
4479
+ // illegal header field name line folding
4480
+ test_simple("GET / HTTP/1.1\r\n"
4481
+ "name\r\n"
4482
+ " : value\r\n"
4483
+ "\r\n",
4484
+ HPE_INVALID_HEADER_TOKEN);
4485
+
4486
+ const char *dumbluck2 =
4487
+ "GET / HTTP/1.1\r\n"
4488
+ "X-SSL-Nonsense: -----BEGIN CERTIFICATE-----\r\n"
4489
+ "\tMIIFbTCCBFWgAwIBAgICH4cwDQYJKoZIhvcNAQEFBQAwcDELMAkGA1UEBhMCVUsx\r\n"
4490
+ "\tETAPBgNVBAoTCGVTY2llbmNlMRIwEAYDVQQLEwlBdXRob3JpdHkxCzAJBgNVBAMT\r\n"
4491
+ "\tAkNBMS0wKwYJKoZIhvcNAQkBFh5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMu\r\n"
4492
+ "\tdWswHhcNMDYwNzI3MTQxMzI4WhcNMDcwNzI3MTQxMzI4WjBbMQswCQYDVQQGEwJV\r\n"
4493
+ "\tSzERMA8GA1UEChMIZVNjaWVuY2UxEzARBgNVBAsTCk1hbmNoZXN0ZXIxCzAJBgNV\r\n"
4494
+ "\tBAcTmrsogriqMWLAk1DMRcwFQYDVQQDEw5taWNoYWVsIHBhcmQYJKoZIhvcNAQEB\r\n"
4495
+ "\tBQADggEPADCCAQoCggEBANPEQBgl1IaKdSS1TbhF3hEXSl72G9J+WC/1R64fAcEF\r\n"
4496
+ "\tW51rEyFYiIeZGx/BVzwXbeBoNUK41OK65sxGuflMo5gLflbwJtHBRIEKAfVVp3YR\r\n"
4497
+ "\tgW7cMA/s/XKgL1GEC7rQw8lIZT8RApukCGqOVHSi/F1SiFlPDxuDfmdiNzL31+sL\r\n"
4498
+ "\t0iwHDdNkGjy5pyBSB8Y79dsSJtCW/iaLB0/n8Sj7HgvvZJ7x0fr+RQjYOUUfrePP\r\n"
4499
+ "\tu2MSpFyf+9BbC/aXgaZuiCvSR+8Snv3xApQY+fULK/xY8h8Ua51iXoQ5jrgu2SqR\r\n"
4500
+ "\twgA7BUi3G8LFzMBl8FRCDYGUDy7M6QaHXx1ZWIPWNKsCAwEAAaOCAiQwggIgMAwG\r\n"
4501
+ "\tA1UdEwEB/wQCMAAwEQYJYIZIAYb4QgHTTPAQDAgWgMA4GA1UdDwEB/wQEAwID6DAs\r\n"
4502
+ "\tBglghkgBhvhCAQ0EHxYdVUsgZS1TY2llbmNlIFVzZXIgQ2VydGlmaWNhdGUwHQYD\r\n"
4503
+ "\tVR0OBBYEFDTt/sf9PeMaZDHkUIldrDYMNTBZMIGaBgNVHSMEgZIwgY+AFAI4qxGj\r\n"
4504
+ "\tloCLDdMVKwiljjDastqooXSkcjBwMQswCQYDVQQGEwJVSzERMA8GA1UEChMIZVNj\r\n"
4505
+ "\taWVuY2UxEjAQBgNVBAsTCUF1dGhvcml0eTELMAkGA1UEAxMCQ0ExLTArBgkqhkiG\r\n"
4506
+ "\t9w0BCQEWHmNhLW9wZXJhdG9yQGdyaWQtc3VwcG9ydC5hYy51a4IBADApBgNVHRIE\r\n"
4507
+ "\tIjAggR5jYS1vcGVyYXRvckBncmlkLXN1cHBvcnQuYWMudWswGQYDVR0gBBIwEDAO\r\n"
4508
+ "\tBgwrBgEEAdkvAQEBAQYwPQYJYIZIAYb4QgEEBDAWLmh0dHA6Ly9jYS5ncmlkLXN1\r\n"
4509
+ "\tcHBvcnQuYWMudmT4sopwqlBWsvcHViL2NybC9jYWNybC5jcmwwPQYJYIZIAYb4QgEDBDAWLmh0\r\n"
4510
+ "\tdHA6Ly9jYS5ncmlkLXN1cHBvcnQuYWMudWsvcHViL2NybC9jYWNybC5jcmwwPwYD\r\n"
4511
+ "\tVR0fBDgwNjA0oDKgMIYuaHR0cDovL2NhLmdyaWQt5hYy51ay9wdWIv\r\n"
4512
+ "\tY3JsL2NhY3JsLmNybDANBgkqhkiG9w0BAQUFAAOCAQEAS/U4iiooBENGW/Hwmmd3\r\n"
4513
+ "\tXCy6Zrt08YjKCzGNjorT98g8uGsqYjSxv/hmi0qlnlHs+k/3Iobc3LjS5AMYr5L8\r\n"
4514
+ "\tUO7OSkgFFlLHQyC9JzPfmLCAugvzEbyv4Olnsr8hbxF1MbKZoQxUZtMVu29wjfXk\r\n"
4515
+ "\thTeApBv7eaKCWpSp7MCbvgzm74izKhu3vlDk9w6qVrxePfGgpKPqfHiOoGhFnbTK\r\n"
4516
+ "\twTC6o2xq5y0qZ03JonF7OJspEd3I5zKY3E+ov7/ZhW6DqT8UFvsAdjvQbXyhV8Eu\r\n"
4517
+ "\tYhixw1aKEPzNjNowuIseVogKOLXxWI5vAi5HgXdS0/ES5gDGsABo4fqovUKlgop3\r\n"
4518
+ "\tRA==\r\n"
4519
+ "\t-----END CERTIFICATE-----\r\n"
4520
+ "\r\n";
4521
+ test_simple(dumbluck2, HPE_OK);
4522
+
4523
+ const char *corrupted_connection =
4524
+ "GET / HTTP/1.1\r\n"
4525
+ "Host: www.example.com\r\n"
4526
+ "Connection\r\033\065\325eep-Alive\r\n"
4527
+ "Accept-Encoding: gzip\r\n"
4528
+ "\r\n";
4529
+ test_simple(corrupted_connection, HPE_INVALID_HEADER_TOKEN);
4530
+
4531
+ const char *corrupted_header_name =
4532
+ "GET / HTTP/1.1\r\n"
4533
+ "Host: www.example.com\r\n"
4534
+ "X-Some-Header\r\033\065\325eep-Alive\r\n"
4535
+ "Accept-Encoding: gzip\r\n"
4536
+ "\r\n";
4537
+ test_simple(corrupted_header_name, HPE_INVALID_HEADER_TOKEN);
4538
+
4539
+ #if 0
4540
+ // NOTE(Wed Nov 18 11:57:27 CET 2009) this seems okay. we just read body
4541
+ // until EOF.
4542
+ //
4543
+ // no content-length
4544
+ // error if there is a body without content length
4545
+ const char *bad_get_no_headers_no_body = "GET /bad_get_no_headers_no_body/world HTTP/1.1\r\n"
4546
+ "Accept: */*\r\n"
4547
+ "\r\n"
4548
+ "HELLO";
4549
+ test_simple(bad_get_no_headers_no_body, 0);
4550
+ #endif
4551
+ /* TODO sending junk and large headers gets rejected */
4552
+
4553
+
4554
+ /* check to make sure our predefined requests are okay */
4555
+ for (i = 0; i < ARRAY_SIZE(requests); i++) {
4556
+ test_message(&requests[i]);
4557
+ }
4558
+
4559
+ for (i = 0; i < ARRAY_SIZE(requests); i++) {
4560
+ test_message_pause(&requests[i]);
4561
+ }
4562
+
4563
+ for (i = 0; i < ARRAY_SIZE(requests); i++) {
4564
+ if (!requests[i].should_keep_alive) continue;
4565
+ for (j = 0; j < ARRAY_SIZE(requests); j++) {
4566
+ if (!requests[j].should_keep_alive) continue;
4567
+ for (k = 0; k < ARRAY_SIZE(requests); k++) {
4568
+ test_multiple3(&requests[i], &requests[j], &requests[k]);
4569
+ }
4570
+ }
4571
+ }
4572
+
4573
+ printf("request scan 1/4 ");
4574
+ test_scan( &requests[GET_NO_HEADERS_NO_BODY]
4575
+ , &requests[GET_ONE_HEADER_NO_BODY]
4576
+ , &requests[GET_NO_HEADERS_NO_BODY]
4577
+ );
4578
+
4579
+ printf("request scan 2/4 ");
4580
+ test_scan( &requests[POST_CHUNKED_ALL_YOUR_BASE]
4581
+ , &requests[POST_IDENTITY_BODY_WORLD]
4582
+ , &requests[GET_FUNKY_CONTENT_LENGTH]
4583
+ );
4584
+
4585
+ printf("request scan 3/4 ");
4586
+ test_scan( &requests[TWO_CHUNKS_MULT_ZERO_END]
4587
+ , &requests[CHUNKED_W_TRAILING_HEADERS]
4588
+ , &requests[CHUNKED_W_NONSENSE_AFTER_LENGTH]
4589
+ );
4590
+
4591
+ printf("request scan 4/4 ");
4592
+ test_scan( &requests[QUERY_URL_WITH_QUESTION_MARK_GET]
4593
+ , &requests[PREFIX_NEWLINE_GET ]
4594
+ , &requests[CONNECT_REQUEST]
4595
+ );
4596
+
4597
+ puts("requests okay");
4598
+
4599
+ return 0;
4600
+ }