nginx-0.3.23-RELEASE import

*) 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.
This commit is contained in:
Igor Sysoev 2006-01-24 16:08:27 +00:00
parent d94e18746b
commit 3430346840
9 changed files with 97 additions and 18 deletions

View File

@ -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">

View File

@ -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"

View File

@ -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; */

View File

@ -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 {

View File

@ -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);

View File

@ -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)

View File

@ -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
*/

View File

@ -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;

View File

@ -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;