Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added

### Changed
- Building for a Node.js that exports its bundled OpenSSL (official Node.js builds) now fails with an explicit `#error` when `<openssl/err.h>` cannot be found, instead of silently compiling the OpenSSL error queue fix above out. The header ships with Node's own headers (`include/node/openssl`) and with vcpkg on Windows, so this only fires on a broken include path. Electron (BoringSSL, no OpenSSL headers or exports) and Node.js built against a shared system OpenSSL keep the header optional. Set `npm_config_node_libcurl_openssl_err=optional` to build without it anyway.

## [5.1.2] - 2026-06-08

Expand Down
17 changes: 16 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,15 @@
# it for developer source builds requires the static runtime packages
# (e.g. libstdc++-static on RHEL/Rocky, libstdc++-dev on Ubuntu) to be
# installed, which is not a standard developer requirement.
'node_libcurl_static_runtime%': 'false'
'node_libcurl_static_runtime%': 'false',
# "auto": the build fails when <openssl/err.h> is missing for a runtime that
# exports its bundled OpenSSL (official Node.js), because libcurl then shares
# that OpenSSL's error queue and must clear it. "optional": never fail.
'node_libcurl_openssl_err%': 'auto',
# Normally set by the config.gypi node-gyp generates for the target runtime.
'node_use_openssl%': 'false',
'node_shared_openssl%': 'true',
'built_with_electron%': 0
},
# Node 26+ (Windows): the official Node build switched to ClangCL + ThinLTO,
# so common.gypi injects -flto=thin (compiler) and opt:lldltojobs=N (linker)
Expand Down Expand Up @@ -75,6 +83,13 @@
'NAPI_EXPERIMENTAL=1',
],
'conditions': [
# Electron ships BoringSSL without OpenSSL headers and does not export
# OpenSSL symbols, so the addon's own OpenSSL keeps a separate queue.
['node_libcurl_openssl_err=="auto" and node_use_openssl=="true" and node_shared_openssl=="false" and built_with_electron==0', {
Comment thread
aborovsky marked this conversation as resolved.
Resolved
'defines': [
'NODE_LIBCURL_REQUIRE_OPENSSL_ERR'
]
}],
['node_libcurl_no_setlocale=="true"', {
'defines': [
'NODE_LIBCURL_NO_SETLOCALE'
Expand Down
3 changes: 3 additions & 0 deletions src/OpenSslErrorQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#if __has_include(<openssl/err.h>)
#include <openssl/err.h>
#define NODE_LIBCURL_HAS_OPENSSL_ERR 1
#elif defined(NODE_LIBCURL_REQUIRE_OPENSSL_ERR)
#error \
"<openssl/err.h> not found, but this Node.js exports its bundled OpenSSL, whose error queue libcurl shares and must clear. Fix the include path, or set npm_config_node_libcurl_openssl_err=optional to build without it."
#endif

namespace NodeLibcurl {
Expand Down
Loading