httpp 0.8.0__tar.gz → 0.8.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. {httpp-0.8.0 → httpp-0.8.1}/CHANGELOG.md +35 -2
  2. {httpp-0.8.0 → httpp-0.8.1}/CMakeLists.txt +20 -20
  3. {httpp-0.8.0 → httpp-0.8.1}/HANDOFF.md +31 -5
  4. {httpp-0.8.0 → httpp-0.8.1}/PKG-INFO +13 -11
  5. {httpp-0.8.0 → httpp-0.8.1}/README.md +12 -10
  6. {httpp-0.8.0 → httpp-0.8.1}/checklist.md +12 -9
  7. {httpp-0.8.0 → httpp-0.8.1}/docs/Architecture.md +3 -3
  8. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0003-engine-and-third-party.md +2 -2
  9. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0005-multiprocess-workers.md +1 -1
  10. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0042-test-client.md +1 -1
  11. httpp-0.8.1/docs/adr/0043-websocket-close-1001-on-drain.md +45 -0
  12. httpp-0.8.1/docs/adr/0044-worker-respawn.md +43 -0
  13. httpp-0.8.1/docs/adr/0045-conditional-static-files.md +42 -0
  14. httpp-0.8.1/docs/adr/0046-testclient-websocket-and-files.md +43 -0
  15. httpp-0.8.1/docs/adr/0047-one-mime-table-and-exchange-leak.md +43 -0
  16. httpp-0.8.1/docs/adr/0048-websocket-on-routers-and-dependencies.md +26 -0
  17. httpp-0.8.1/docs/adr/0049-split-the-cython-module-into-pxi-files.md +21 -0
  18. httpp-0.8.1/docs/adr/0050-own-logging-module-replaces-aixlog.md +28 -0
  19. httpp-0.8.1/docs/adr/0051-sync-client-on-the-async-engine.md +44 -0
  20. httpp-0.8.1/docs/adr/0052-downloads-stream-through-a-body-sink.md +42 -0
  21. httpp-0.8.1/docs/adr/0053-cpp-httplib-removed.md +26 -0
  22. httpp-0.8.1/docs/adr/0054-own-file-system-module.md +37 -0
  23. httpp-0.8.1/docs/adr/0055-httpp-path-class.md +27 -0
  24. httpp-0.8.1/docs/adr/0056-operating-system-log-handlers.md +27 -0
  25. httpp-0.8.1/docs/adr/0057-public-logging-module.md +28 -0
  26. httpp-0.8.1/docs/adr/0058-fs-merged-into-path.md +25 -0
  27. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/README.md +17 -1
  28. {httpp-0.8.0 → httpp-0.8.1}/docs/agent.md +2 -2
  29. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/client.hpp +15 -15
  30. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/curl.hpp +2 -3
  31. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/download.hpp +5 -4
  32. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/export.hpp +4 -0
  33. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/file_browser.hpp +1 -1
  34. httpp-0.8.1/include/httpp/log.hpp +51 -0
  35. httpp-0.8.1/include/httpp/logging.hpp +334 -0
  36. httpp-0.8.1/include/httpp/path.hpp +152 -0
  37. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/router.hpp +12 -0
  38. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/server.hpp +5 -1
  39. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/sha256.hpp +2 -1
  40. {httpp-0.8.0 → httpp-0.8.1}/include/httpp.h +1 -1
  41. {httpp-0.8.0 → httpp-0.8.1}/pyproject.toml +0 -1
  42. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/CMakeLists.txt +2 -2
  43. httpp-0.8.1/src/bindings/python/cy/async_routes.pxi +509 -0
  44. httpp-0.8.1/src/bindings/python/cy/client.pxi +306 -0
  45. httpp-0.8.1/src/bindings/python/cy/declarations.pxi +342 -0
  46. httpp-0.8.1/src/bindings/python/cy/request.pxi +276 -0
  47. httpp-0.8.1/src/bindings/python/cy/server.pxi +281 -0
  48. httpp-0.8.1/src/bindings/python/cy/support.pxi +184 -0
  49. httpp-0.8.1/src/bindings/python/cy/transfer.pxi +498 -0
  50. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/__init__.py +2 -2
  51. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_log.py +15 -0
  52. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_params.py +12 -5
  53. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_router.py +24 -0
  54. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_run.py +96 -7
  55. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/server.py +37 -15
  56. httpp-0.8.1/src/bindings/python/httpp/testclient.py +656 -0
  57. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/utils.py +4 -3
  58. httpp-0.8.1/src/bindings/python/httpp_cy.pyx +31 -0
  59. {httpp-0.8.0 → httpp-0.8.1}/src/cli/httpp_cli.cpp +8 -31
  60. {httpp-0.8.0 → httpp-0.8.1}/src/core/async_http.cpp +37 -2
  61. {httpp-0.8.0 → httpp-0.8.1}/src/core/async_server.cpp +16 -2
  62. httpp-0.8.1/src/core/client.cpp +362 -0
  63. httpp-0.8.1/src/core/curl.cpp +51 -0
  64. httpp-0.8.1/src/core/download.cpp +520 -0
  65. {httpp-0.8.0 → httpp-0.8.1}/src/core/file_browser.cpp +29 -100
  66. httpp-0.8.1/src/core/http_exchange.cpp +291 -0
  67. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/async_http.hpp +28 -1
  68. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/async_server.hpp +4 -1
  69. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/content_decode.hpp +1 -1
  70. httpp-0.8.1/src/core/internal/http_exchange.hpp +133 -0
  71. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/log.hpp +2 -2
  72. httpp-0.8.1/src/core/internal/logging_os.hpp +196 -0
  73. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/tls_session.hpp +1 -1
  74. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/websocket.hpp +1 -0
  75. httpp-0.8.1/src/core/log.cpp +151 -0
  76. httpp-0.8.1/src/core/logging.cpp +569 -0
  77. httpp-0.8.1/src/core/logging_os.cpp +244 -0
  78. httpp-0.8.1/src/core/path.cpp +247 -0
  79. {httpp-0.8.0 → httpp-0.8.1}/src/core/router.cpp +11 -0
  80. {httpp-0.8.0 → httpp-0.8.1}/src/core/server.cpp +166 -49
  81. {httpp-0.8.0 → httpp-0.8.1}/src/core/sha256.cpp +4 -4
  82. {httpp-0.8.0 → httpp-0.8.1}/src/core/tls_session.cpp +8 -7
  83. {httpp-0.8.0 → httpp-0.8.1}/src/core/websocket.cpp +5 -0
  84. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/README.md +9 -19
  85. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/CMakeLists.txt +2 -3
  86. httpp-0.8.1/tests/cpp/test_async_stream.cpp +155 -0
  87. httpp-0.8.1/tests/cpp/test_client_blocking_engine.cpp +123 -0
  88. httpp-0.8.1/tests/cpp/test_download_transfer.cpp +182 -0
  89. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_log.cpp +16 -1
  90. httpp-0.8.1/tests/cpp/test_logging_module.cpp +445 -0
  91. httpp-0.8.1/tests/cpp/test_logging_os.cpp +176 -0
  92. httpp-0.8.1/tests/cpp/test_mime.cpp +27 -0
  93. httpp-0.8.1/tests/cpp/test_path.cpp +266 -0
  94. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_router.cpp +27 -0
  95. httpp-0.8.1/tests/cpp/test_server_conditional.cpp +172 -0
  96. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_io_threads.cpp +22 -3
  97. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_shutdown.cpp +50 -0
  98. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_websocket_session.cpp +25 -0
  99. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/ws_test_client.hpp +2 -0
  100. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_cpp_python_parity.py +6 -2
  101. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_httpp_basic.py +28 -0
  102. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_httpp_routes.py +24 -2
  103. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_io_threads.py +2 -2
  104. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_log.py +12 -0
  105. httpp-0.8.1/tests/python/test_pathlib.py +84 -0
  106. httpp-0.8.1/tests/python/test_portability_sources.py +21 -0
  107. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_responses.py +37 -0
  108. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_run.py +184 -3
  109. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_shutdown.py +59 -0
  110. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_testclient.py +186 -0
  111. httpp-0.8.1/tests/python/test_websocket_router.py +320 -0
  112. httpp-0.8.0/include/httpp/log.hpp +0 -31
  113. httpp-0.8.0/src/bindings/python/httpp/testclient.py +0 -361
  114. httpp-0.8.0/src/bindings/python/httpp_cy.pyx +0 -2369
  115. httpp-0.8.0/src/core/client.cpp +0 -807
  116. httpp-0.8.0/src/core/curl.cpp +0 -115
  117. httpp-0.8.0/src/core/download.cpp +0 -610
  118. httpp-0.8.0/src/core/internal/httplib_common.hpp +0 -36
  119. httpp-0.8.0/src/core/log.cpp +0 -107
  120. httpp-0.8.0/src/third_party/aixlog/LICENSE +0 -21
  121. httpp-0.8.0/src/third_party/aixlog/aixlog.hpp +0 -1254
  122. httpp-0.8.0/src/third_party/cpp-httplib/httplib.h +0 -22669
  123. {httpp-0.8.0 → httpp-0.8.1}/.github/workflows/autobahn.yml +0 -0
  124. {httpp-0.8.0 → httpp-0.8.1}/.github/workflows/cmake.yml +0 -0
  125. {httpp-0.8.0 → httpp-0.8.1}/.github/workflows/orchestrator.yml +0 -0
  126. {httpp-0.8.0 → httpp-0.8.1}/.github/workflows/release_template.md +0 -0
  127. {httpp-0.8.0 → httpp-0.8.1}/.github/workflows/wheels.yml +0 -0
  128. {httpp-0.8.0 → httpp-0.8.1}/.gitignore +0 -0
  129. {httpp-0.8.0 → httpp-0.8.1}/.gitmodules +0 -0
  130. {httpp-0.8.0 → httpp-0.8.1}/LICENSE.txt +0 -0
  131. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/.gitignore +0 -0
  132. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/CMakeLists.txt +0 -0
  133. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/README.md +0 -0
  134. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/asgi_app.py +0 -0
  135. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/bench.py +0 -0
  136. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/bench_setup.py +0 -0
  137. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/bench_validate.py +0 -0
  138. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/cpp/cpp_bench.cpp +0 -0
  139. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/cpp/drogon_bench.cpp +0 -0
  140. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/cpp/ws_load.cpp +0 -0
  141. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/cpu_app.py +0 -0
  142. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/cpu_bench.py +0 -0
  143. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/diag_io.sh +0 -0
  144. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/fastapi_app.py +0 -0
  145. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/httpp_app.py +0 -0
  146. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/io_app.py +0 -0
  147. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/io_bench.py +0 -0
  148. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/stress.py +0 -0
  149. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/suite.py +0 -0
  150. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/suite_app.py +0 -0
  151. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/suite_asgi.py +0 -0
  152. {httpp-0.8.0 → httpp-0.8.1}/benchmarks/ws_websockets.py +0 -0
  153. {httpp-0.8.0 → httpp-0.8.1}/cmake/DynamicVersion.cmake +0 -0
  154. {httpp-0.8.0 → httpp-0.8.1}/cmake/EmbedFile.cmake +0 -0
  155. {httpp-0.8.0 → httpp-0.8.1}/cmake/FindCython.cmake +0 -0
  156. {httpp-0.8.0 → httpp-0.8.1}/cmake/Optimize.cmake +0 -0
  157. {httpp-0.8.0 → httpp-0.8.1}/cmake/Startup.cmake +0 -0
  158. {httpp-0.8.0 → httpp-0.8.1}/cmake/UseCython.cmake +0 -0
  159. {httpp-0.8.0 → httpp-0.8.1}/cmake/httppConfig.cmake.in +0 -0
  160. {httpp-0.8.0 → httpp-0.8.1}/cmake/httpp_mbedtls_config.h +0 -0
  161. {httpp-0.8.0 → httpp-0.8.1}/cmake/utils/embedded_files.in.hpp +0 -0
  162. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0001-own-both-layers.md +0 -0
  163. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0002-standard-asyncio-loop.md +0 -0
  164. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0004-zero-system-dependencies.md +0 -0
  165. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0006-own-model-layer.md +0 -0
  166. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0007-openapi-from-one-plan.md +0 -0
  167. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0008-swagger-ui-compiled-in.md +0 -0
  168. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0009-hot-path.md +0 -0
  169. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0010-mbedtls-threading.md +0 -0
  170. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0011-logging.md +0 -0
  171. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0012-run-wins-over-listen.md +0 -0
  172. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0013-packaging.md +0 -0
  173. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0014-coding-conventions.md +0 -0
  174. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0015-testing-and-ci.md +0 -0
  175. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0016-hybrid-api-parity.md +0 -0
  176. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0017-python-binding-policy.md +0 -0
  177. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0018-python-logging-bridge.md +0 -0
  178. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0019-vendored-deflate-inflate.md +0 -0
  179. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0020-http-exception-and-response-classes.md +0 -0
  180. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0021-pool-thread-state-and-two-core-numbers.md +0 -0
  181. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0022-dual-api-rule-and-delegated-decisions.md +0 -0
  182. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0023-inline-async-handlers.md +0 -0
  183. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0024-io-threads-and-lanes.md +0 -0
  184. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0025-measured-defaults-on-16-threads.md +0 -0
  185. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0026-websocket.md +0 -0
  186. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0027-websocket-python-and-async-handshake.md +0 -0
  187. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0028-autobahn-called-by-the-orchestrator.md +0 -0
  188. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0029-incremental-utf8-validation.md +0 -0
  189. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0030-benchmarks-built-by-cmake.md +0 -0
  190. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0031-compressed-embedded-files.md +0 -0
  191. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0032-read-only-file-browser.md +0 -0
  192. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0033-engine-per-request-cost.md +0 -0
  193. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0034-balanced-connections-between-io-threads.md +0 -0
  194. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0035-hook-path-needs-no-server-pointer.md +0 -0
  195. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0036-connection-read-buffer-not-zero-filled.md +0 -0
  196. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0037-middleware-through-use.md +0 -0
  197. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0038-graceful-shutdown.md +0 -0
  198. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0039-reload-supervisor.md +0 -0
  199. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0040-server-tls.md +0 -0
  200. {httpp-0.8.0 → httpp-0.8.1}/docs/adr/0041-native-cli-and-py.md +0 -0
  201. {httpp-0.8.0 → httpp-0.8.1}/docs/index.rst +0 -0
  202. {httpp-0.8.0 → httpp-0.8.1}/examples/find_httpp_via_python/CMakeLists.txt +0 -0
  203. {httpp-0.8.0 → httpp-0.8.1}/examples/find_httpp_via_python/main.cpp +0 -0
  204. {httpp-0.8.0 → httpp-0.8.1}/examples/python/01_hello_server.py +0 -0
  205. {httpp-0.8.0 → httpp-0.8.1}/examples/python/02_path_params.py +0 -0
  206. {httpp-0.8.0 → httpp-0.8.1}/examples/python/03_request_object.py +0 -0
  207. {httpp-0.8.0 → httpp-0.8.1}/examples/python/04_responses.py +0 -0
  208. {httpp-0.8.0 → httpp-0.8.1}/examples/python/05_http_methods.py +0 -0
  209. {httpp-0.8.0 → httpp-0.8.1}/examples/python/06_async_handlers.py +0 -0
  210. {httpp-0.8.0 → httpp-0.8.1}/examples/python/07_serve_directory.py +0 -0
  211. {httpp-0.8.0 → httpp-0.8.1}/examples/python/08_error_handling.py +0 -0
  212. {httpp-0.8.0 → httpp-0.8.1}/examples/python/09_client.py +0 -0
  213. {httpp-0.8.0 → httpp-0.8.1}/examples/python/10_request_builder.py +0 -0
  214. {httpp-0.8.0 → httpp-0.8.1}/examples/python/11_download.py +0 -0
  215. {httpp-0.8.0 → httpp-0.8.1}/examples/python/12_hooks_and_settings.py +0 -0
  216. {httpp-0.8.0 → httpp-0.8.1}/examples/python/13_streaming_and_files.py +0 -0
  217. {httpp-0.8.0 → httpp-0.8.1}/examples/python/14_async_client.py +0 -0
  218. {httpp-0.8.0 → httpp-0.8.1}/examples/python/15_progress_and_url.py +0 -0
  219. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/curl_compat.h +0 -0
  220. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/middleware.hpp +0 -0
  221. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/progress.hpp +0 -0
  222. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/swagger_ui.hpp +0 -0
  223. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/url.hpp +0 -0
  224. {httpp-0.8.0 → httpp-0.8.1}/include/httpp/websocket.hpp +0 -0
  225. {httpp-0.8.0 → httpp-0.8.1}/requirements-dev.txt +0 -0
  226. {httpp-0.8.0 → httpp-0.8.1}/src/assets/file_browser.html +0 -0
  227. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/_validate_cy.pyx +0 -0
  228. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/__main__.py +0 -0
  229. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_background.py +0 -0
  230. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_forms.py +0 -0
  231. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_http.py +0 -0
  232. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_reload.py +0 -0
  233. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_schema.py +0 -0
  234. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_validate.py +0 -0
  235. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/_websocket.py +0 -0
  236. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/errors.py +0 -0
  237. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/middleware.py +0 -0
  238. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/models.py +0 -0
  239. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/progress.py +0 -0
  240. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/responses.py +0 -0
  241. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp/status.py +0 -0
  242. {httpp-0.8.0 → httpp-0.8.1}/src/bindings/python/httpp_cli.py +0 -0
  243. {httpp-0.8.0 → httpp-0.8.1}/src/core/content_decode.cpp +0 -0
  244. {httpp-0.8.0 → httpp-0.8.1}/src/core/curl_compat.cpp +0 -0
  245. {httpp-0.8.0 → httpp-0.8.1}/src/core/deflate.cpp +0 -0
  246. {httpp-0.8.0 → httpp-0.8.1}/src/core/form.cpp +0 -0
  247. {httpp-0.8.0 → httpp-0.8.1}/src/core/inflate.cpp +0 -0
  248. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/blocking_pool.hpp +0 -0
  249. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/checksums.hpp +0 -0
  250. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/deflate.hpp +0 -0
  251. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/inflate.hpp +0 -0
  252. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/response_compression.hpp +0 -0
  253. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/urlencoded.hpp +0 -0
  254. {httpp-0.8.0 → httpp-0.8.1}/src/core/internal/worker_pool.hpp +0 -0
  255. {httpp-0.8.0 → httpp-0.8.1}/src/core/mbedtls_alt/threading_alt.h +0 -0
  256. {httpp-0.8.0 → httpp-0.8.1}/src/core/mbedtls_threading.cpp +0 -0
  257. {httpp-0.8.0 → httpp-0.8.1}/src/core/middleware.cpp +0 -0
  258. {httpp-0.8.0 → httpp-0.8.1}/src/core/progress.cpp +0 -0
  259. {httpp-0.8.0 → httpp-0.8.1}/src/core/response_compression.cpp +0 -0
  260. {httpp-0.8.0 → httpp-0.8.1}/src/core/swagger_ui.cpp +0 -0
  261. {httpp-0.8.0 → httpp-0.8.1}/src/core/url.cpp +0 -0
  262. {httpp-0.8.0 → httpp-0.8.1}/src/core/websocket_api.cpp +0 -0
  263. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/CLI11/CLI11.hpp +0 -0
  264. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/indicators/indicators.hpp +0 -0
  265. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/llhttp/LICENSE +0 -0
  266. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/llhttp/VENDORED.md +0 -0
  267. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/llhttp/include/llhttp.h +0 -0
  268. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/llhttp/src/api.c +0 -0
  269. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/llhttp/src/http.c +0 -0
  270. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/llhttp/src/llhttp.c +0 -0
  271. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/stb_deflate/LICENSE +0 -0
  272. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/stb_deflate/VENDORED.md +0 -0
  273. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/stb_deflate/stb_deflate.h +0 -0
  274. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/stb_inflate/LICENSE +0 -0
  275. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/stb_inflate/VENDORED.md +0 -0
  276. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/stb_inflate/stb_inflate.h +0 -0
  277. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/swagger-ui/LICENSE +0 -0
  278. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/swagger-ui/NOTICE +0 -0
  279. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/swagger-ui/VENDORED.md +0 -0
  280. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/swagger-ui/swagger-api-icon.svg +0 -0
  281. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/swagger-ui/swagger-ui-bundle.js +0 -0
  282. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/swagger-ui/swagger-ui-bundle.js.LICENSE.txt +0 -0
  283. {httpp-0.8.0 → httpp-0.8.1}/src/third_party/swagger-ui/swagger-ui.css +0 -0
  284. {httpp-0.8.0 → httpp-0.8.1}/tests/CMakeLists.txt +0 -0
  285. {httpp-0.8.0 → httpp-0.8.1}/tests/cmake/CMakeLists.txt +0 -0
  286. {httpp-0.8.0 → httpp-0.8.1}/tests/cmake/consumer_project/CMakeLists.txt +0 -0
  287. {httpp-0.8.0 → httpp-0.8.1}/tests/cmake/consumer_project/main.cpp +0 -0
  288. {httpp-0.8.0 → httpp-0.8.1}/tests/cmake/embed_compress/CMakeLists.txt +0 -0
  289. {httpp-0.8.0 → httpp-0.8.1}/tests/cmake/embed_compress/main.cpp +0 -0
  290. {httpp-0.8.0 → httpp-0.8.1}/tests/cmake/run_consumer_test.cmake +0 -0
  291. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/inflate_fixtures.hpp +0 -0
  292. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/local_server.hpp +0 -0
  293. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/swagger_original.hpp +0 -0
  294. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_async_http.cpp +0 -0
  295. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_async_https.cpp +0 -0
  296. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_async_pool_proxy.cpp +0 -0
  297. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_async_server.cpp +0 -0
  298. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_certs.hpp +0 -0
  299. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_client.cpp +0 -0
  300. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_client_async_engine.cpp +0 -0
  301. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_client_encoding.cpp +0 -0
  302. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_client_request.cpp +0 -0
  303. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_client_session.cpp +0 -0
  304. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_curl.cpp +0 -0
  305. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_curl_compat.cpp +0 -0
  306. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_deflate.cpp +0 -0
  307. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_download.cpp +0 -0
  308. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_file_browser.cpp +0 -0
  309. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_form.cpp +0 -0
  310. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_inflate.cpp +0 -0
  311. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_progress.cpp +0 -0
  312. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server.cpp +0 -0
  313. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_after_send.cpp +0 -0
  314. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_compression.cpp +0 -0
  315. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_features.cpp +0 -0
  316. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_io_routes.cpp +0 -0
  317. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_middleware.cpp +0 -0
  318. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_routing.cpp +0 -0
  319. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_tls.cpp +0 -0
  320. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_server_websocket.cpp +0 -0
  321. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_sha256.cpp +0 -0
  322. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_swagger_ui.cpp +0 -0
  323. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_swagger_ui_route.cpp +0 -0
  324. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_url.cpp +0 -0
  325. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/test_worker_pool.cpp +0 -0
  326. {httpp-0.8.0 → httpp-0.8.1}/tests/cpp/tls_test_server.hpp +0 -0
  327. {httpp-0.8.0 → httpp-0.8.1}/tests/python/CMakeLists.txt +0 -0
  328. {httpp-0.8.0 → httpp-0.8.1}/tests/python/conftest.py +0 -0
  329. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_abi3_safe.py +0 -0
  330. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_async_engine.py +0 -0
  331. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_cli.py +0 -0
  332. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_cli_path.py +0 -0
  333. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_client.py +0 -0
  334. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_client_encoding.py +0 -0
  335. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_client_keep_alive.py +0 -0
  336. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_download_progress_url.py +0 -0
  337. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_download_sha256.py +0 -0
  338. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_embed_file.py +0 -0
  339. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_examples.py +0 -0
  340. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_file_browser.py +0 -0
  341. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_forms.py +0 -0
  342. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_inline_async.py +0 -0
  343. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_log_bridge.py +0 -0
  344. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_middleware.py +0 -0
  345. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_models_vs_pydantic.py +0 -0
  346. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_openapi.py +0 -0
  347. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_params_depends.py +0 -0
  348. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_path_templates.py +0 -0
  349. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_pool_thread_state.py +0 -0
  350. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_query_encoding.py +0 -0
  351. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_reload.py +0 -0
  352. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_response_injection.py +0 -0
  353. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_router.py +0 -0
  354. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_server_features.py +0 -0
  355. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_server_raw_request.py +0 -0
  356. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_tls.py +0 -0
  357. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_validate_vs_pydantic.py +0 -0
  358. {httpp-0.8.0 → httpp-0.8.1}/tests/python/test_websocket.py +0 -0
  359. {httpp-0.8.0 → httpp-0.8.1}/tests/utest/utest.h +0 -0
  360. {httpp-0.8.0 → httpp-0.8.1}/tests/utest/utest_main.cxx +0 -0
  361. {httpp-0.8.0 → httpp-0.8.1}/tools/autobahn/README.md +0 -0
  362. {httpp-0.8.0 → httpp-0.8.1}/tools/autobahn/check_report.py +0 -0
  363. {httpp-0.8.0 → httpp-0.8.1}/tools/autobahn/echo_server.py +0 -0
  364. {httpp-0.8.0 → httpp-0.8.1}/tools/autobahn/fuzzingclient.json +0 -0
  365. {httpp-0.8.0 → httpp-0.8.1}/tools/fastapi_probes/probe_fastapi_deps_responses.py +0 -0
  366. {httpp-0.8.0 → httpp-0.8.1}/tools/fastapi_probes/probe_fastapi_params.py +0 -0
  367. {httpp-0.8.0 → httpp-0.8.1}/tools/fastapi_probes/probe_pydantic_types.py +0 -0
  368. {httpp-0.8.0 → httpp-0.8.1}/version.py +0 -0
