Dependencies.cmake 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. include(FetchContent)
  2. set(HTTPLIB_REQUIRE_OPENSSL ON CACHE BOOL "" FORCE)
  3. set(HTTPLIB_USE_OPENSSL_IF_AVAILABLE ON CACHE BOOL "" FORCE)
  4. # Pinned, and the pin is a decision rather than a default.
  5. #
  6. # v0.46.0 -> v0.59.0 closes 17 releases. What made it worth doing, limited to
  7. # fixes that are actually REACHABLE through this service's surface - every
  8. # route here is a regex route, /fn/{project}/* is unauthenticated, and the web
  9. # UI is served from a static mount point:
  10. # v0.51.0 `chunked` matched only as the WHOLE Transfer-Encoding value, so a
  11. # final-coding spelling slipped past it - a request-smuggling shape,
  12. # and we sit behind nginx, which is where that class bites.
  13. # v0.51.0 an out-of-range Content-Length was cast straight to size_t and
  14. # silently truncated instead of being refused.
  15. # v0.57.0 control characters accepted in the chunk-size line.
  16. # v0.56.0 a Range first-byte-pos that overflows ssize_t now answers 416;
  17. # it reaches us because we serve static files.
  18. # v0.53.0 a static mount point was compared as a byte PREFIX rather than on
  19. # a path-segment boundary.
  20. # v0.52.0 listen backlog raised from 5 to 128, which five pending
  21. # connections overflow under ordinary churn.
  22. #
  23. # NOT the reason, and recorded because it was my first one and it was wrong:
  24. # v0.53.1's stack overflow in RegexMatcher::match() is real but was never
  25. # reachable here. CPPHTTPLIB_REQUEST_URI_MAX_LENGTH is 8192 in v0.46.0 too and
  26. # is enforced BEFORE routing, so a path long enough to overflow the stack is
  27. # answered 414 and never reaches the matcher. Measured on both versions rather
  28. # than taken from the changelog: escalating paths up to 2 MB against /fn/ get
  29. # 414 and the server stays up.
  30. #
  31. # Other fixes in the range apply to code paths this project does not use -
  32. # multipart SENDING, chunked response trailers, WebSockets, Mbed TLS - so they
  33. # are not part of the case either.
  34. #
  35. # NOT v0.60.0, deliberately: its security fix is Mbed TLS hostname
  36. # verification and we build against OpenSSL, and its bug fixes are all
  37. # redirect behaviour, which applyOutboundDefaults() turns off. It buys this
  38. # project nothing and it was released the same day it was considered.
  39. FetchContent_Declare(httplib
  40. GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
  41. GIT_TAG v0.59.0)
  42. FetchContent_MakeAvailable(httplib)