[PATCH] Added nginx_is_free macro to simplify version detection
Maxim Dounin
mdounin at mdounin.ru
Wed Jul 2 15:42:39 UTC 2025
Hello!
On Wed, Jul 02, 2025 at 07:48:39AM +0300, Maxim Dounin wrote:
> # HG changeset patch
> # User Maxim Dounin <mdounin at mdounin.ru>
> # Date 1751431259 -10800
> # Wed Jul 02 07:40:59 2025 +0300
> # Node ID 3da75a6d4086f48211fa2fbdd1538b5ebedc21bb
> # Parent 51e61f74584c40b0b3164b15491804ec8976432e
> Added nginx_is_free macro to simplify version detection.
>
> diff --git a/src/core/nginx.h b/src/core/nginx.h
> --- a/src/core/nginx.h
> +++ b/src/core/nginx.h
> @@ -12,6 +12,8 @@
> #define nginx_version 1029000
> #define NGINX_VERSION "1.29.0"
>
> +#define nginx_is_free 1
> +
> #define NGINX_NAME "freenginx"
> #define NGINX_VER NGINX_NAME "/" NGINX_VERSION
>
>
Looking more into this, I tend to think that probably "freenginx"
would be a better name for the macro.
As such, relevant version detection for modules which want to be
compatible with both freenginx and F5 NGINX would, for example,
following ngx_http_request_t change from start_sec / start_msec to
start_time in 9379:2edfdf15f9b4, would be:
#if (defined freenginx && nginx_version >= 1029000)
... use r->start_time
#else
... use r->start_sec
#endif
Updated patch:
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1751470888 -10800
# Wed Jul 02 18:41:28 2025 +0300
# Node ID 57344996566867d9843671cfd413ce51d3c4d507
# Parent 51e61f74584c40b0b3164b15491804ec8976432e
Added freenginx macro to simplify version detection.
For modules which want to be compatible with both freenginx and F5 NGINX
relevant version detection for the r->start_time change in 9379:2edfdf15f9b4
would look like:
#if (defined freenginx && nginx_version >= 1029000)
... use r->start_time
#else
... use r->start_sec
#endif
Requested by Georgy Shelkovy,
https://github.com/freenginx/nginx/issues/12
diff --git a/src/core/nginx.h b/src/core/nginx.h
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -12,6 +12,8 @@
#define nginx_version 1029000
#define NGINX_VERSION "1.29.0"
+#define freenginx 1
+
#define NGINX_NAME "freenginx"
#define NGINX_VER NGINX_NAME "/" NGINX_VERSION
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list