Skip to content

Commit

Permalink
check nginx.pm version
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsysoev committed Oct 12, 2006
1 parent d79b21d commit 8a444aa
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/GNUmakefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions misc/GNUmakefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/core/nginx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/http/modules/perl/nginx.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 13 additions & 1 deletion src/http/modules/perl/ngx_http_perl_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/http/modules/perl/ngx_http_perl_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 8a444aa

Please sign in to comment.