You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by ro...@apache.org on 2026/08/18 14:19:13 UTC

(axis-axis2-c-core) 16/16: Drop a define nothing reads, and say which one does

This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-c-core.git

commit 3b70ad4ef92ee2a4b4e23dc8544bd8a13f66d6bd
Author: Robert Lazarski <ro...@gmail.com>
AuthorDate: Tue Aug 18 03:52:07 2026 -1000

    Drop a define nothing reads, and say which one does
    
    INSTALL and src/core/receivers/Makefile.am both passed
    -DAXIS2_H2_JSON_ONLY_BUILD, which no source file tests, so it never did
    anything; remove it from both. The define that gates behaviour is
    HTTP2_JSON_ONLY_MODE, which mod_axis2.c uses to skip the XML reader and take
    a pool allocator. It is optional for serving JSON over HTTP/2, and enabling
    it also drops SOAP from the module.
    
    Co-Authored-By: Claude Opus 5 (1M context) <no...@anthropic.com>
---
 INSTALL                               | 24 ++++++++++++++++++++++--
 docs/HTTP2_CONDITIONAL_COMPILATION.md | 16 ++++++++++++++--
 src/core/receivers/Makefile.am        |  3 +--
 3 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/INSTALL b/INSTALL
index 873842096..34e52c5f8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -81,10 +81,30 @@ unmaintained since 2009. Windows users should use WSL2 (see Section 2).
 	            --with-apr=/usr/include/apr-1.0 \
 	            PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig \
 	            APACHE2_HOME=/usr \
-	            CFLAGS="$CFLAGS -DAXIS2_H2_JSON_ONLY_BUILD -DAXIS2_JSON_ENABLED -O2" \
-	            CPPFLAGS="$CPPFLAGS -DAXIS2_H2_JSON_ONLY_BUILD -DAXIS2_JSON_ENABLED" \
+	            CFLAGS="$CFLAGS -DAXIS2_JSON_ENABLED -O2" \
+	            CPPFLAGS="$CPPFLAGS -DAXIS2_JSON_ENABLED" \
 	            LDFLAGS="$LDFLAGS -L/usr/lib/x86_64-linux-gnu"
 
+	    The two configure flags are what matter: --enable-http2 turns on the
+	    transport, and --enable-json populates JSON_CFLAGS and JSON_LIBS through
+	    pkg-config, which the HTTP/2 code needs. HTTP/2 JSON works with the
+	    command above; nothing further has to be defined by hand.
+
+	    Earlier revisions of this file passed -DAXIS2_H2_JSON_ONLY_BUILD here.
+	    That define is never tested anywhere in the tree -- src/core/receivers/
+	    Makefile.am sets it and no source reads it -- so passing it had no
+	    effect. It has been dropped rather than left as a flag that looks
+	    load-bearing.
+
+	    The define that does gate behaviour is HTTP2_JSON_ONLY_MODE, which
+	    mod_axis2.c tests to skip the XML reader includes and initialisation and
+	    to take a pool allocator instead of shared memory. It is optional -- the
+	    build above serves JSON over HTTP/2 without it -- and switching it on
+	    also drops SOAP support from the module. See
+	    docs/HTTP2_CONDITIONAL_COMPILATION.md before using it; that document
+	    describes the supported combinations, which are HTTP/2 with JSON and
+	    HTTP/1.1 with SOAP, but not HTTP/2 with SOAP.
+
 	    Note: HTTP/2 transport provides:
 	    - Enterprise-grade stream multiplexing (100 concurrent streams)
 	    - Memory-efficient large payload processing (50MB+)
diff --git a/docs/HTTP2_CONDITIONAL_COMPILATION.md b/docs/HTTP2_CONDITIONAL_COMPILATION.md
index 97f091699..79b325b01 100644
--- a/docs/HTTP2_CONDITIONAL_COMPILATION.md
+++ b/docs/HTTP2_CONDITIONAL_COMPILATION.md
@@ -341,10 +341,22 @@ cmake -DHTTP2_JSON_ONLY_MODE=ON -DWITH_NGHTTP2=ON ..
 ```
 
 ### **Flag Dependencies**
-- `HTTP2_JSON_ONLY_MODE=1` - **Required** - Enables conditional compilation
-- `WITH_NGHTTP2=1` - **Required** - Enables HTTP/2 protocol support
+- `WITH_NGHTTP2=1` - **Required for HTTP/2 at all** - set by `--enable-http2`
+- `HTTP2_JSON_ONLY_MODE=1` - **Required for JSON-only mode, optional otherwise**
+  - Serving JSON over HTTP/2 does not need it: `--enable-http2 --enable-json`
+    alone is enough, and is what the build in INSTALL uses. What this define
+    adds is the elimination described above -- `mod_axis2.c` then skips the
+    AXIOM XML reader includes and its initialisation, and takes a pool
+    allocator instead of shared memory. It also drops SOAP from the module,
+    so set it only when the deployment is JSON-only.
 - Standard Axis2/C flags remain unchanged for compatibility
 
+> **Not to be confused with** `AXIS2_H2_JSON_ONLY_BUILD`. That define was
+> passed by `src/core/receivers/Makefile.am` and by the build recipe in
+> INSTALL, but no source file ever tested it, so it did nothing; both have
+> since dropped it. `HTTP2_JSON_ONLY_MODE`, documented here, is the one that
+> gates behaviour.
+
 ## 🎯 **Usage Guidelines**
 
 ### **When to Enable HTTP2_JSON_ONLY_MODE**
diff --git a/src/core/receivers/Makefile.am b/src/core/receivers/Makefile.am
index 9493d33fe..d415c5d0c 100644
--- a/src/core/receivers/Makefile.am
+++ b/src/core/receivers/Makefile.am
@@ -25,8 +25,7 @@ libaxis2_receivers_la_CPPFLAGS = -I$(top_srcdir)/include \
                                 -I$(top_srcdir)/util/include \
                                 -I$(top_srcdir)/axiom/include \
                                 -I/usr/include/json-c \
-                                -DAXIS2_JSON_ENABLED \
-                                -DAXIS2_H2_JSON_ONLY_BUILD
+                                -DAXIS2_JSON_ENABLED
 libaxis2_receivers_la_LIBADD = -ljson-c
 else
 libaxis2_receivers_la_SOURCES = msg_recv.c \