fix(ApacheConnector): build as C++20 with clang; compare the scheme by content in secure() #5501 - #5502
Merged
Conversation
matejk
force-pushed
the
5501-apacheconnector-cxx20
branch
from
September 24, 2026 11:07
c9fcfc0 to
c8c5b43
Compare
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.
Summary
Fixes #5501. Two fixes in
ApacheConnector/src/ApacheConnector.cpp, one commit each.module AP_MODULE_DECLARE_DATA poco_module = ...starts a line withmodulefollowed by a name, which C++20 treats as a module directive; clang 21 rejects it. The definition now starts withextern "C", like the forward declaration near the top of the file and the other entry points. The linkage does not change (the forward declaration already gave the variable C linkage), andmod_poco.sostill exportspoco_moduleas a C data symbol.AP_DECLARE_MODULE(poco)fromhttp_config.hwould also avoid the directive, but it addsAPLOG_USE_MODULE, which changes the module index that log calls carry, so it is not used here.ApacheRequestRec::secure(). It comparedap_http_scheme()(aconst char*) with"https"by address, so it returned false for HTTPS requests. It now compares the text and handles a null scheme. clang flagged this with-Wstring-comparein the same build.Verification
Ubuntu 26.04, clang 21.1.8, apache2-dev 2.4.66,
-DPOCO_MINIMAL_BUILD=ON -DENABLE_APACHECONNECTOR=ON:main:mod_pocofails as C++20 with the three module errors from ApacheConnector: mod_poco does not compile as C++20 with clang; secure() compares the scheme by address #5501.mod_pocobuilds as C++20 without warnings;ApacheConnector.cppalso compiles as C++17.nmshowsD poco_modulein the C++17 object before and after the change and inlibmod_poco.so.124.CI builds ApacheConnector only in the GCC sanitizer jobs, which accept the old line, so it does not cover the clang C++20 case.