@@ -7,9 +7,41 @@ such changes are listed under **Changed**).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.1] - 2026-11-11
11
+
10
12
  ### Added
11
13
 
12
- - **`httpp.testclient.TestClient`** (ADR-0042): a Starlette-shaped client for testing your app. It serves the app on a free loopback port of its own and goes through httpp's client, so tests meet the real routing, middleware and error paths. Cookies, redirects, `base_url`/`Host`, `raise_server_exceptions`, startup and shutdown hooks (`with TestClient(app)`). Not yet: `websocket_connect`, multipart `files=`, an in-memory mode.
14
+ - The file system module is part of `httpp::path` (ADR-0058): `stat`, `lstat`, `resolve`, `is_relative_to`, `iterdir`, `rmdir`, `is_executable` are members next to `exists`, `mkdir`, `unlink`, `rename`; there is no separate `httpp::fs` any more. `mkdir()` is now true only when this call created the directory.
15
+ - **`httpp/logging.hpp` is public** (ADR-0057): the Python-shaped logging module httpp logs through (`get_logger`, `logger`, `formatter`, `stream/file/callback/null_handler`, your own `handler` subclass) is installed and exported. The "httpp" logger can take extra handlers. Python keeps using its standard `logging`.
16
+ - **`set_log_system`** (ADR-0056, C++ and Python): send the library log to the operating system's log: syslog, logcat, Apple unified logging, Windows debugger output or the Event Log (`"native"` picks the platform's usual one). Ported from libstb.
17
+ - **`httpp::path`** (ADR-0055, `httpp/path.hpp`): a pathlib-shaped path type for C++ (`/`, `name`, `stem`, `suffix`, `parent`, `exists`, `open`, `read_text`, `path::cwd()`, `as_uri`, ...). The public API that names a file takes it (strings still convert): `download`, `sha256_file`, `set_log_file`, `set_ca_file`, `set_tls`, `mount_file_browser`, `response::file`. In Python every path argument now also takes a `pathlib.Path`.
18
+
19
+ ### Fixed
20
+
21
+ - **No more `std::filesystem` anywhere in the library or the CLI** (ADR-0054): an internal `httpp::fs` module (merged into `httpp::path` by ADR-0058) (POSIX calls, the wide Win32 API on Windows, UTF-8 paths) is used by downloads, the file browser, static files, the logging module, TLS certificate loading, `sha256_file` and the CLI. This removes the macOS 10.13 build break and five private copies of the same operations. On Windows, non-ASCII file names now work in all of them.
22
+ - **macOS wheel build:** the internal logging module's `file_handler` took a `std::filesystem::path`, which the macOS 10.13 target does not have (CI failed in `log.cpp`). It takes a UTF-8 `std::string` now (converted to UTF-16 on Windows, so a non-ASCII log path works there too), and `tests/python/test_portability_sources.py` fails on any `std::filesystem` outside an `_WIN32` block.
23
+ - **Python log bridge at interpreter exit:** the C++ trampoline checks `Py_IsInitialized()` before taking the GIL and an `atexit` hook hands the log back to stderr, so a library thread that logs late cannot reach a dying interpreter (the same fix libstb made for its bridge).
24
+
25
+ ### Changed
26
+
27
+ - **cpp-httplib is removed** (ADR-0052, ADR-0053). Downloads now stream through a body sink on a dedicated engine (the destination file is created only for an accepted status; a Range reply of 200 restarts the file), `httpp.curl` is a thin face on `client.request`, and the vendored `httplib.h` is deleted. No public API change.
28
+ - **The blocking client runs on the async engine** (ADR-0051): `client`, `client::request::run` and `client::fetch` share one policy layer with `async_client` (redirects, auth, cookies, proxy, TLS). A `client` can now be shared between threads without taking turns, connections are pooled across clients, a blocking call from an async callback returns an error instead of deadlocking, and `async_client::set_header` replaces a same-name default. cpp-httplib now serves only downloads and the `curl` helper.
29
+ - **Logging no longer uses the vendored AixLog** (ADR-0050): the library logs through a small internal module ported from libstb (Python-shaped loggers, handlers and formatter, no dependency, no patch). `set_log_level`, `set_log_file`, `set_log_callback` are unchanged in C++ and Python; the default line is now `time [LEVEL] httpp (function): message`.
30
+ - The Cython module `httpp_cy.pyx` is split into `cy/*.pxi` files (textual includes, still one module and one extension; ADR-0049). No behaviour change.
31
+
32
+ ### Added
33
+
34
+ - **WebSocket routes on routers and `Depends` on WebSocket routes** (ADR-0048): `router::route_ws` and `@router.websocket(...)` join prefixes like HTTP routes; a Python WebSocket handler may use `Depends` (sync, async, `yield` cleanup, sub-dependencies). A failing dependency refuses the upgrade (`HTTPException` status, or 422); a dependency may take `websocket`.
35
+ - **WebSocket close 1001 on shutdown** (ADR-0043): `server.shutdown()` and SIGTERM now send each open WebSocket a close frame with code 1001 and wait for the peer's answer (up to the grace period) instead of dropping the connection; a handler sees a clean close.
36
+ - **Dead `--workers` are restarted** (ADR-0044): the supervisor starts a new worker at once the first time and with a growing wait after that (0.5, 1, 2, 4 seconds); a worker that keeps dying right after it starts stops the group with exit code 1. Workers also end when the supervisor is killed, even with SIGKILL (Linux).
37
+ - **`ETag`, `Last-Modified` and conditional requests for mounted files** (ADR-0045): `If-None-Match` and `If-Modified-Since` give 304, `If-Match` and `If-Unmodified-Since` give 412, `If-Range` decides whether a `Range` is honoured. This covers `serve_directory` and the file browser's raw route.
38
+ - **`httpp.testclient.TestClient`** (ADR-0042): a Starlette-shaped client for testing your app. It serves the app on a free loopback port of its own and goes through httpp's client, so tests meet the real routing, middleware and error paths. Cookies, redirects, `base_url`/`Host`, `raise_server_exceptions`, startup and shutdown hooks (`with TestClient(app)`). Also `files=` (multipart) and `websocket_connect` (ADR-0046). Not yet: an in-memory mode.
39
+
40
+ ### Fixed
41
+
42
+ - A 304 answer no longer carries `Content-Length: 0`.
43
+ - Python's `file()`, `FileResponse` and `TestClient(files=)` choose the Content-Type with the same table as mounted directories (ADR-0047), so `ico`, `gz`, `wav` and `yaml` no longer differ and nothing depends on the operating system's MIME registry. `yaml` and `yml` are now `application/yaml`.
44
+ - The async client no longer leaks the exchanges that were still waiting when the client was destroyed (a reference cycle, ADR-0047).
13
45
 
