Skip to content

Fix Windows nghttp2 builds while preserving older API compatibility - #905

Merged
ithewei merged 2 commits into
ithewei:masterfrom
Frozen-Projects:master
Oct 12, 2026
Merged

ithewei merged 2 commits into
ithewei:masterfrom
Frozen-Projects:master

Conversation

@ffreality

Copy link
Copy Markdown
Contributor

Fix MSVC compilation failures caused by undefined ssize_t in nghttp2 headers. Use version checks to select modern APIs for nghttp2 1.60.0 and newer, retain legacy APIs for older releases, and guard the upgrade API separately. Keep the Windows ssize_t shim scoped to the nghttp2 header.

Use the installed nghttp2 CMake package when available, propagate that dependency to libhv consumers, and preserve the manual library fallback without imposing a new minimum version.

Also I added HTTP Error Code 499 Request Canceled

Fix MSVC compilation failures caused by undefined ssize_t in nghttp2 headers. Use version checks to select modern APIs for nghttp2 1.60.0 and newer, retain legacy APIs for older releases, and guard the upgrade API separately. Keep the Windows ssize_t shim scoped to the nghttp2 header.

Use the installed nghttp2 CMake package when available, propagate that dependency to libhv consumers, and preserve the manual library fallback without imposing a new minimum version.

Also I added HTTP Error Code 499 Request Canceled
Copilot AI balanced review requested due to automatic review settings October 11, 2026 21:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Static nghttp2 packages remain unsupported, and the public header unnecessarily hides legacy APIs on non-Windows platforms.

2 open findings
What changed in this PR

Improves nghttp2 compatibility across Windows and older releases while adding HTTP status 499.

Changes:

  • Selects nghttp2 APIs based on version.
  • Adds CMake package dependency propagation.
  • Adds HTTP 499 “Request Cancelled.”
File Description
http/​httpdef.h Adds status 499.
http/​Http2Parser.h Adds nghttp2 compatibility shims.
http/​Http2Parser.cpp Selects legacy or modern APIs.
CMakeLists.txt Discovers nghttp2 CMake packages.
cmake/​libhvConfig.cmake.in Propagates nghttp2 to consumers.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread http/Http2Parser.h Outdated
Comment thread CMakeLists.txt
if(WITH_NGHTTP2)
add_definitions(-DWITH_NGHTTP2)
set(LIBS ${LIBS} nghttp2)
find_package(nghttp2 CONFIG QUIET)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 11, 2026 22:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Static-only nghttp2 CMake packages are not handled correctly.

2 open findings
1 resolved since last review

🧠 Review effort: Balanced

Comment thread CMakeLists.txt
Comment on lines +164 to +170
find_package(nghttp2 CONFIG QUIET)
if(TARGET nghttp2::nghttp2)
set(LIBS ${LIBS} nghttp2::nghttp2)
set(LIBHV_FIND_DEPENDENCY_NGHTTP2 TRUE)
else()
set(LIBS ${LIBS} nghttp2)
endif()
@ithewei
ithewei merged commit e788c48 into ithewei:master Oct 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants