Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-07-29 22:05:45 +0400
committerIgor Sysoev <igor@sysoev.ru>2007-07-29 22:05:45 +0400
commita1df416d65167dcb6e472ae11a00ef67e770acec (patch)
treee38ad917e9c597f9748ef5fc14c21a59d62bb42e /src
parent005124201368a111c85f377bf8636cd161308901 (diff)
--sysconfdir=DIR
Diffstat (limited to 'src')
-rw-r--r--src/core/nginx.c6
-rw-r--r--src/core/ngx_conf_file.c21
-rw-r--r--src/core/ngx_conf_file.h3
-rw-r--r--src/core/ngx_file.c2
-rw-r--r--src/core/ngx_file.h2
-rw-r--r--src/core/ngx_log.c2
-rw-r--r--src/event/ngx_event_openssl.c6
-rw-r--r--src/http/modules/ngx_http_auth_basic_module.c2
-rw-r--r--src/http/modules/ngx_http_geo_module.c2
-rw-r--r--src/http/modules/ngx_http_map_module.c2
-rw-r--r--src/http/modules/perl/ngx_http_perl_module.c2
-rw-r--r--src/http/ngx_http_core_module.c9
-rw-r--r--src/http/ngx_http_variables.c4
13 files changed, 38 insertions, 25 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index b758775e3..27cb80f85 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -656,7 +656,7 @@ ngx_getopt(ngx_cycle_t *cycle, int argc, char *const *argv)
cycle->conf_file.data = (u_char *) NGX_CONF_PATH;
}
- if (ngx_conf_full_name(cycle, &cycle->conf_file) == NGX_ERROR) {
+ if (ngx_conf_full_name(cycle, &cycle->conf_file, 1) == NGX_ERROR) {
return NGX_ERROR;
}
@@ -826,7 +826,7 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
ccf->pid.data = (u_char *) NGX_PID_PATH;
}
- if (ngx_conf_full_name(cycle, &ccf->pid) == NGX_ERROR) {
+ if (ngx_conf_full_name(cycle, &ccf->pid, 0) == NGX_ERROR) {
return NGX_CONF_ERROR;
}
@@ -846,7 +846,7 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
ccf->lock_file.data = (u_char *) NGX_LOCK_PATH;
}
- if (ngx_conf_full_name(cycle, &ccf->lock_file) == NGX_ERROR) {
+ if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) == NGX_ERROR) {
return NGX_CONF_ERROR;
}
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index a68192fe0..514d55bad 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -641,7 +641,7 @@ ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
- if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR) {
+ if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR) {
return NGX_CONF_ERROR;
}
@@ -681,9 +681,10 @@ ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_int_t
-ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name)
+ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
{
- u_char *p;
+ size_t len;
+ u_char *p, *prefix;
ngx_str_t old;
if (name->data[0] == '/') {
@@ -704,14 +705,22 @@ ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name)
old = *name;
- name->len = cycle->root.len + old.len;
+ if (conf_prefix) {
+ len = sizeof(NGX_CONF_PREFIX) - 1;
+ prefix = (u_char *) NGX_CONF_PREFIX;
+ } else {
+ len = cycle->root.len;
+ prefix = cycle->root.data;
+ }
+
+ name->len = len + old.len;
name->data = ngx_palloc(cycle->pool, name->len + 1);
if (name->data == NULL) {
return NGX_ERROR;
}
- p = ngx_cpymem(name->data, cycle->root.data, cycle->root.len),
+ p = ngx_cpymem(name->data, prefix, len);
ngx_cpystrn(p, old.data, old.len + 1);
return NGX_OK;
@@ -734,7 +743,7 @@ ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
if (name) {
full = *name;
- if (ngx_conf_full_name(cycle, &full) == NGX_ERROR) {
+ if (ngx_conf_full_name(cycle, &full, 0) == NGX_ERROR) {
return NULL;
}
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 7d5112919..2e91d0b8c 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -320,7 +320,8 @@ char *ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data);
char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename);
-ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name);
+ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name,
+ ngx_uint_t conf_prefix);
ngx_open_file_t *ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name);
void ngx_cdecl ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf,
ngx_err_t err, char *fmt, ...);
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index fcb8ff080..f85578623 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -260,7 +260,7 @@ ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
path->name.len--;
}
- if (ngx_conf_full_name(cf->cycle, &path->name) == NGX_ERROR) {
+ if (ngx_conf_full_name(cf->cycle, &path->name, 0) == NGX_ERROR) {
return NULL;
}
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index 0f819a1b8..063b0fb83 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -109,7 +109,7 @@ char *ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
curr->name.len = sizeof(path) - 1; \
curr->name.data = (u_char *) path; \
\
- if (ngx_conf_full_name(cf->cycle, &curr->name) == NGX_ERROR) { \
+ if (ngx_conf_full_name(cf->cycle, &curr->name, 0) == NGX_ERROR) { \
return NGX_CONF_ERROR; \
} \
\
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index 349ae7681..1059acf43 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -333,7 +333,7 @@ ngx_set_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
} else {
cf->cycle->new_log->file->name = value[1];
- if (ngx_conf_full_name(cf->cycle, &cf->cycle->new_log->file->name)
+ if (ngx_conf_full_name(cf->cycle, &cf->cycle->new_log->file->name, 0)
== NGX_ERROR)
{
return NGX_CONF_ERROR;
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
index d31196887..63e5ba952 100644
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -198,7 +198,7 @@ ngx_int_t
ngx_ssl_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
ngx_str_t *key)
{
- if (ngx_conf_full_name(cf->cycle, cert) == NGX_ERROR) {
+ if (ngx_conf_full_name(cf->cycle, cert, 1) == NGX_ERROR) {
return NGX_ERROR;
}
@@ -211,7 +211,7 @@ ngx_ssl_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
return NGX_ERROR;
}
- if (ngx_conf_full_name(cf->cycle, key) == NGX_ERROR) {
+ if (ngx_conf_full_name(cf->cycle, key, 1) == NGX_ERROR) {
return NGX_ERROR;
}
@@ -242,7 +242,7 @@ ngx_ssl_client_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
return NGX_OK;
}
- if (ngx_conf_full_name(cf->cycle, cert) == NGX_ERROR) {
+ if (ngx_conf_full_name(cf->cycle, cert, 1) == NGX_ERROR) {
return NGX_ERROR;
}
diff --git a/src/http/modules/ngx_http_auth_basic_module.c b/src/http/modules/ngx_http_auth_basic_module.c
index 19bfe996e..72b4bbdcb 100644
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -352,7 +352,7 @@ ngx_http_auth_basic_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
}
if (conf->user_file.data) {
- if (ngx_conf_full_name(cf->cycle, &conf->user_file) != NGX_OK) {
+ if (ngx_conf_full_name(cf->cycle, &conf->user_file, 1) != NGX_OK) {
return NGX_CONF_ERROR;
}
diff --git a/src/http/modules/ngx_http_geo_module.c b/src/http/modules/ngx_http_geo_module.c
index 62ef72cf9..9c43bd716 100644
--- a/src/http/modules/ngx_http_geo_module.c
+++ b/src/http/modules/ngx_http_geo_module.c
@@ -198,7 +198,7 @@ ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
if (ngx_strcmp(value[0].data, "include") == 0) {
file = value[1];
- if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR){
+ if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR){
return NGX_CONF_ERROR;
}
diff --git a/src/http/modules/ngx_http_map_module.c b/src/http/modules/ngx_http_map_module.c
index 4a8acd00d..7b3a363fc 100644
--- a/src/http/modules/ngx_http_map_module.c
+++ b/src/http/modules/ngx_http_map_module.c
@@ -378,7 +378,7 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
if (ngx_strcmp(value[0].data, "include") == 0) {
file = value[1];
- if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR){
+ if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR){
return NGX_CONF_ERROR;
}
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
index 248f57823..836a415c9 100644
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -454,7 +454,7 @@ ngx_http_perl_init_interpreter(ngx_conf_t *cf, ngx_http_perl_main_conf_t *pmcf)
#endif
if (pmcf->modules.data) {
- if (ngx_conf_full_name(cf->cycle, &pmcf->modules) != NGX_OK) {
+ if (ngx_conf_full_name(cf->cycle, &pmcf->modules, 0) != NGX_OK) {
return NGX_CONF_ERROR;
}
}
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index a903c9a24..eb221395c 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1223,7 +1223,8 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
return NULL;
}
- if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path) == NGX_ERROR) {
+ if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, path, 0)== NGX_ERROR)
+ {
return NULL;
}
@@ -1947,7 +1948,7 @@ ngx_http_core_type(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
if (ngx_strcmp(value[0].data, "include") == 0) {
file = value[1];
- if (ngx_conf_full_name(cf->cycle, &file) == NGX_ERROR){
+ if (ngx_conf_full_name(cf->cycle, &file, 1) == NGX_ERROR){
return NGX_CONF_ERROR;
}
@@ -2290,7 +2291,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
conf->root.len = sizeof("html") - 1;
conf->root.data = (u_char *) "html";
- if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) {
+ if (ngx_conf_full_name(cf->cycle, &conf->root, 0) == NGX_ERROR) {
return NGX_CONF_ERROR;
}
}
@@ -2739,7 +2740,7 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (lcf->root.data[0] != '$') {
- if (ngx_conf_full_name(cf->cycle, &lcf->root) == NGX_ERROR) {
+ if (ngx_conf_full_name(cf->cycle, &lcf->root, 0) == NGX_ERROR) {
return NGX_CONF_ERROR;
}
}
diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
index 913746079..123017d80 100644
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -926,7 +926,9 @@ ngx_http_variable_document_root(ngx_http_request_t *r,
return NGX_ERROR;
}
- if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path) == NGX_ERROR) {
+ if (ngx_conf_full_name((ngx_cycle_t *) ngx_cycle, &path, 0)
+ == NGX_ERROR)
+ {
return NGX_ERROR;
}