summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-01-24 16:08:27 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-01-24 16:08:27 +0000
commit34303468409089ef2b5bd9739b9c049c393932e4 (patch)
tree1e47f167cd74beaeca64d863662ed1e82d2cf822
parentd94e18746b9e79fbb52cf3012d1692ad893df22e (diff)
downloadnginx-34303468409089ef2b5bd9739b9c049c393932e4.tar.gz
nginx-0.3.23-RELEASE importrelease-0.3.23
*) Feature: the "optimize_host_names" directive. *) Bugfix: in using of the variables in the "path" and "alias" directives. *) Bugfix: the ngx_http_perl_module was incorrectly built on Linux and Solaris.
-rw-r--r--docs/xml/nginx/changes.xml32
-rw-r--r--src/core/nginx.h2
-rw-r--r--src/http/modules/ngx_http_referer_module.c10
-rw-r--r--src/http/modules/ngx_http_static_module.c2
-rw-r--r--src/http/modules/perl/nginx.pm2
-rw-r--r--src/http/modules/perl/nginx.xs6
-rw-r--r--src/http/ngx_http.c18
-rw-r--r--src/http/ngx_http_core_module.c42
-rw-r--r--src/http/ngx_http_core_module.h1
9 files changed, 97 insertions, 18 deletions
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
index 8ef64c9ca..72eb87951 100644
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -9,6 +9,38 @@
<title lang="en">nginx changelog</title>
+<changes ver="0.3.23" date="24.01.2006">
+
+<change type="feature">
+<para lang="ru">
+директива optimize_host_names.
+</para>
+<para lang="en">
+the "optimize_host_names" directive.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+ошибки при использовании переменных в директивах path и alias.
+</para>
+<para lang="en">
+in using of the variables in the "path" and "alias" directives.
+</para>
+</change>
+
+<change type="bugfix">
+<para lang="ru">
+модуль ngx_http_perl_module неправильно собирался на Linux и Solaris.
+</para>
+<para lang="en">
+the ngx_http_perl_module was incorrectly built on Linux and Solaris.
+</para>
+</change>
+
+</changes>
+
+
<changes ver="0.3.22" date="17.01.2006">
<change type="feature">
diff --git a/src/core/nginx.h b/src/core/nginx.h
index a2c696fea..0912ac5cd 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_
-#define NGINX_VER "nginx/0.3.22"
+#define NGINX_VER "nginx/0.3.23"
#define NGINX_VAR "NGINX"
#define NGX_OLDPID_EXT ".oldbin"
diff --git a/src/http/modules/ngx_http_referer_module.c b/src/http/modules/ngx_http_referer_module.c
index 459984eaa..17a3427ca 100644
--- a/src/http/modules/ngx_http_referer_module.c
+++ b/src/http/modules/ngx_http_referer_module.c
@@ -216,6 +216,16 @@ ngx_http_referer_merge_conf(ngx_conf_t *cf, void *parent, void *child)
return NGX_CONF_OK;
}
+ if ((conf->no_referer == 1 || conf->blocked_referer == 1)
+ && conf->keys->keys.nelts == 0 && conf->keys->dns_wildcards.nelts)
+ {
+ ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
+ "the \"none\" or \"blocked\" referers are specified "
+ "in the \"valid_referers\" directive "
+ "without any valid referer");
+ return NGX_CONF_ERROR;
+ }
+
hash.key = ngx_hash_key_lc;
hash.max_size = 2048; /* TODO: referer_hash_max_size; */
hash.bucket_size = 64; /* TODO: referer_hash_bucket_size; */
diff --git a/src/http/modules/ngx_http_static_module.c b/src/http/modules/ngx_http_static_module.c
index 42cc676af..0dbec5093 100644
--- a/src/http/modules/ngx_http_static_module.c
+++ b/src/http/modules/ngx_http_static_module.c
@@ -186,7 +186,7 @@ ngx_http_static_handler(ngx_http_request_t *r)
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
- if (!clcf->alias) {
+ if (!clcf->alias && clcf->root_lengths == NULL) {
location = path.data + clcf->root.len;
} else {
diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm
index c0f3f27eb..d87b2ec78 100644
--- a/src/http/modules/perl/nginx.pm
+++ b/src/http/modules/perl/nginx.pm
@@ -17,7 +17,7 @@ our @EXPORT = qw(
HTTP_SERVER_ERROR
);
-our $VERSION = '0.3.22';
+our $VERSION = '0.3.23';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index d41bf684f..c24788c70 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -6,15 +6,13 @@
#define PERL_NO_GET_CONTEXT
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>
#include <ngx_http_perl_module.h>
+#include "XSUB.h"
+
static ngx_int_t
ngx_http_perl_sv2str(pTHX_ ngx_http_request_t *r, ngx_str_t *s, SV *sv)
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 72eacc861..61f9430fd 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -76,7 +76,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
char *rv;
u_char ch;
ngx_int_t rc;
- ngx_uint_t mi, m, s, l, p, a, n, i;
+ ngx_uint_t mi, m, s, l, p, a, i;
ngx_uint_t last, bind_all, done;
ngx_conf_t pcf;
ngx_array_t in_ports;
@@ -533,16 +533,20 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
/*
* check whether all name-based servers have the same configuraiton
- * as the default server, or some servers restrict the host names
+ * as the default server,
+ * or some servers restrict the host names,
+ * or some servers disable optimizing the host names
*/
in_addr = in_port[p].addrs.elts;
for (a = 0; a < in_port[p].addrs.nelts; a++) {
name = in_addr[a].names.elts;
- for (n = 0; n < in_addr[a].names.nelts; n++) {
- if (in_addr[a].core_srv_conf != name[n].core_srv_conf
- || name[n].core_srv_conf->restrict_host_names
+ for (s = 0; s < in_addr[a].names.nelts; s++) {
+
+ if (in_addr[a].core_srv_conf != name[s].core_srv_conf
+ || name[s].core_srv_conf->optimize_host_names == 0
+ || name[s].core_srv_conf->restrict_host_names
!= NGX_HTTP_RESTRICT_HOST_OFF)
{
goto virtual_names;
@@ -551,7 +555,9 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
/*
* if all name-based servers have the same configuration
- * as the default server, and no servers restrict the host names
+ * as the default server,
+ * and no servers restrict the host names,
+ * and no servers disable optimizing the host names
* then we do not need to check them at run-time at all
*/
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index dc7d97299..a73448b99 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -136,6 +136,13 @@ static ngx_command_t ngx_http_core_commands[] = {
offsetof(ngx_http_core_srv_conf_t, restrict_host_names),
&ngx_http_restrict_host_names },
+ { ngx_string("optimize_host_names"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_SRV_CONF_OFFSET,
+ offsetof(ngx_http_core_srv_conf_t, optimize_host_names),
+ NULL },
+
{ ngx_string("ignore_invalid_headers"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
@@ -995,6 +1002,13 @@ ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path,
alias = clcf->alias ? clcf->name.len : 0;
+ if (alias && !r->valid_location) {
+ ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
+ "\"alias\" could not be used in location \"%V\" "
+ "where URI was rewritten", &clcf->name);
+ return NULL;
+ }
+
if (clcf->root_lengths == NULL) {
r->root_length = clcf->root.len;
@@ -1826,6 +1840,7 @@ ngx_http_core_create_srv_conf(ngx_conf_t *cf)
cscf->client_header_timeout = NGX_CONF_UNSET_MSEC;
cscf->client_header_buffer_size = NGX_CONF_UNSET_SIZE;
cscf->restrict_host_names = NGX_CONF_UNSET_UINT;
+ cscf->optimize_host_names = NGX_CONF_UNSET;
cscf->ignore_invalid_headers = NGX_CONF_UNSET;
return cscf;
@@ -1908,6 +1923,9 @@ ngx_http_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_unsigned_value(conf->restrict_host_names,
prev->restrict_host_names, 0);
+ ngx_conf_merge_value(conf->optimize_host_names,
+ prev->optimize_host_names, 1);
+
ngx_conf_merge_value(conf->ignore_invalid_headers,
prev->ignore_invalid_headers, 1);
@@ -1990,10 +2008,20 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_hash_key_t *type;
ngx_hash_init_t types_hash;
- ngx_conf_merge_str_value(conf->root, prev->root, "html");
+ if (conf->root.data == NULL) {
- if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) {
- return NGX_CONF_ERROR;
+ conf->root = prev->root;
+ conf->root_lengths = prev->root_lengths;
+ conf->root_values = prev->root_values;
+
+ if (prev->root.data == NULL) {
+ conf->root.len = sizeof("html") - 1;
+ conf->root.data = (u_char *) "html";
+
+ if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) {
+ return NGX_CONF_ERROR;
+ }
+ }
}
if (conf->post_action.data == NULL) {
@@ -2417,7 +2445,11 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
lcf->root.len--;
}
- n = ngx_http_script_variables_count(&value[1]);
+ if (ngx_conf_full_name(cf->cycle, &lcf->root) == NGX_ERROR) {
+ return NGX_CONF_ERROR;
+ }
+
+ n = ngx_http_script_variables_count(&lcf->root);
if (n == 0) {
return NGX_CONF_OK;
@@ -2426,7 +2458,7 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
sc.cf = cf;
- sc.source = &value[1];
+ sc.source = &lcf->root;
sc.lengths = &lcf->root_lengths;
sc.values = &lcf->root_values;
sc.variables = n;
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 20bf3a626..48cbc4217 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -109,6 +109,7 @@ typedef struct {
ngx_uint_t restrict_host_names;
+ ngx_flag_t optimize_host_names;
ngx_flag_t ignore_invalid_headers;
} ngx_http_core_srv_conf_t;