Repository navigation
Conversation
The fix includes <openssl/err.h> only if it exists, so a broken include path would silently drop it. Define NODE_LIBCURL_REQUIRE_OPENSSL_ERR when node-gyp's config.gypi says the runtime exports its bundled OpenSSL (node_use_openssl, not node_shared_openssl, not Electron), and turn the missing header into an #error there. Electron ships BoringSSL without OpenSSL headers or exports, and a shared system OpenSSL comes with its own headers, so both keep the header optional. npm_config_node_libcurl_openssl_err=optional opts out.
alonchin
reviewed
Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #48, from this review remark:
#if __has_include(<openssl/err.h>)quietly compiles the fix out if the header is ever missing.Where the header is missing, and whether that matters
<openssl/err.h>include/node/openssl/nm -Dfinds none ofERR_clear_error/ERR_get_error/SSL_read/SSL_get_errorinelectron, but all 4 innode--shared-openssl(distros)So today the header is missing only where the bug can't happen, and there the no-op is correct. Where the bug can happen, the header always ships. A future change to the include path would still drop the fix silently, though, and only the regression test would show it.
Change
binding.gypdefinesNODE_LIBCURL_REQUIRE_OPENSSL_ERRwhen node-gyp'sconfig.gypidescribes a runtime that exports its bundled OpenSSL:node_use_openssl=="true",node_shared_openssl=="false", and notbuilt_with_electron.src/OpenSslErrorQueue.hturns a missing<openssl/err.h>into an#errorthere.npm_config_node_libcurl_openssl_err=optional.#include, because it would break every Linux/macOS Electron build. I don't use#pragma messageeither, because it would print on every Electron build and still not stop anything.Checked
node:24-trixie(Node 24, bundled OpenSSL):pregyp configureadds the define. Withoptionalit doesn't.#error.node_shared_openssl: true, and Electron 39.1.1 hasbuilt_with_electron: 1. Neither gets the define.