diff --git a/auto/sources b/auto/sources
index bd9259a51..c4aec701c 100644
--- a/auto/sources
+++ b/auto/sources
@@ -262,7 +262,7 @@ HTTP_DEPS="src/http/ngx_http.h \
src/http/ngx_http_script.h \
src/http/ngx_http_upstream.h \
src/http/ngx_http_busy_lock.h \
- src/http/ngx_http_log_module.h"
+ src/http/modules/ngx_http_log_module.h"
HTTP_SRCS="src/http/ngx_http.c \
src/http/ngx_http_core_module.c \
@@ -272,7 +272,7 @@ HTTP_SRCS="src/http/ngx_http.c \
src/http/ngx_http_header_filter_module.c \
src/http/ngx_http_write_filter_module.c \
src/http/ngx_http_copy_filter_module.c \
- src/http/ngx_http_log_module.c \
+ src/http/modules/ngx_http_log_module.c \
src/http/ngx_http_request_body.c \
src/http/ngx_http_variables.c \
src/http/ngx_http_script.c \
diff --git a/auto/threads b/auto/threads
index d72614b21..2bf85b65f 100644
--- a/auto/threads
+++ b/auto/threads
@@ -50,7 +50,7 @@ case $USE_THREADS in
CORE_LIBS="$CORE_LIBS -pthread"
;;
- FreeBSD:5*)
+ FreeBSD:[567]*)
have=NGX_THREADS . auto/have
CORE_SRCS="$CORE_SRCS $PTHREAD_SRCS"
CORE_LIBS="$CORE_LIBS -lc_r"
diff --git a/conf/nginx.conf b/conf/nginx.conf
index 542fda2d3..8d65445eb 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -34,6 +34,12 @@ http {
index index.html index.htm;
}
+ # proxy the PHP scripts to Apache listening on 127.0.0.1:80
+ #
+ #location ~ \.php$ {
+ # proxy_pass http://127.0.0.1;
+ #}
+
# deny access to .htaccess files
#
#location ~ /\.ht {
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml
index 8f0abd6b8..99134ef45 100644
--- a/docs/xml/nginx/changes.xml
+++ b/docs/xml/nginx/changes.xml
@@ -9,6 +9,52 @@
nginx changelog
+
+
+
+
+IMAP/POP3 ÐÒÏËÓÉ ÔÅÐÅÒØ ÎÅ ÐÅÒÅÄÁ£Ô ÓÅÒ×ÅÒÕ Á×ÔÏÒÉÚÁÃÉÉ ÐÕÓÔÏÊ ÌÏÇÉÎ.
+
+
+now the IMAP/POP3 proxy do not send the empty login to authorization server.
+
+
+
+
+
+ÄÉÒÅËÔÉ×Á log_format ÐÏÄÄÅÒÖÉ×ÁÅÔ ÐÅÒÅÍÅÎÎÙÅ × ×ÉÄÅ $name.
+
+
+the "log_format" supports the variables in the $name form.
+
+
+
+
+
+ÅÓÌÉ ÈÏÔÑ ÂÙ × ÏÄÎÏÍ ÓÅÒ×ÅÒÅ ÎÅ ÂÙÌÏ ÏÐÉÓÁÎÏ ÎÉ ÏÄÎÏÊ ÄÉÒÅËÔÉ×Ù listen, ÔÏ
+nginx ÎÅ ÓÌÕÛÁÌ ÎÁ 80 ÐÏÒÔÕ;
+ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.3.3.
+
+
+if at least in one server was no the "listen" directive, then nginx did not
+listen on the 80 port;
+bug appeared in 0.3.3.
+
+
+
+
+
+ÅÓÌÉ × ÄÉÒÅËÔÉ×Å proxy_pass ÏÔÓÕÔÓÔ×Ï×ÁÌ URI, ÔÏ ×ÓÅÇÄÁ ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÐÏÒÔ 80.
+
+
+if the URI part is omitted in "proxy_pass" directive, the the 80 port was
+always used.
+
+
+
+
+
+
@@ -449,7 +495,7 @@ bug appeared in 0.2.2.
-ËÏÍÁÎÄÁ config errmsg × ÍÏÄÕÌÅ ngx_http_sssi_module.
+ËÏÍÁÎÄÁ config errmsg × ÍÏÄÕÌÅ ngx_http_ssi_module.
the "config errmsg" command of the ngx_http_ssi_module.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 879c25fb8..5a3593d35 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.5"
+#define NGINX_VER "nginx/0.3.6"
#define NGINX_VAR "NGINX"
#define NGX_OLDPID_EXT ".oldbin"
diff --git a/src/core/ngx_connection.c b/src/core/ngx_connection.c
index 94f816bff..2e3466954 100644
--- a/src/core/ngx_connection.c
+++ b/src/core/ngx_connection.c
@@ -367,9 +367,8 @@ ngx_configure_listening_socket(ngx_cycle_t *cycle)
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
- "setsockopt(SO_RCVBUF) %V failed, ignored",
- &ls[i].addr_text);
- return;
+ "setsockopt(SO_RCVBUF, %d) %V failed, ignored",
+ ls[i].rcvbuf, &ls[i].addr_text);
}
}
@@ -379,9 +378,8 @@ ngx_configure_listening_socket(ngx_cycle_t *cycle)
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
- "setsockopt(SO_SNDBUF) %V failed, ignored",
- &ls[i].addr_text);
- return;
+ "setsockopt(SO_SNDBUF, %d) %V failed, ignored",
+ ls[i].sndbuf, &ls[i].addr_text);
}
}
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index 60a40eca4..4be55fdb5 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -452,7 +452,23 @@ ngx_inet_parse_host_port(ngx_inet_upstream_t *u)
}
}
- if (u->port_text.data == NULL) {
+ if (u->port_text.data) {
+
+ if (u->port_text.len == 0) {
+ u->port_text.len = &url->data[i] - u->port_text.data;
+
+ if (u->port_text.len == 0) {
+ return "invalid port";
+ }
+ }
+
+ port = ngx_atoi(u->port_text.data, u->port_text.len);
+
+ if (port == NGX_ERROR || port < 1 || port > 65536) {
+ return "invalid port";
+ }
+
+ } else {
port = ngx_atoi(url->data, url->len);
if (port == NGX_ERROR) {
@@ -464,18 +480,6 @@ ngx_inet_parse_host_port(ngx_inet_upstream_t *u)
u->port_text = *url;
u->wildcard = 1;
-
- } else {
- if (u->port_text.len == 0) {
- u->default_port = 1;
- return NULL;
- }
-
- port = ngx_atoi(u->port_text.data, u->port_text.len);
-
- if (port == NGX_ERROR || port < 1 || port > 65536) {
- return "invalid port";
- }
}
u->port = (in_port_t) port;
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 1e7229114..03d956d5d 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -212,12 +212,12 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
last = ctx->output_filter(ctx->filter_ctx, out);
- ngx_chain_update_chains(&ctx->free, &ctx->busy, &out, ctx->tag);
- last_out = &out;
-
- if (last == NGX_ERROR) {
+ if (last == NGX_ERROR || last == NGX_DONE) {
return last;
}
+
+ ngx_chain_update_chains(&ctx->free, &ctx->busy, &out, ctx->tag);
+ last_out = &out;
}
}
diff --git a/src/http/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
similarity index 90%
rename from src/http/ngx_http_log_module.c
rename to src/http/modules/ngx_http_log_module.c
index 617d46a7f..6e7772e56 100644
--- a/src/http/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -83,6 +83,7 @@ static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
+static ngx_int_t ngx_http_log_init(ngx_cycle_t *cycle);
static ngx_command_t ngx_http_log_commands[] = {
@@ -126,7 +127,7 @@ ngx_module_t ngx_http_log_module = {
ngx_http_log_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
NULL, /* init master */
- NULL, /* init module */
+ ngx_http_log_init, /* init module */
NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
@@ -140,8 +141,14 @@ static ngx_str_t http_access_log = ngx_string(NGX_HTTP_LOG_PATH);
static ngx_str_t ngx_http_combined_fmt =
- ngx_string("%addr - - [%time] \"%request\" %status %apache_length "
- "\"%{Referer}i\" \"%{User-Agent}i\"");
+#if 0
+ ngx_string("$remote_addr - $remote_user [%time] "
+ "\"$request\" %status %apache_length "
+ "\"$http_referer\" \"$http_user_agent\"");
+#endif
+ ngx_string("%addr - - [%time] "
+ "\"%request\" %status %apache_length "
+ "\"%{referer}i\" \"%{user-agent}i\"");
ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
@@ -824,7 +831,7 @@ ngx_http_log_create_main_conf(ngx_conf_t *cf)
}
if (ngx_array_init(&conf->formats, cf->pool, 4, sizeof(ngx_http_log_fmt_t))
- == NGX_ERROR)
+ == NGX_ERROR)
{
return NGX_CONF_ERROR;
}
@@ -836,6 +843,9 @@ ngx_http_log_create_main_conf(ngx_conf_t *cf)
return NGX_CONF_ERROR;
}
+ value->len = 0;
+ value->data = NULL;
+
value = ngx_array_push(cf->args);
if (value == NULL) {
return NGX_CONF_ERROR;
@@ -853,7 +863,7 @@ ngx_http_log_create_main_conf(ngx_conf_t *cf)
rc = ngx_http_log_set_format(cf, NULL, conf);
if (rc != NGX_CONF_OK) {
- return NULL;
+ return NGX_CONF_ERROR;
}
return conf;
@@ -993,10 +1003,10 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_log_main_conf_t *lmcf = conf;
- ngx_uint_t s, f, invalid;
- u_char *data, *p, *fname;
+ u_char *data, *p, *fname, ch;
size_t i, len, fname_len;
- ngx_str_t *value, arg, *a;
+ ngx_str_t *value, var, arg, *a;
+ ngx_uint_t s, f, bracket;
ngx_http_log_op_t *op;
ngx_http_log_fmt_t *fmt;
ngx_http_log_op_name_t *name;
@@ -1024,11 +1034,9 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_ERROR;
}
- invalid = 0;
- data = NULL;
arg.data = NULL;
- for (s = 2; s < cf->args->nelts && !invalid; s++) {
+ for (s = 2; s < cf->args->nelts; s++) {
i = 0;
@@ -1045,8 +1053,7 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
i++;
if (i == value[s].len) {
- invalid = 1;
- break;
+ goto invalid;
}
if (value[s].data[i] == '{') {
@@ -1061,8 +1068,7 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
arg.len = &value[s].data[i] - arg.data;
if (i == value[s].len || arg.len == 0) {
- invalid = 1;
- break;
+ goto invalid;
}
i++;
@@ -1083,8 +1089,7 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
fname_len = &value[s].data[i] - fname;
if (fname_len == 0) {
- invalid = 1;
- break;
+ goto invalid;
}
for (name = ngx_http_log_fmt_ops; name->run; name++) {
@@ -1135,14 +1140,71 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (name->name.len == 0) {
- invalid = 1;
+ goto invalid;
+ }
+
+ } else if (value[s].data[i] == '$') {
+
+ if (++i == value[s].len) {
+ goto invalid;
+ }
+
+ if (value[s].data[i] == '{') {
+ bracket = 1;
+
+ if (++i == value[s].len) {
+ goto invalid;
+ }
+
+ var.data = &value[s].data[i];
+
+ } else {
+ bracket = 0;
+ var.data = &value[s].data[i];
+ }
+
+ for (var.len = 0; i < value[s].len; i++, var.len++) {
+ ch = value[s].data[i];
+
+ if (ch == '}' && bracket) {
+ i++;
+ bracket = 0;
+ break;
+ }
+
+ if ((ch >= 'A' && ch <= 'Z')
+ || (ch >= 'a' && ch <= 'z')
+ || (ch >= '0' && ch <= '9')
+ || ch == '_')
+ {
+ continue;
+ }
+
break;
}
+ if (bracket) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "the closing bracket in \"%V\" "
+ "variable is missing", &var);
+ return NGX_CONF_ERROR;
+ }
+
+ if (var.len == 0) {
+ goto invalid;
+ }
+
+ if (ngx_http_log_variable_compile(cf, op, &var) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+
} else {
i++;
- while (i < value[s].len && value[s].data[i] != '%') {
+ while (i < value[s].len
+ && value[s].data[i] != '$'
+ && value[s].data[i] != '%')
+ {
i++;
}
@@ -1178,11 +1240,24 @@ ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
}
- if (invalid) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid parameter \"%s\"", data);
- return NGX_CONF_ERROR;
- }
-
return NGX_CONF_OK;
+
+invalid:
+
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid parameter \"%s\"", data);
+
+ return NGX_CONF_ERROR;
+}
+
+
+static ngx_int_t
+ngx_http_log_init(ngx_cycle_t *cycle)
+{
+ ngx_http_core_main_conf_t *cmcf;
+
+ cmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module);
+
+ cmcf->log_handler = ngx_http_log_handler;
+
+ return NGX_OK;
}
diff --git a/src/http/ngx_http_log_module.h b/src/http/modules/ngx_http_log_module.h
similarity index 100%
rename from src/http/ngx_http_log_module.h
rename to src/http/modules/ngx_http_log_module.h
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c
index af82b0e8b..80de6910c 100644
--- a/src/http/modules/ngx_http_ssi_filter_module.c
+++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -229,9 +229,8 @@ ngx_module_t ngx_http_ssi_filter_module = {
};
-static ngx_int_t (*ngx_http_next_header_filter) (ngx_http_request_t *r);
-static ngx_int_t (*ngx_http_next_body_filter) (ngx_http_request_t *r,
- ngx_chain_t *in);
+static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
+static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
static u_char ngx_http_ssi_string[] = "