]> git.kaiwu.me - nginx.git/commitdiff
check nginx.pm version
authorIgor Sysoev <igor@sysoev.ru>
Thu, 12 Oct 2006 19:55:15 +0000 (19:55 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 12 Oct 2006 19:55:15 +0000 (19:55 +0000)
docs/GNUmakefile
misc/GNUmakefile
src/core/nginx.h
src/http/modules/perl/nginx.pm
src/http/modules/perl/ngx_http_perl_module.c
src/http/modules/perl/ngx_http_perl_module.h

index 7f2d45afbc9f19e98037582e9c248c5a2f94de37..1198e42293d4242805e2a47a6efb828dff776021 100644 (file)
@@ -1,6 +1,6 @@
 
-VER=   $(shell grep NGINX_VER src/core/nginx.h                         \
-               | sed -e 's%^.*\"nginx/\(.*\)\"%\1%')
+VER=   $(shell grep 'define NGINX_VERSION' src/core/nginx.h            \
+               | sed -e 's/^.*\"\(.*\)\"/\1/')
 NGINX= nginx-$(VER)
 TEMP=  tmp
 CP=    $(HOME)/java
index f911c8308cb4f4721c4e7f22b23136836e0d42aa..158d7a13cf992de92bb180b989fca7b104920a08 100644 (file)
@@ -1,6 +1,6 @@
 
-VER=   $(shell grep NGINX_VER src/core/nginx.h                         \
-               | sed -e 's%^.*\"nginx/\(.*\)\"%\1%')
+VER=   $(shell grep 'define NGINX_VERSION' src/core/nginx.h            \
+               | sed -e 's/^.*\"\(.*\)\"/\1/')
 NGINX= nginx-$(VER)
 TEMP=  tmp
 
index 20003fdb59e85d3764d53c1d7bbcd65fbf210369..f761a7925d8536072a0b1fa049506c46501902b1 100644 (file)
@@ -8,7 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.4.9"
+#define NGINX_VERSION      "0.4.9"
+#define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
index 309eaa545d3f33c2980197bf4ef25aab1f53ecc5..2ab9820f4b9c5e8938fbf0b414fa4bca0a2b2295 100644 (file)
@@ -17,7 +17,7 @@ our @EXPORT = qw(
     HTTP_SERVER_ERROR
 );
 
-our $VERSION = '0.4.0';
+our $VERSION = '0.4.9';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
index e59ece4bb0239199ee4e7b932ac83ff97942ef32..4fd19485fdc4ff4587bc3706bda84a1522b95543 100644 (file)
@@ -565,7 +565,9 @@ ngx_http_perl_create_interpreter(ngx_http_perl_main_conf_t *pmcf,
     ngx_log_t *log)
 {
     int                n;
-    char              *embedding[6];
+    STRLEN             len;
+    SV                *sv;
+    char              *ver, *embedding[6];
     PerlInterpreter   *perl;
 
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "create perl interpreter");
@@ -634,6 +636,16 @@ ngx_http_perl_create_interpreter(ngx_http_perl_main_conf_t *pmcf,
         goto fail;
     }
 
+    sv = get_sv("nginx::VERSION", FALSE);
+    ver = SvPV(sv, len);
+
+    if (ngx_strcmp(ver, NGINX_VERSION) != 0) {
+        ngx_log_error(NGX_LOG_ALERT, log, 0,
+                      "version " NGINX_VERSION " of nginx.pm is required, "
+                      "but %s was found", ver);
+        goto fail;
+    }
+
     if (ngx_http_perl_run_requires(aTHX_ &pmcf->requires, log) != NGX_OK) {
         goto fail;
     }
index 66d15da1c202a47e734b03e341633d355e4e8afe..5a3d5082ad4e19111c50bd1c543f27003347a872 100644 (file)
@@ -11,6 +11,7 @@
 #include <ngx_config.h>
 #include <ngx_core.h>
 #include <ngx_http.h>
+#include <nginx.h>
 
 #include <EXTERN.h>
 #include <perl.h>