summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAlexander Borisov <alexander.borisov@nginx.com>2018-04-04 18:53:39 +0300
committerAlexander Borisov <alexander.borisov@nginx.com>2018-04-04 18:53:39 +0300
commit49bd3a21e0f995c895b445c0566227661418c2bc (patch)
tree1822ad6a45f285ba1db652eec99949a128d39c15 /src
parent0665896a5593fb41c92cbf164182a058ee40518c (diff)
downloadunit-49bd3a21e0f995c895b445c0566227661418c2bc.tar.gz
unit-49bd3a21e0f995c895b445c0566227661418c2bc.tar.bz2
Changed version processing for modules.
Diffstat (limited to 'src')
-rw-r--r--src/nxt_application.c18
-rw-r--r--src/nxt_application.h2
-rw-r--r--src/nxt_go.c2
-rw-r--r--src/nxt_php_sapi.c2
-rw-r--r--src/nxt_python_wsgi.c2
-rw-r--r--src/perl/nxt_perl_psgi.c2
-rw-r--r--src/ruby/nxt_ruby.c2
7 files changed, 16 insertions, 14 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index 8ded36da..fba20985 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -180,7 +180,7 @@ nxt_discovery_module(nxt_task_t *task, nxt_mp_t *mp, nxt_array_t *modules,
const char *name)
{
void *dl;
- nxt_str_t *s;
+ nxt_str_t version;
nxt_int_t ret;
nxt_uint_t i, n;
nxt_module_t *module;
@@ -203,8 +203,8 @@ nxt_discovery_module(nxt_task_t *task, nxt_mp_t *mp, nxt_array_t *modules,
app = dlsym(dl, "nxt_app_module");
if (app != NULL) {
- nxt_log(task, NXT_LOG_NOTICE, "module: %V %V \"%s\"",
- &app->type, &app->version, name);
+ nxt_log(task, NXT_LOG_NOTICE, "module: %V %s \"%s\"",
+ &app->type, app->version, name);
if (app->compat_length != sizeof(compat)
|| nxt_memcmp(app->compat, compat, sizeof(compat)) != 0)
@@ -225,15 +225,17 @@ nxt_discovery_module(nxt_task_t *task, nxt_mp_t *mp, nxt_array_t *modules,
module = modules->elts;
n = modules->nelts;
+ version.start = (u_char *) app->version;
+ version.length = nxt_strlen(app->version);
+
for (i = 0; i < n; i++) {
if (type == module[i].type
- && nxt_strstr_eq(&app->version, &module[i].version))
+ && nxt_strstr_eq(&module[i].version, &version))
{
nxt_log(task, NXT_LOG_NOTICE,
"ignoring %s module with the same "
"application language version %V %V as in %V",
- name, &app->type, &app->version,
- &module[i].file);
+ name, &app->type, version, &module[i].file);
goto done;
}
@@ -246,8 +248,8 @@ nxt_discovery_module(nxt_task_t *task, nxt_mp_t *mp, nxt_array_t *modules,
module->type = type;
- s = nxt_str_dup(mp, &module->version, &app->version);
- if (s == NULL) {
+ nxt_str_dup(mp, &module->version, &version);
+ if (module->version.start == NULL) {
goto fail;
}
diff --git a/src/nxt_application.h b/src/nxt_application.h
index c899b1c7..bdff4a62 100644
--- a/src/nxt_application.h
+++ b/src/nxt_application.h
@@ -216,7 +216,7 @@ struct nxt_app_module_s {
uint32_t *compat;
nxt_str_t type;
- nxt_str_t version;
+ const char *version;
nxt_int_t (*init)(nxt_task_t *task,
nxt_common_app_conf_t *conf);
diff --git a/src/nxt_go.c b/src/nxt_go.c
index 709908e2..edcd5eff 100644
--- a/src/nxt_go.c
+++ b/src/nxt_go.c
@@ -17,7 +17,7 @@ nxt_application_module_t nxt_go_module = {
0,
NULL,
nxt_string("go"),
- nxt_string("go"),
+ "*",
nxt_go_init,
nxt_go_run,
NULL,
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index b7c68760..45260f1b 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -166,7 +166,7 @@ NXT_EXPORT nxt_application_module_t nxt_app_module = {
sizeof(compat),
compat,
nxt_string("php"),
- nxt_string(PHP_VERSION),
+ PHP_VERSION,
nxt_php_init,
nxt_php_run,
NULL,
diff --git a/src/nxt_python_wsgi.c b/src/nxt_python_wsgi.c
index 7c24828a..7d805703 100644
--- a/src/nxt_python_wsgi.c
+++ b/src/nxt_python_wsgi.c
@@ -100,7 +100,7 @@ NXT_EXPORT nxt_application_module_t nxt_app_module = {
sizeof(compat),
compat,
nxt_string("python"),
- nxt_string(PY_VERSION),
+ PY_VERSION,
nxt_python_init,
nxt_python_run,
nxt_python_atexit,
diff --git a/src/perl/nxt_perl_psgi.c b/src/perl/nxt_perl_psgi.c
index 748bcc3a..5b206cba 100644
--- a/src/perl/nxt_perl_psgi.c
+++ b/src/perl/nxt_perl_psgi.c
@@ -113,7 +113,7 @@ NXT_EXPORT nxt_application_module_t nxt_app_module = {
sizeof(nxt_perl_psgi_compat),
nxt_perl_psgi_compat,
nxt_string("perl"),
- nxt_string(PERL_VERSION_STRING),
+ PERL_VERSION_STRING,
nxt_perl_psgi_init,
nxt_perl_psgi_run,
nxt_perl_psgi_atexit,
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c
index 7ae5c73d..6785d031 100644
--- a/src/ruby/nxt_ruby.c
+++ b/src/ruby/nxt_ruby.c
@@ -74,7 +74,7 @@ NXT_EXPORT nxt_application_module_t nxt_app_module = {
sizeof(compat),
compat,
nxt_string("ruby"),
- nxt_string(NXT_RUBY_LIB_VERSION),
+ ruby_version,
nxt_ruby_init,
nxt_ruby_run,
nxt_ruby_atexit,