14
46
  ### Changed (breaking)
15
47
 
@@ -428,7 +460,8 @@ First release.
428
460
  - Single umbrella header `include/httpp.h` that carries the version, and `version.py` for tagging and releases.
429
461
  - CMake and wheels workflows in CI.
430
462
 
431
- [Unreleased]: https://github.com/MohammadRaziei/httpp/compare/v0.8.0...HEAD
463
+ [Unreleased]: https://github.com/MohammadRaziei/httpp/compare/v0.8.1...HEAD
464
+ [0.8.1]: https://github.com/MohammadRaziei/httpp/compare/v0.8.0...v0.8.1
432
465
  [0.8.0]: https://github.com/MohammadRaziei/httpp/compare/v0.7.0...v0.8.0
433
466
  [0.7.0]: https://github.com/MohammadRaziei/httpp/compare/v0.6.1...v0.7.0
434
467
  [0.6.1]: https://github.com/MohammadRaziei/httpp/compare/v0.6.0...v0.6.1
@@ -26,12 +26,11 @@ option(HTTPP_BUILD_PYTHON "Build Python bindings" ${PROJECT_IS_TOP_LEVEL})
26
26
  set(HTTPP_SOURCE_DIR ${PROJECT_SOURCE_DIR})
27
27
 
28
28
  # --- httpp C++ core ---
29
- # httplib.h is vendored at src/third_party/cpp-httplib (a real committed
30
- # file, no system package). mbedtls is a git submodule at
31
- # src/third_party/mbedtls (also built from source, no system package).
32
- # Both are included only from src/core/*.cpp, never from a public
33
- # include/httpp/*.hpp header, and are compiled with hidden visibility so
34
- # they never leak into the httpp .so/.a's public symbols.
29
+ # mbedtls is a git submodule at src/third_party/mbedtls (built from
30
+ # source, no system package). It is included only from src/core/*.cpp,
31
+ # never from a public include/httpp/*.hpp header, and is compiled with
32
+ # hidden visibility so it never leaks into the httpp .so/.a's public
33
+ # symbols.
35
34
  file(GLOB HTTPP_CORE_SOURCES ${PROJECT_SOURCE_DIR}/src/core/*.cpp)
36
35
 
37
36
  # Swagger UI (vendored in src/third_party/swagger-ui) is compiled into the library: at CONFIGURE time its three
@@ -61,7 +60,7 @@ embed_files(
61
60
 
62
61
  # liburlparser (git submodule, built from source - no system package) does
63
62
  # the real URL parsing (scheme/host/port/path, IPv4/IPv6, PSL-aware). It is
64
- # linked PRIVATE into httpp_core, same as cpp-httplib: consumers of
63
+ # linked PRIVATE into httpp_core, same as mbedtls: consumers of
65
64
  # <httpp/url.hpp> see only httpp::url, never urlparser::url directly.
66
65
  set(BUILD_PYTHON OFF CACHE BOOL "" FORCE)
67
66
  # Needed so liburlparser's static lib can be linked into httpp's shared
@@ -69,7 +68,7 @@ set(BUILD_PYTHON OFF CACHE BOOL "" FORCE)
69
68
  set(CMAKE_POSITION_INDEPENDENT_CODE ON)
70
69
  add_subdirectory(${PROJECT_SOURCE_DIR}/src/third_party/liburlparser)
71
70
 
72
- # mbedtls (TLS support for HTTPS, via cpp-httplib's CPPHTTPLIB_MBEDTLS_SUPPORT).
71
+ # mbedtls (TLS support for HTTPS: src/core/tls_session.cpp).
73
72
  set(ENABLE_PROGRAMS OFF CACHE BOOL "" FORCE)
74
73
  set(ENABLE_TESTING OFF CACHE BOOL "" FORCE)
75
74
  set(MBEDTLS_FATAL_WARNINGS OFF CACHE BOOL "" FORCE)
@@ -166,15 +165,12 @@ target_include_directories(httpp_core
166
165
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
167
166
  $<INSTALL_INTERFACE:httpp/sdk/include>
168
167
  )
169
- # SYSTEM: these are vendored/third-party headers we don't control (cpp-httplib,
170
- # indicators, etc.). Marking them SYSTEM tells the compiler their own internal
168
+ # SYSTEM: these are vendored/third-party headers we don't control (indicators, etc.). Marking them SYSTEM tells the compiler their own internal
171
169
  # warnings (e.g. indicators.hpp's narrowing-conversion C4244/C4267 on MSVC)
172
170
  # aren't ours to fix and shouldn't surface under our own -Wall/-Wextra/-W4
173
171
  # below - without patching vendored code to silence its own warnings.
174
172
  target_include_directories(httpp_core PRIVATE ${HTTPP_GENERATED_DIR})
175
173
  target_include_directories(httpp_core SYSTEM PRIVATE
176
- ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party/cpp-httplib
177
- ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party/aixlog
178
174
  ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party
179
175
  )
180
176
 
@@ -182,16 +178,14 @@ find_package(Threads REQUIRED)
182
178
  target_link_libraries(httpp_core PUBLIC Threads::Threads)
183
179
  target_link_libraries(httpp_core PRIVATE url::base httpp_llhttp)
184
180
 
185
- # HTTPS support: mbedtls is linked PRIVATE and CPPHTTPLIB_MBEDTLS_SUPPORT is
186
- # only ever defined in src/core/internal/httplib_common.hpp (never in a
187
- # public header), so consumers of httpp never need mbedtls on their own
188
- # include/link path - see that file for the shared httplib.h include.
181
+ # HTTPS support: mbedtls is linked PRIVATE and only src/core/tls_session.cpp
182
+ # includes its headers, so consumers of httpp never need mbedtls on their own
183
+ # include/link path.
189
184
  target_link_libraries(httpp_core PRIVATE mbedtls mbedx509)
190
- target_compile_definitions(httpp_core PRIVATE CPPHTTPLIB_MBEDTLS_SUPPORT)
191
185
  # Asio (standalone, header-only, vendored) runs the async engines: the server's
192
186
  # connection loop and the non-blocking client (epoll on Linux, kqueue on macOS,
193
187
  # IOCP on Windows). It is only ever included from src/core/async_server.cpp and
194
- # src/core/async_http.cpp, never together with httplib.h.
188
+ # src/core/async_http.cpp.
195
189
  # Where Asio comes from, in order:
196
190
  # 1. -DHTTPP_ASIO_INCLUDE_DIR=<directory containing asio.hpp> (offline builds, packagers)
197
191
  # 2. src/third_party/asio, if it holds a copy: a git submodule (<dir>/asio/include)
@@ -231,13 +225,18 @@ if(WIN32)
231
225
  target_compile_definitions(httpp_core PRIVATE _WIN32_WINNT=0x0A00)
232
226
  target_link_libraries(httpp_core PRIVATE ws2_32 mswsock crypt32)
233
227
  endif()
228
+ # The operating system log handlers (src/core/logging_os.cpp, ADR-0056): the Event Log lives in advapi32, logcat in liblog.
229
+ if(WIN32)
230
+ target_link_libraries(httpp_core PRIVATE advapi32)
231
+ elseif(ANDROID)
232
+ target_link_libraries(httpp_core PRIVATE log)
233
+ endif()
234
234
  if(MSVC)
235
235
  # Asio's templates produce very large object files.
236
236
  set_source_files_properties(${PROJECT_SOURCE_DIR}/src/core/async_http.cpp ${PROJECT_SOURCE_DIR}/src/core/async_server.cpp PROPERTIES COMPILE_OPTIONS "/bigobj")
237
237
  endif()
238
238
 
239
- # macOS: cpp-httplib (src/third_party/cpp-httplib/httplib.h) reads the
240
- # system trust store via the Keychain APIs (CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN),
239
+ # macOS: src/core/tls_session.cpp reads the system trust store via the Keychain APIs,
241
240
  # which pulls in CoreFoundation/Security symbols (e.g. SecTrustSettingsCopyCertificates).
242
241
  # These aren't linked by default and must be added explicitly, or the final
243
242
  # link of libhttpp_core.dylib fails with "symbol(s) not found for architecture".
@@ -268,6 +267,7 @@ if(HTTPP_BUILD_CLI)
268
267
  )
269
268
  target_link_libraries(httpp_cli PRIVATE httpp_core)
270
269
  target_include_directories(httpp_cli SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/third_party/CLI11)
270
+ target_include_directories(httpp_cli PRIVATE ${PROJECT_SOURCE_DIR}/src/core)
271
271
  target_compile_definitions(httpp_cli PRIVATE CLI11_HAS_FILESYSTEM=0)
272
272
  if(WIN32)
273
273
  target_compile_definitions(httpp_cli PRIVATE _WIN32_WINNT=0x0A00 NOMINMAX WIN32_LEAN_AND_MEAN)
@@ -1,5 +1,30 @@
1
1
  # httpp hand-off (consolidated, 2026-11-05; updates 2026-11-06 and 2026-11-07 below)
2
2
 
3
+ > **Update 2026-11-11 (newest): `httpp::fs` was merged into `httpp::path` (ADR-0058): no `fs.hpp`/`fs.cpp`, the CLI and the tests link `httpp_core`. Next free ADR number: 0059.
4
+ >
5
+ > **Update 2026-11-11 (latest): the logging module is public (`include/httpp/logging.hpp`, ADR-0057, amends 0050); `logging.cpp` is no longer compiled into the test program. Next free ADR number: 0058.
6
+ >
7
+ > **Update 2026-11-11 (later): `set_log_system` (ADR-0056) sends the log to the OS log (ported from libstb: `src/core/logging_os.cpp`); only syslog was run (Linux), the Android, Apple and Windows handlers were not compiled. Next free ADR number: 0057.
8
+ >
9
+ > **Update 2026-11-11: `httpp::path` (ADR-0055, public header `httpp/path.hpp`) is the pathlib-shaped path type of the public API; Python takes `pathlib.Path` everywhere (`_fs()` in `cy/client.pxi`). Next free ADR number: 0056 (see the newer update).
10
+ >
11
+ > **Update 2026-11-10 (later): the owner said "no filesystem, write our own": `httpp::fs` (`src/core/internal/fs.{hpp,cpp}`, ADR-0054) replaces std::filesystem and five private copies of file operations (download, file_browser, server, CLI, logging); `fs.cpp` is also compiled into the CLI and the test program. The Windows half was written without Windows and the macOS build was not run: both are for CI. Next free ADR number: 0056 (see the newer update).
12
+ >
13
+ > **Update 2026-11-10 (earlier): macOS CI fix.** The previous CI run failed on macOS (`std::filesystem::path` in `internal/logging.hpp`, unavailable below 10.15): `file_handler` takes a UTF-8 string now. Guard test `tests/python/test_portability_sources.py`. Python log bridge: `Py_IsInitialized()` check in the trampoline and an atexit unhook (from libstb's bridge fix). libstb diff since the port: core logging files unchanged since 2026-11-05; NOT ported (waiting for the owner): the OS handlers (`logging_os`: syslog, logcat, os_log, OutputDebugString, Event Log). Linux: C++ 480/480, Python 851 passed, 1 skipped. macOS/Windows not run here.
14
+ >
15
+ > **Update 2026-11-09 (night, not committed): cpp-httplib is RETIRED (ADR-0051, 0052, 0053).** Blocking client on the async engine through `src/core/internal/http_exchange.{hpp,cpp}`; downloads stream through `body_sink` on `download_async_http()` (`download.cpp`: one `file_target` + one `transfer()`); `curl.cpp` wraps `client::request`; `src/third_party/cpp-httplib` and `httplib_common.hpp` are deleted. New tests: `test_client_blocking_engine.cpp` (8), `test_async_stream.cpp` (6), `test_download_transfer.cpp` (8). Last runs (Linux, Python 3.13, wheel built from the final tree): C++ 479/479, Python 850 passed, 1 skipped (free-threaded only). NOT verified: Windows, macOS (the Keychain link flags are kept), Python 3.14t, comparison with live sites. Known ponytail: file writes block the download loop thread (upgrade: a small bounded write pool). Next free ADR number: 0055 (see the newer update).
16
+
17
+ > **Update 2026-11-09 (not committed).** Done since the evening block, tests first, ADR each: (5) MIME table unified and the 18 KB `async_http` exchange leak fixed (ADR-0047); (6) `router::route_ws` / `APIRouter.websocket` and `Depends` on WebSocket routes (ADR-0048; 2 C++ tests, 15 Python tests). The checklist item "total deadline for a dripped body" was stale: `set_body_timeout` exists. Last runs: C++ 457/457, Python 847+ passed, 4 skipped, parity test green. The Cython module was split into `cy/*.pxi` files (pure move, no behaviour change; ADR-0049). Logging: AixLog removed, replaced by the internal module ported from libstb (ADR-0050; C++ 457/457). Next free ADR number: 0051. Deliberately NOT done, next candidates: TLS certificate reload without restart, bounded recursive search in the file browser, Windows Job Object, ASan on the Python extension. Not verified: Windows, macOS, Python 3.14t.
18
+
19
+ > **Update 2026-11-08, evening (not committed).** The owner released the version and CI is green on the real runners, so the "CI fixes NOT yet confirmed" note below is out of date. Done in this step, all with tests first and an ADR each: (1) WebSocket close 1001 when the server drains (ADR-0043; `tunnel::on_drain`, 2 session tests, 3 server tests, 2 Python tests); (2) `--workers` respawn with back-off, crash-loop give-up and PR_SET_PDEATHSIG (ADR-0044; `_WorkerGroup` in `_run.py`; the old "a dead worker stops the group" test became a crash-loop test); (3) ETag, Last-Modified, 304, 412, If-Range for mounted files (ADR-0045; 9 C++ tests, 1 Python test; the engine no longer writes `Content-Length` on a 304); (4) `TestClient.files=` and `websocket_connect` (ADR-0046; 11 tests). Next free ADR number: 0047. Not verified: Windows, macOS, Python 3.14t for this step. Still open from the list below: (a) Windows Job Object, (b) one asyncio loop under the GIL, (c) the unnamed macOS failure, (e) Python 3.15t, in-memory TestClient.
20
+
21
+
22
+ > **START HERE (2026-11-08, for the next chat).** Working tree is uncommitted and nothing was ever pushed (owner rule: never push; after each step zip the project as httpp.zip and send it). Details of every item are in the update notes (1)-(11) right below.
23
+ > **State.** CLI is native (`httpp/sdk/bin/httpp`, CLI11) plus the Python launcher `httpp_cli.py`; `python -m httpp ARGS` is the same program as `httpp ARGS`; the Python half is `httpp py run|path` (old spellings exit 2 with a hint). Wheel layout is `httpp/sdk/{bin,include,lib}`. `httpp.testclient.TestClient` exists (ADR-0042). Next free ADR is 0043. Linux sandbox: full Python suite green on 3.13 and 3.14t.
24
+ > **CI fixes written from logs but NOT yet confirmed green on the real runners:** macOS delocate (`@loader_path` for the CLI RPATH), Windows (DLL in `sdk/bin`, `normcase`, `stop_process` with taskkill, NO_COLOR fixture), musllinux (no-Python test runs the exe in place), macOS `test_io_threads` (kernel-dependent spread; now asserts only the lane-name bound everywhere and the spread on Linux). Last CI seen: Release PR #169 (macOS), only the race of note (12) failed. Next step is to read the next CI log.
25
+ > **Owner rules for work in this repo.** Reply in Persian, concisely; code, commands and comments in English only; give honest technical opinions and say plainly when a fix is a workaround; no environment hacks inside tests when the project config (CMake/CI) is the right place; `test_version` was deleted on purpose (do not bring it back).
26
+ > **Open, not started.** (a) Windows launcher: a Job Object so that killing the launcher kills the native server (then the taskkill workaround in `conftest.py` can go); known limitation today: externally terminating the Python launcher on Windows leaves the native server running. (b) Why with the GIL only one asyncio loop remains although `io_threads=4`: read `server.py` around lines 1020-1040 (a comment there says free-threaded builds give every I/O thread its own loop). (c) The first macOS log had a `1 failed` whose test name was never seen. (d) TestClient extras: `websocket_connect`, multipart `files=`, in-memory mode without a socket. (e) Python 3.15t was not run locally.
27
+
3
28
  > **Update 2026-11-07, later (not committed).** CI on macOS failed 71 CLI tests: the CMake test target runs the suite on a staged install directory where pip never made the `httpp` console script. Fixes, all in the working tree:
4
29
  > (1) `tests/python/conftest.py`: `httpp_exe` looks up the console script only for its `command` variant, which is skipped when there is none; the `binary` variant (`httpp/bin/httpp`) always runs.
5
30
  > (2) Owner decision: **`python -m httpp ARGS` is the same program as `httpp ARGS`** (`__main__.main` calls `httpp_cli.main`; the Python half is `__main__.py_main`). So `python -m httpp py run main:app`, `python -m httpp server ...`; the old `python -m httpp run` fails with exit 2 like `httpp run`.
@@ -14,6 +39,7 @@
14
39
  > (9) CI of PR #165, wheel job on Linux (musllinux container, 1 failed of 533): `test_without_a_python_the_error_says_what_to_do` copied the executable to a temp folder and set `LD_LIBRARY_PATH` to `sdk/lib`; after `auditwheel repair` the executable needs libstdc++ and libgcc from `httpp.libs` through its RPATH, which the copy lost (exit 127, "Error loading shared library libstdc++-..."). The test now runs the executable in place (no Python lives next to `sdk/bin` anyway) with an empty PATH and no HTTPP_PYTHON, so it no longer copies anything or imitates the library search path. Linux here: 803 passed, 4 skipped (`test_version`, 2 cases, is gone).
15
40
  > (10) CI of PR #166, wheel job on Windows (cp314t-win32, 2 failed of 531, cp39 jobs all green): `test_py_help_is_the_python_help[command|binary]` got ANSI colour codes in the help text, because Python 3.14 argparse colours when `FORCE_COLOR` is set (CI sets it) and the 3.9 jobs have no colour. An autouse fixture in `conftest.py` (monkeypatch, so scoped to each test) removes `FORCE_COLOR` and sets `NO_COLOR=1`, `PYTHON_COLORS=0`. Also at the owner's request: `PYTHONPATH` no longer set in `conftest.py`; `tests/python/CMakeLists.txt` sets it (ctest `ENVIRONMENT` and `cmake -E env` for the custom target). Checked on a staged copy with PYTHONPATH given from outside.
16
41
  (11) CI of PR #167, wheel job on macOS (1 failed of 531): `test_loops_follow_the_io_threads_only_without_a_gil` expected exactly one loop name on a free-threaded macOS build ("macOS does not spread connections"), but the kernel did spread them (`httpp-asyncio` and `httpp-asyncio-1`). That is kernel behaviour, not ours: free-threaded builds now assert the spread only on Linux and nothing about the count elsewhere; GIL builds still expect exactly one loop. Not reproducible on Linux; the cause is read from the log.
42
+ (12) CI of Release PR #169, wheel job on macOS (cp314t x86_64 under Rosetta, 1 failed of 531): `test_cli_run_wins_over_a_listen_call_at_import_time[1]` got return code -2 (killed by SIGINT) after SIGTERM. Real race in `Server.listen`: the serving thread was started before the `try`, so a SIGTERM/Ctrl+C landing in that gap raised KeyboardInterrupt out of `listen` (an uncaught KeyboardInterrupt ends the process with SIGINT). Now `thread.start()` is inside the `try`, and an interrupt before the thread existed stops nothing. Not reproducible by timing on Linux (12 runs green); reproduced deterministically by sending SIGINT from a patched `Thread.start` and covered by `test_an_interrupt_right_after_the_server_thread_started_is_a_graceful_stop` (failed before the fix, passes now). The macOS cause is inferred from that, not seen directly. Remaining tiny window: a second signal arriving exactly at the `while not finished` check inside the graceful loop.
17
43
  Still open: one `1 failed` line of the macOS CI log was cut off (test name unknown, did not reproduce on Linux); nothing else known.
18
44
 
19
45
  > **Update 2026-11-07 (not committed, all in the working tree).** The command line moved to C++ (ADR-0041, **the next free ADR is 0042**), written first and only then built and tested at the owner's request.
@@ -51,7 +77,7 @@ This is a long collaboration, not a one-off task. Mohammad is an experienced sys
51
77
  A C++ HTTP library (async server on Asio + llhttp, clients, downloads, progress bars, URL, WebSocket, read-only file browser) with a Cython/Python layer. Direction (ADR-0001): httpp replaces FastAPI/Starlette above and uvicorn below: a Starlette/FastAPI-like API implemented natively on our own engine, launched by `httpp run main:app` or `app.run()`. Handlers run on a standard asyncio loop (ADR-0002); no ASGI adapter is needed (low priority). One design for the C++ and the Python API; only GIL related differences.
52
78
 
53
79
  ## 2. Standing rules
54
- - `cpp-httplib` (`src/third_party/cpp-httplib/httplib.h`, v0.54.1) stays byte-identical to upstream; llhttp is unmodified and stays vendored (owner decision, 2026-11-05: no SIMD patch, no own parser, no copy of Drogon's parser; do not bring it up unless a profile shows the parser is the hot path and he asks). Document any vendor change in `src/third_party/README.md`. Asio, mbedtls, liburlparser are submodules.
80
+ - cpp-httplib is gone (ADR-0053); llhttp is unmodified and stays vendored (owner decision, 2026-11-05: no SIMD patch, no own parser, no copy of Drogon's parser; do not bring it up unless a profile shows the parser is the hot path and he asks). Document any vendor change in `src/third_party/README.md`. Asio, mbedtls, liburlparser are submodules.
55
81
  - Zero system dependencies (nothing from apt/brew; vendor or submodule; pip build deps are fine).
56
82
  - macOS wheels target 10.13: avoid `std::filesystem`, floating `to_chars`, `std::optional` accessors and other post-10.13 libc++ APIs in `src/core`.
57
83
  - Be honest about "async" and the GIL: say what is truly non-blocking and what is a thread pool.
@@ -62,9 +88,9 @@ A C++ HTTP library (async server on Asio + llhttp, clients, downloads, progress
62
88
  include/httpp/ public API (client, server, websocket, download, url, progress, router, file_browser, swagger_ui ...)
63
89
  src/core/ async_server.cpp (Asio engine + llhttp; tunnel for upgrades), server.cpp (router, hooks, static files, run_ws),
64
90
  websocket.cpp + internal/websocket.hpp, websocket_api.cpp, async_http.cpp (async client), client.cpp / download.cpp /
65
- curl.cpp (httplib, sync), file_browser.cpp, inflate/deflate/content_decode (vendored stb codecs), log.cpp, tls_session.cpp
91
+ curl.cpp (thin face on client::request), file_browser.cpp, inflate/deflate/content_decode (vendored stb codecs), log.cpp, tls_session.cpp
66
92
  src/assets/ file_browser.html (embedded with COMPRESS)
67
- src/bindings/python/ httpp_cy.pyx (Cython glue), httpp/server.py, _params.py, _websocket.py, _run.py, _validate*.py, _router.py, __main__.py ...
93
+ src/bindings/python/ httpp_cy.pyx (Cython glue: cimports plus textual includes of cy/*.pxi, one module, one .so), httpp/server.py, _params.py, _websocket.py, _run.py, _validate*.py, _router.py, __main__.py ...
68
94
  tests/cpp tests/python benchmarks/ tools/autobahn/ docs/adr/ docs/Architecture.md checklist.md
69
95
  ```
70
96
  Request paths:
@@ -72,7 +98,7 @@ Request paths:
72
98
  - **`async def` route**: I/O thread -> `route_io` -> per-lane inbox (mutex + deque, wake byte; no GIL on the I/O thread) -> asyncio loop thread of that lane drains a burst with the GIL held once -> task -> `done()`. A handler that cannot suspend may run inline on the I/O thread when its loop sleeps (ADR-0023); default on only with 2 CPUs or fewer.
73
99
  - **Lanes (ADR-0024)**: `set_io_threads(n)` = one engine per I/O thread on one port (SO_REUSEPORT). Python: one asyncio loop per I/O thread only on a free-threaded build, else one loop. Default `io_threads` = `min(4, CPUs // 4)` with a GIL, 1 without a GIL or on Windows. With several I/O threads a new connection goes to the engine with the fewest connections (ADR-0034).
74
100
  - `after_request`/`error_handler` hooks make `done` go through `run_in_executor`. The hook path of `make_sender` no longer touches `this` after `weak.lock()` (ADR-0035).
75
- - **WebSocket (ADR-0026, 0027)**: generic engine tunnel; `ws_session` implements RFC 6455 (frames, fragments, control frames, close handshake, UTF-8 and close-code checks, bounded send queue, ping). Python `@app.websocket(path, ...)` with a Starlette-shaped `websocket` object, per-connection C++ mailbox. Same-origin default policy. Not supported on WebSocket routes: dependencies, `response`, background tasks, OpenAPI, `APIRouter.websocket`. No permessage-deflate, no TLS of its own.
101
+ - **WebSocket (ADR-0026, 0027)**: generic engine tunnel; `ws_session` implements RFC 6455 (frames, fragments, control frames, close handshake, UTF-8 and close-code checks, bounded send queue, ping). Python `@app.websocket(path, ...)` with a Starlette-shaped `websocket` object, per-connection C++ mailbox. Same-origin default policy. Routers and `Depends` work on WebSocket routes (ADR-0048). Not supported: `response`, background tasks, OpenAPI. No permessage-deflate, no TLS of its own.
76
102
  - **File browser (ADR-0032)**: `httpp::mount_file_browser(server&, base, root, file_browser_options)`; Python `Server.mount_file_browser(base, root, **options)`; CLI `httpp browse [DIRECTORY]`. Read-only; the root is a ceiling (`..`, absolute paths, backslash, NUL, symlinks out are refused with the same 404); dotfiles hidden unless `show_hidden`; active types always downloads; no login (use the `before` hook); `search` filters the open folder; no ETag in v1.
77
103
  - **Server compression**: `set_compression(min_size, level)` / `Server(compression=...)`: text answers only, off by default; no ADR yet and no benchmark.
78
104
 
@@ -88,7 +114,7 @@ Request paths:
88
114
  - `perf` on his machine: his `perf report --symbol-filter=...` did NOT filter (all outputs were identical); use `--sort dso,symbol` plus `grep`, or `-S` with the mangled name.
89
115
 
90
116
  ## 5. State after the last session (2026-11-05)
91
- Nothing is committed or pushed (the owner commits). Version in the tree is 0.8.0; `CHANGELOG.md` has the pending items under `[Unreleased]` (next version 0.8.1).
117
+ Nothing is committed or pushed (the owner commits). Version in the tree is 0.8.1 (bumped 2026-11-11; the owner commits and tags it); `CHANGELOG.md` has the 0.8.1 section, `[Unreleased]` is empty.
92
118
 
93
119
  ### Verified
94
120
  - C++ suite 407 tests pass in Release, and are clean under AddressSanitizer (no memory errors) and ThreadSanitizer (no warnings).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: httpp
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Summary: A Cython project with scikit-build
5
5
  Author-Email: Mohammad Raziei <mohammadraziei1375@gmail.com>
6
6
  License: MIT
@@ -224,6 +224,7 @@ app.include(api, "/v1") # GET /v1/api/users/{user_id} (include_router is
224
224
  The order is: outer prefix, the router's own prefix, then the route's path. A route path `/` under a prefix is the
225
225
  prefix itself (`/users`, never `/users/`). Prefixes are joined once, when `include()` runs, so a request costs the same as
226
226
  with plain `@app.get(...)`. A router is not kept by the server: routes added to it afterwards are not on the server.
227
+ WebSocket routes work the same way (`@users.websocket("/ws/{room}")`, C++: `router::route_ws`), and a WebSocket handler may use `Depends` (for example to check a token before the upgrade).
227
228
 
228
229
  ### The `response` argument and background work
229
230
 
@@ -456,9 +457,10 @@ httpp py run main:app --reload # development: restart when a .py
456
457
  each have their own GIL and share one port (`SO_REUSEPORT`; the kernel spreads connections). Each
457
458
  worker is a fresh process that imports the app itself, which is why `workers > 1` needs an import
458
459
  string (`"main:app"`), like uvicorn and gunicorn; module-level state is therefore per worker.
459
- Linux only for now. If a worker dies, the supervisor stops the others and exits with code 1 (let
460
- systemd or Docker restart it); it does not respawn workers yet. Keep the supervisor alive: killing it
461
- with SIGKILL leaves its workers running.
460
+ Linux only for now. If a worker dies, the supervisor starts a new one (at once the first time, then
461
+ after 0.5, 1, 2 and 4 seconds while it keeps dying right after it starts); a worker that keeps dying
462
+ that way stops the whole group with exit code 1, so a broken app or a busy port is not hidden. If the
463
+ supervisor itself is killed, even with SIGKILL, the kernel sends SIGTERM to its workers.
462
464
  - `workers="auto"` / `--workers auto` starts one worker per CPU the process can use: its affinity mask,
463
465
  capped by a container CPU quota (rounded down, at least 1). It runs a single process on one CPU, off
464
466
  Linux, and when `app` is an object rather than an import string (it says so).
@@ -535,7 +537,7 @@ def test_items():
535
537
  It follows Starlette's interface: `get`, `post`, `put`, `patch`, `delete`, `head`, `options`, `request`; `params`, `headers`, `json`, `data` (a dict is a form), `content`, `cookies`, `auth=("user", "pw")`,
536
538
  `follow_redirects` (on by default), `base_url` (default `http://testserver`, the `Host` the app sees). Cookies the server sets are kept and sent back (`client.cookies`).
537
539
  A handler that raises with no exception handler for it is raised again in your test (`raise_server_exceptions=False` gives you the 500 instead). Without `with`, the first request starts the server and `client.close()` stops it.
538
- Not yet: `websocket_connect`, multipart `files=`, and a mode without a socket (ADR-0042).
540
+ `files=` sends multipart, and `client.websocket_connect("/ws")` gives a session with `send_text`, `receive_text`, `send_json` and friends (ADR-0046). Not there: a mode without a socket (ADR-0042).
539
541
 
540
542
  ### TLS (https, wss)
541
543
 
@@ -570,7 +572,7 @@ Not supported: ASGI middleware. `HTTPSRedirectMiddleware` sends plain requests t
570
572
 
571
573
  ## Build from source
572
574
 
573
- Most dependencies are vendored (`cpp-httplib`, unmodified; `llhttp`, unmodified) or git submodules
575
+ Most dependencies are vendored (`llhttp`, unmodified) or git submodules
574
576
  (`mbedtls`, `liburlparser`, `asio`). The full history of the `mbedtls` submodule is large; if you only need the source, clone
575
577
  with `git clone --depth 1 --recurse-submodules --shallow-submodules`.
576
578
 
@@ -594,22 +596,22 @@ httpp is **alpha**: the API can still change between minor versions. Current lim
594
596
  be cancelled by `handler_timeout`. Handler code is Python, so it still needs the GIL: `async def`
595
597
  handlers share one loop thread, plain `def` handlers take the GIL on pool threads (set `threads=` to
596
598
  fit your blocking calls), and real parallelism needs `--workers` or a free-threaded Python (below).
597
- - HTTP/1.1 only; the server does not speak TLS; a cancelled `await` stops waiting but the request itself
599
+ - HTTP/1.1 only (the server speaks TLS, see the TLS section); a cancelled `await` stops waiting but the request itself
598
600
  keeps running until it finishes.
599
601
  - Platforms: the connection layer is tested on Linux. Windows and macOS are untested by the author; CI
600
602
  on those platforms is the real check.
601
603
  - There is no ASGI or WSGI interface (see above), so ASGI/WSGI applications such as FastAPI or Flask
602
604
  cannot be mounted on it yet.
603
- - `cpp-httplib` (unmodified) now serves only the synchronous client; the server and the async engine are
604
- our own (Asio + llhttp). It is planned to retire it once the synchronous client is ours too.
605
+ - cpp-httplib is no longer used: the server, the client (blocking and async) and downloads all run on our own
606
+ engines (Asio + llhttp + mbedTLS), see ADR-0051 to ADR-0053.
605
607
  - The libcurl compatibility layer covers a subset of `curl_easy_*`.
606
- - No auto-reload. `--workers` is Linux only and does not respawn dead workers.
608
+ - `--workers` is Linux only.
607
609
 
608
610
  Issues and pull requests are welcome.
609
611
 
610
612
  ## Logging
611
613
 
612
- The library logs through AixLog, privately (it never touches `std::clog` or your own logging). By default
614
+ The library logs through a private logger of its own (it never touches `std::clog` or your own logging). By default
613
615
  warnings and errors go to stderr, e.g. a handler that throws with no exception handler installed.
614
616
 
615
617
  ```cpp
@@ -197,6 +197,7 @@ app.include(api, "/v1") # GET /v1/api/users/{user_id} (include_router is
197
197
  The order is: outer prefix, the router's own prefix, then the route's path. A route path `/` under a prefix is the
198
198
  prefix itself (`/users`, never `/users/`). Prefixes are joined once, when `include()` runs, so a request costs the same as
199
199
  with plain `@app.get(...)`. A router is not kept by the server: routes added to it afterwards are not on the server.
200
+ WebSocket routes work the same way (`@users.websocket("/ws/{room}")`, C++: `router::route_ws`), and a WebSocket handler may use `Depends` (for example to check a token before the upgrade).
200
201
 
201
202
  ### The `response` argument and background work
202
203
 
@@ -429,9 +430,10 @@ httpp py run main:app --reload # development: restart when a .py
429
430
  each have their own GIL and share one port (`SO_REUSEPORT`; the kernel spreads connections). Each
430
431
  worker is a fresh process that imports the app itself, which is why `workers > 1` needs an import
431
432
  string (`"main:app"`), like uvicorn and gunicorn; module-level state is therefore per worker.
432
- Linux only for now. If a worker dies, the supervisor stops the others and exits with code 1 (let
433
- systemd or Docker restart it); it does not respawn workers yet. Keep the supervisor alive: killing it
434
- with SIGKILL leaves its workers running.
433
+ Linux only for now. If a worker dies, the supervisor starts a new one (at once the first time, then
434
+ after 0.5, 1, 2 and 4 seconds while it keeps dying right after it starts); a worker that keeps dying
435
+ that way stops the whole group with exit code 1, so a broken app or a busy port is not hidden. If the
436
+ supervisor itself is killed, even with SIGKILL, the kernel sends SIGTERM to its workers.
435
437
  - `workers="auto"` / `--workers auto` starts one worker per CPU the process can use: its affinity mask,
436
438
  capped by a container CPU quota (rounded down, at least 1). It runs a single process on one CPU, off
437
439
  Linux, and when `app` is an object rather than an import string (it says so).
@@ -508,7 +510,7 @@ def test_items():
508
510
  It follows Starlette's interface: `get`, `post`, `put`, `patch`, `delete`, `head`, `options`, `request`; `params`, `headers`, `json`, `data` (a dict is a form), `content`, `cookies`, `auth=("user", "pw")`,
509
511
  `follow_redirects` (on by default), `base_url` (default `http://testserver`, the `Host` the app sees). Cookies the server sets are kept and sent back (`client.cookies`).
510
512
  A handler that raises with no exception handler for it is raised again in your test (`raise_server_exceptions=False` gives you the 500 instead). Without `with`, the first request starts the server and `client.close()` stops it.
511
- Not yet: `websocket_connect`, multipart `files=`, and a mode without a socket (ADR-0042).
513
+ `files=` sends multipart, and `client.websocket_connect("/ws")` gives a session with `send_text`, `receive_text`, `send_json` and friends (ADR-0046). Not there: a mode without a socket (ADR-0042).
512
514
 
513
515
  ### TLS (https, wss)
514
516
 
@@ -543,7 +545,7 @@ Not supported: ASGI middleware. `HTTPSRedirectMiddleware` sends plain requests t
543
545
 
544
546
  ## Build from source
545
547
 
546
- Most dependencies are vendored (`cpp-httplib`, unmodified; `llhttp`, unmodified) or git submodules
548
+ Most dependencies are vendored (`llhttp`, unmodified) or git submodules
547
549
  (`mbedtls`, `liburlparser`, `asio`). The full history of the `mbedtls` submodule is large; if you only need the source, clone
548
550
  with `git clone --depth 1 --recurse-submodules --shallow-submodules`.
549
551
 
@@ -567,22 +569,22 @@ httpp is **alpha**: the API can still change between minor versions. Current lim
567
569
  be cancelled by `handler_timeout`. Handler code is Python, so it still needs the GIL: `async def`
568
570
  handlers share one loop thread, plain `def` handlers take the GIL on pool threads (set `threads=` to
569
571
  fit your blocking calls), and real parallelism needs `--workers` or a free-threaded Python (below).
570
- - HTTP/1.1 only; the server does not speak TLS; a cancelled `await` stops waiting but the request itself
572
+ - HTTP/1.1 only (the server speaks TLS, see the TLS section); a cancelled `await` stops waiting but the request itself
571
573
  keeps running until it finishes.
572
574
  - Platforms: the connection layer is tested on Linux. Windows and macOS are untested by the author; CI
573
575
  on those platforms is the real check.
574
576
  - There is no ASGI or WSGI interface (see above), so ASGI/WSGI applications such as FastAPI or Flask
575
577
  cannot be mounted on it yet.
576
- - `cpp-httplib` (unmodified) now serves only the synchronous client; the server and the async engine are
577
- our own (Asio + llhttp). It is planned to retire it once the synchronous client is ours too.
578
+ - cpp-httplib is no longer used: the server, the client (blocking and async) and downloads all run on our own
579
+ engines (Asio + llhttp + mbedTLS), see ADR-0051 to ADR-0053.
578
580
  - The libcurl compatibility layer covers a subset of `curl_easy_*`.
579
- - No auto-reload. `--workers` is Linux only and does not respawn dead workers.
581
+ - `--workers` is Linux only.
580
582
 
581
583
  Issues and pull requests are welcome.
582
584
 
583
585
  ## Logging
584
586
 
585
- The library logs through AixLog, privately (it never touches `std::clog` or your own logging). By default
587
+ The library logs through a private logger of its own (it never touches `std::clog` or your own logging). By default
586
588
  warnings and errors go to stderr, e.g. a handler that throws with no exception handler installed.
587
589
 
588
590
  ```cpp
@@ -11,7 +11,9 @@
11
11
 
12
12
  - [x] Own async server engine (Asio + llhttp): keep-alive, pipelining, chunked, limits (413/414/431); connections balanced over I/O threads ([ADR-0034](docs/adr/0034-balanced-connections-between-io-threads.md))
13
13
  - [x] Server on top of it: router, static files with HEAD/Range, hooks, `route_async` with a 504 backstop, `route_io`/`route_shared`
14
- - [x] Async client engine (TLS with mbedTLS, keep-alive pool, proxy, redirects, cookies/auth); sync client and downloads on cpp-httplib
14
+ - [x] Retire cpp-httplib, step 1: blocking client on the async engine and the shared policy layer (ADR-0051)
15
+ - [x] Retire cpp-httplib, step 2: downloads on a streaming body sink (ADR-0052); step 3: the vendored copy is deleted (ADR-0053)
16
+ - [x] Async client engine (TLS with mbedTLS, keep-alive pool, proxy, redirects, cookies/auth); the blocking client and downloads run on it too
15
17
  - [x] FastAPI-like layer: `Query/Path/Header/Cookie/Body/Depends`, forms and uploads, OpenAPI 3.1 + compiled-in Swagger UI, response classes, `HTTPException`, `BackgroundTasks`, `APIRouter`, startup/shutdown hooks ([ADR-0007](docs/adr/0007-openapi-from-one-plan.md), [0008](docs/adr/0008-swagger-ui-compiled-in.md), [0020](docs/adr/0020-httpexception-and-response-classes.md))
16
18
  - [x] Own Pydantic-v2-shaped models with Cython validators ([ADR-0006](docs/adr/0006-own-model-layer.md))
17
19
  - [x] `httpp run main:app`, `app.run()`, `--workers N` (Linux), `io_threads`, lanes, inline async, free-threaded builds ([ADR-0012](docs/adr/0012-run-wins-over-listen.md), [0023](docs/adr/0023-inline-async.md), [0024](docs/adr/0024-io-threads-and-lanes.md), [0025](docs/adr/0025-measured-defaults-and-the-crash.md))
@@ -43,20 +45,21 @@ Design: `docs/adr/0041-native-cli-and-py.md`. `httpp server|browse|download|curl
43
45
  ## 2. Features
44
46
 
45
47
  ### Server and framework
46
- - [x] A test client in Python (`httpp.testclient.TestClient`, ADR-0042), Starlette-shaped: a real server on a loopback port of its own. Open: `websocket_connect` (no WebSocket client yet), multipart `files=`, an in-memory mode
48
+ - [x] A test client in Python (`httpp.testclient.TestClient`, ADR-0042), Starlette-shaped: a real server on a loopback port of its own. `files=` and `websocket_connect` came with ADR-0046. Open: an in-memory mode
47
49
  - [x] Middleware set (ADR-0037, ADR-0040): CORS, TrustedHost, GZip and HTTPS redirect (C++ and Python)
48
50
  - [x] TLS for the server (`https`, `wss`) (ADR-0040); not yet: certificate reload without restart, session tickets, client certificates, ALPN
49
51
  - [x] `--reload` for development (ADR-0039)
50
- - [x] Graceful shutdown with connection drain and a timeout (ADR-0038)
51
- - [ ] **(proposed)** `--workers` respawn of crashed workers (today no respawn, and SIGKILL of the supervisor leaves workers)
52
+ - [x] Graceful shutdown with connection drain and a timeout (ADR-0038); open WebSockets get a close 1001 and are waited for (ADR-0043)
53
+ - [x] `--workers` respawn of crashed workers with a back-off, give-up after a crash loop, and workers that end with their supervisor (ADR-0044); open: a restart budget over a long time, jitter
52
54
  - [ ] Dependencies with `yield` (cleanup after the response) and `response_model` filtering: check what the FastAPI layer lacks against FastAPI's docs
53
- - [ ] Static files mounted from Python (`mount_static`-style) beyond `serve_directory`; ETag, `Last-Modified` and 304 (not in the file browser v1 either)
54
- - [ ] A total deadline for a dripped request body
55
+ - [x] ETag, `Last-Modified`, 304, 412 and `If-Range` for mounted files and the file browser raw route (ADR-0045)
56
+ - [ ] Static files mounted from Python (`mount_static`-style) beyond `serve_directory`
57
+ - [x] A total deadline for a dripped request body (`set_body_timeout`, already in place; this line was stale)
55
58
  - [ ] Swagger UI body is copied per request (changes a public type; ask the owner first)
56
59
  - [ ] The 504 deadline of an unanswered async request starts when the handler returns (document or change)
57
60
 
58
61
  ### WebSocket
59
- - [ ] `APIRouter.websocket`, dependencies on WebSocket routes, an OpenAPI note
62
+ - [x] `APIRouter.websocket` and `router::route_ws`, dependencies on WebSocket routes (ADR-0048); WebSocket routes stay out of OpenAPI by design
60
63
  - [ ] `on_close` earlier than the lingering close (considered, kept), permessage-deflate (not planned)
61
64
  - [ ] The WebSocket benchmark and idle-connection memory (`BENCH_ONLY=ws,idle`) were written (ADR-0030) but never run on the owner's machine; httpp is about 20 KiB per idle connection against Drogon about 9 KiB in the sandbox (unchecked): look for per-connection buffers
62
65
 
@@ -67,7 +70,7 @@ Design: `docs/adr/0041-native-cli-and-py.md`. `httpp server|browse|download|curl
67
70
 
68
71
  ### Clients and downloads
69
72
  - [ ] `Client(keep_alive=False)` Python binding decision; sync client against async client (two engines for one behaviour; separate decision)
70
- - [ ] MIME types: `serve_directory` (C++ table) and `file()` (Python `mimetypes`) disagree for `ico`, `gz`, `wav`, `yaml`, `yml`; fix needs one new public function
73
+ - [x] MIME types: one table for `serve_directory` and Python `file()` through the public `httpp::mime_type_for` (ADR-0047)
71
74
  - [ ] Real zlib instead of the vendored stb codecs (owner said drop it for now; recommendation if it returns: madler/zlib as a pinned submodule)
72
75
 
73
76
  ### Python layer
@@ -88,7 +91,7 @@ Design: `docs/adr/0041-native-cli-and-py.md`. `httpp server|browse|download|curl
88
91
  ## 4. Quality and release
89
92
  - [ ] Windows and macOS runtime: nothing of the server, the tunnel, the descriptor handover (ADR-0034) or the file browser has run there
90
93
  - [ ] ASan and TSan on the Python extension (only the C++ suite was run)
91
- - [ ] The ASan leak report at exit (about 18 KB in `async_http::impl` exchanges alive at exit); the open `worker_pool*` read in ADR-0035
94
+ - [x] The 18 KB exit leak of `async_http` exchanges (a reference cycle, fixed, ADR-0047); still open: the `worker_pool*` read in ADR-0035
92
95
  - [ ] Python 3.15t locally (CI only so far)
93
96
  - [ ] README gaps: when to use `def` against `async def`, `HTTPException`, response classes, `httpp.status`, 405; the GZip section
94
97
  - [ ] An ADR and a benchmark for server gzip (`set_compression`)
@@ -51,8 +51,6 @@ The main goal: **remove the layer boundaries**, not optimize them.
51
51
  | **Asio** (standalone) | event loop and async I/O for server and client | Boost Software License | submodule |
52
52
  | **mbedTLS** | TLS for the **client** (the server has no TLS yet 🎯) | Apache-2.0 (dual-licensed with GPL-2.0+) | submodule |
53
53
  | **liburlparser** | URLs | n/a | submodule |
54
- | **AixLog** | internal logging | MIT | vendored (one marked patch) |
55
- | **cpp-httplib** v0.54.1 | **only** the sync client, `curl.cpp`, `download.cpp`. The server does **not** run on it | MIT | vendored, untouched; to be retired |
56
54
  | libsharedmemory | **candidate** for shared state | MIT | ❌ not chosen or vendored yet (risk 2) |
57
55
 
58
56
  > The parser is the same one: `httptools` (which sits under uvicorn) is also built on llhttp. So the speed difference does not come from the parser.
@@ -73,7 +71,8 @@ graph TB
73
71
  SRV["server.cpp<br/>router, hooks, static files, worker pool"]
74
72
  ENG["async_server.cpp<br/>Asio + llhttp, keep-alive, pipelining"]
75
73
  ACLI["async_http.cpp<br/>async client: pool, proxy, TLS (mbedTLS)"]
76
- SCLI["client.cpp / download.cpp / curl.cpp<br/>sync client on cpp-httplib"]
74
+ SCLI["client.cpp + http_exchange.cpp<br/>sync and async client policy, one engine"]
75
+ DLD["download.cpp<br/>streams into a file on its own engine"]
77
76
  SHM["🎯 shared state"]
78
77
  end
79
78
 
@@ -85,6 +84,7 @@ graph TB
85
84
  BIND --> SRV
86
85
  BIND --> ACLI
87
86
  BIND --> SCLI
87
+ BIND --> DLD
88
88
  SRV --> ENG
89
89
  ENG --> SOCK
90
90
  ACLI --> SOCK
@@ -1,6 +1,6 @@
1
1
  # ADR-0003: Network engine = Asio + llhttp + Mbed TLS; cpp-httplib only for the sync client
2
2
 
3
- - **Status:** accepted
3
+ - **Status:** accepted; the cpp-httplib part was superseded by ADR-0051 to ADR-0053 (removed)
4
4
  - **Decided by:** the project owner
5
5
  - **Source:** `Architecture.md` sections 3 and 6, `src/third_party/README.md`
6
6
 
@@ -17,7 +17,7 @@ A parser, an event loop and TLS must be chosen, with no system dependencies and
17
17
  | TLS (client) | Mbed TLS | git submodule |
18
18
  | URL | liburlparser | git submodule |
19
19
  | Internal logging | AixLog v1.5.0 | one file, one marked patch |
20
- | **Sync** client, `curl.cpp`, `download.cpp` | cpp-httplib v0.54.1 | `httplib.h` **untouched** |
20
+ | **Sync** client (moved to our engine by ADR-0051), `curl.cpp`, `download.cpp` | cpp-httplib v0.54.1 | `httplib.h` **untouched** |
21
21
 
22
22
  The async server and client are not built on cpp-httplib. cpp-httplib is meant to be retired once the sync client is ours too.
23
23
  The only AixLog patch makes sure it does not swap `std::clog` for the whole process (a library must not do that).
@@ -1,6 +1,6 @@
1
1
  # ADR-0005: Multi-process with fresh processes and `SO_REUSEPORT` (Linux only)
2
2
 
3
- - **Status:** accepted
3
+ - **Status:** accepted; the "dead worker stops the group" rule is superseded by [ADR-0044](0044-worker-respawn.md)
4
4
  - **Decided by:** the project owner
5
5
  - **Source:** `Architecture.md` section 6, `handoff.md`, `src/bindings/python/httpp/_run.py`
6
6
 
@@ -37,7 +37,7 @@ in Python, which would drift.
37
37
  - A test needs a loopback socket; each request is a real HTTP round trip (about a millisecond).
38
38
  - The scheme of `base_url` only shows in `response.url`; `request.secure` is always false.
39
39
  - `Server._exception_sink` is a private hook that costs one attribute read on the failure path only.
40
- - Not done: `websocket_connect` (httpp has no WebSocket client), multipart `files=`, in-memory mode, `client=("testclient", 50000)`, cookie Domain/Path/Secure matching.
40
+ - Not done: in-memory mode (`websocket_connect` and multipart `files=` came with ADR-0046), `client=("testclient", 50000)`, cookie Domain/Path/Secure matching.
41
41
  - Verified on Linux x86_64 (2026-11-07): `tests/python/test_testclient.py`, 22 tests, and the whole Python suite on 3.13 (805 passed, 4 skipped) and 3.14t (804 passed, 5 skipped).
42
42
  Not verified: Windows, macOS, a sandbox without loopback, many clients at once on one app.
43
43
 
@@ -0,0 +1,45 @@
1
+ # ADR-0043: WebSocket connections get a close 1001 frame when the server drains
2
+
3
+ - **Status:** accepted
4
+ - **Source:** `tunnel::on_drain` in `src/core/internal/async_server.hpp`, `impl::begin_drain` in `src/core/async_server.cpp`, `ws_session::on_drain` in `src/core/websocket.cpp`,
5
+ `tests/cpp/test_websocket_session.cpp`, `tests/cpp/test_server_shutdown.cpp`, `tests/python/test_shutdown.py`
6
+
7
+ ## Context
8
+
9
+ ADR-0038 made `shutdown(grace)` close every tunnel (WebSocket) connection abruptly at the start of the drain, and listed a close frame 1001 ("going away") as the right
10
+ behaviour that needed a hook into the session layer: the tunnel interface only had `close()`. A peer that sees the TCP connection die without a close frame reports 1006
11
+ (abnormal closure) and cannot tell a deploy from a network fault, so a browser client may not reconnect with the right delay, and a handler never sees a clean close.
12
+
13
+ ## Decision
14
+
15
+ 1. `tunnel` gets a virtual `on_drain(tunnel_io&)`. The default calls `io.close()`, which is the old behaviour, so any other tunnel keeps working unchanged.
16
+ 2. `async_server::impl::begin_drain` calls `on_drain` on every tunnel connection instead of closing it. Connections that wait for the first byte of a request are
17
+ still closed at once. A request in progress is still left alone.
18
+ 3. `ws_session::on_drain` does what `websocket::close(1001)` does: it sends a close frame with code 1001 and an empty reason, stops accepting sends, and waits for the peer's
19
+ close frame (the existing 5 second close deadline applies). When the peer answers, the connection ends through the normal close path and the handler's `on_close` sees
20
+ the peer's code. If a close was already started, nothing changes.
21
+ 4. The grace period of the drain is the limit: the engine cuts whatever is still open when it ends, as it does for a request in progress. `listen()` therefore
22
+ returns when the last WebSocket has answered, or when the grace period is over.
23
+ 5. A WebSocket whose upgrade answer reaches the loop after the drain began (the 101 is produced on a worker thread and posted) was not a tunnel yet when `begin_drain` looked at
24
+ the connections. `tunnel_begin` therefore calls `on_drain` itself when the engine is already draining, right after `on_open`.
25
+ 6. No new public API: C++ `ws_handler` and the Python `websocket` object are unchanged (the Python handler's `receive()` raises `WebSocketDisconnect` with code 1001).
26
+
27
+ Note on how it ends: after the peer's close frame the engine half-closes the TCP connection and waits for the peer to close its end, for at most 2 seconds (the engine's linger time, the same
28
+ as for a refused request). A client that answers the close frame but never closes its socket therefore holds `listen()` for up to 2 seconds more. A browser closes its end at once.
29
+
30
+ ## Rejected alternatives
31
+
32
+ - A public `on_shutdown` callback on `ws_handler`, so an app can send its own goodbye first: it would add API to both languages for something the close frame already says;
33
+ a handler that wants to react can use `on_close` with code 1001.
34
+ - Closing with 1012 ("service restart"): 1012 is what a restart means to clients, but a drain also happens for a plain stop; 1001 is the neutral, widely understood code.
35
+ The owner can change the constant in one place.
36
+ - Waiting for the peer without a limit: one silent client would hold the shutdown for the whole grace period for nothing; the existing 5 second close deadline is kept.
37
+
38
+ ## Consequences
39
+
40
+ - A shutdown with many open WebSockets writes one small frame per connection and then waits for their answers; with `--shutdown-timeout` shorter than the close deadline the
41
+ grace period ends first and the rest are cut.
42
+ - `ponytail:` the close reason is empty. Upgrade path: a `ws_limits` field or a `server` option for the reason text.
43
+ - Verified: 2 new session tests with a fake tunnel_io, 3 new server tests (the 1001 frame and a clean end when the peer answers, a silent peer cut after the grace period,
44
+ the handler sees code 1001), 2 new Python tests.
45
+ - Not verified: Windows and macOS, a browser client, WebSocket over TLS (`wss`) during a drain, many connections at once.