nginx-0.1.23-RELEASE import

*) Feature: the ngx_http_ssi_filter_module and the ssi,
       ssi_silent_errors, and ssi_min_file_chunk directives. The 'echo
       var="HTTP_..." default=""' and 'echo var="REMOTE_ADDR"' commands are
       supported.

    *) Feature: the %request_time log parameter.

    *) Feature: if the request has no the "Host" header line, then the
       "proxy_preserve_host" directive set this header line to the first
       server name of the "server_name" directive.

    *) Bugfix: nginx could not be built on platforms different from i386,
       amd64, sparc, and ppc; the bug had appeared in 0.1.22.

    *) Bugfix: the ngx_http_autoindex_module now shows the information not
       about the symlink, but about file or directory it points to.

    *) Bugfix: the %apache_length parameter logged the negative length of
       the response header if the no response was transferred to a client.
This commit is contained in:
Igor Sysoev 2005-03-01 15:20:36 +00:00
parent 2cc9388712
commit 11d753231b
16 changed files with 935 additions and 634 deletions

View File

@ -3,7 +3,7 @@
# gcc 2.7.2.3, 2.8.1, 2.95.4, # gcc 2.7.2.3, 2.8.1, 2.95.4,
# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4, 3.4.2 # 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
# Solaris 7's /usr/ccs/bin/as does not support "-pipe" # Solaris 7's /usr/ccs/bin/as does not support "-pipe"

View File

@ -48,7 +48,7 @@ NGX_HTTP_FASTCGI_TEMP_PATH=
HTTP_CHARSET=YES HTTP_CHARSET=YES
HTTP_GZIP=YES HTTP_GZIP=YES
HTTP_SSL=NO HTTP_SSL=NO
HTTP_SSI=NO HTTP_SSI=YES
HTTP_ACCESS=YES HTTP_ACCESS=YES
HTTP_USERID=YES HTTP_USERID=YES
HTTP_AUTOINDEX=YES HTTP_AUTOINDEX=YES

View File

@ -9,6 +9,81 @@
<title lang="en">nginx changelog</title> <title lang="en">nginx changelog</title>
<changes ver="0.1.23" date="01.03.2005">
<change type="feature">
<para lang="ru">
ÍÏÄÕÌØ ngx_http_ssi_filter_module É
ÄÉÒÅËÔÉ×Ù ssi, ssi_silent_errors É ssi_min_file_chunk.
ðÏÄÄÅÒÖÉ×ÁÀÔÓÑ ËÏÍÁÎÄÙ 'echo var="HTTP_..." default=""' É
'echo var="REMOTE_ADDR"'.
</para>
<para lang="en">
the ngx_http_ssi_filter_module and
the ssi, ssi_silent_errors, and ssi_min_file_chunk directives.
The 'echo var="HTTP_..." default=""' and 'echo var="REMOTE_ADDR"' commands
are supported.
</para>
</change>
<change type="feature">
<para lang="ru">
ÐÁÒÁÍÅÔÒ ÌÏÇÁ %request_time.
</para>
<para lang="en">
the %request_time log parameter.
</para>
</change>
<change type="feature">
<para lang="ru">
ÅÓÌÉ ÚÁÐÒÏÓ ÐÒÉÛ£Ì ÂÅÚ ÓÔÒÏËÉ ÚÁÇÏÌÏ×ËÁ "Host", ÔÏ ÄÉÒÅËÔÉ×Á
proxy_preserve_host ÕÓÔÁÎÁ×ÌÉ×ÁÅÔ × ËÁÞÅÓÔ×Å ÜÔÏÇÏ ÚÁÇÏÌÏ×ËÁ ÐÅÒ×ÏÅ ÉÍÑ
ÓÅÒ×ÅÒÁ ÉÚ ÄÉÒÅËÔÉ×Ù server_name.
</para>
<para lang="en">
if the request has no the "Host" header line, then the proxy_preserve_host
directive set this header line to the first server name of the server_name
directive.
</para>
</change>
<change type="bugfix">
<para lang="ru">
nginx ÎÅ ÓÏÂÉÒÁÌÓÑ ÎÁ ÐÌÁÔÆÏÒÍÁÈ, ÏÔÌÉÞÎÙÈ ÏÔ i386, amd64, sparc É ppc;
ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.1.22.
</para>
<para lang="en">
nginx could not be built on platforms different from i386, amd64, sparc É ppc;
bug appeared in 0.1.22.
</para>
</change>
<change type="bugfix">
<para lang="ru">
ÍÏÄÕÌØ ngx_http_autoindex_module ÔÅÐÅÒØ ÐÏËÁÚÙ×ÁÅÔ ÉÎÆÏÒÍÁÃÉÀ ÎÅ Ï
ÓÉÍ×ÏÌÉÞÅÓËÏÍ ÌÉÎËÅ, Á Ï ÆÁÊÌÅ ÉÌÉ ËÁÔÁÌÏÇÅ, ÎÁ ËÏÔÏÒÙÊ ÏÎ ÕËÁÚÙ×ÁÅÔ.
</para>
<para lang="en">
the ngx_http_autoindex_module now shows the information not about the symlink,
but about file or directory it points to.
</para>
</change>
<change type="bugfix">
<para lang="ru">
ÅÓÌÉ ËÌÉÅÎÔÕ ÎÉÞÅÇÏ ÎÅ ÐÅÒÅÄÁ×ÁÌÏÓØ, ÔÏ ÐÁÒÁÍÅÔÒ %apache_length
ÚÁÐÉÓÙ×ÁÌ × ÌÏÇ ÏÔÒÉÃÁÔÅÌØÎÕÀ ÄÌÉÎÕ ÚÁÇÏÌÏ×ËÁ ÏÔ×ÅÔÁ.
</para>
<para lang="en">
the %apache_length parameter logged the negative length
of the response header if the no response was transferred to a client.
</para>
</change>
</changes>
<changes ver="0.1.22" date="22.02.2005"> <changes ver="0.1.22" date="22.02.2005">
<change type="bugfix"> <change type="bugfix">
@ -19,7 +94,7 @@
</para> </para>
<para lang="en"> <para lang="en">
the ngx_http_stub_status_module showed incorrect handled connections the ngx_http_stub_status_module showed incorrect handled connections
statictics if the proxing or FastCGI server were used. statistics if the proxing or FastCGI server were used.
</para> </para>
</change> </change>
@ -29,7 +104,7 @@ statictics if the proxing or FastCGI server were used.
ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.1.21. ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.1.21.
</para> </para>
<para lang="en"> <para lang="en">
the installation pathes were incorrectly quoted on Linux and Solaris; the installation paths were incorrectly quoted on Linux and Solaris;
bug appeared in 0.1.21. bug appeared in 0.1.21.
</para> </para>
</change> </change>
@ -46,7 +121,7 @@ bug appeared in 0.1.21.
ÒÁÂÏÞÉÈ ÐÒÏÃÅÓÓÏ× ÎÁ SMP ÍÁÛÉÎÅ. ÒÁÂÏÞÉÈ ÐÒÏÃÅÓÓÏ× ÎÁ SMP ÍÁÛÉÎÅ.
</para> </para>
<para lang="en"> <para lang="en">
the ngx_http_stub_status_module showed incorrect statictics the ngx_http_stub_status_module showed incorrect statistics
if "rtsig" method was used or if several worker process ran on SMP. if "rtsig" method was used or if several worker process ran on SMP.
</para> </para>
</change> </change>
@ -82,7 +157,7 @@ nginx could not be built on NetBSD 2.0.
</para> </para>
<para lang="en"> <para lang="en">
the new "script_filename" and "remote_port" parameters the new "script_filename" and "remote_port" parameters
ofthe fastcgi_params directive. of the fastcgi_params directive.
</para> </para>
</change> </change>
@ -91,7 +166,7 @@ ofthe fastcgi_params directive.
ÎÅÐÒÁ×ÉÌØÎÏ ÏÂÒÁÂÁÔÙ×ÁÌÓÑ ÐÏÔÏË stderr ÏÔ FastCGI-ÓÅÒ×ÅÒÁ. ÎÅÐÒÁ×ÉÌØÎÏ ÏÂÒÁÂÁÔÙ×ÁÌÓÑ ÐÏÔÏË stderr ÏÔ FastCGI-ÓÅÒ×ÅÒÁ.
</para> </para>
<para lang="en"> <para lang="en">
the FastCGI stderr stream was handled incorreÓtly. the FastCGI stderr stream was handled incorrectly.
</para> </para>
</change> </change>
@ -420,7 +495,7 @@ segmentation fault.
×ÙÄÅÌÅÎÎÙÈ ÞÁÓÔÅÊ ÎÅ ÓÏ×ÐÁÄÁÅÔ Ó ÞÉÓÌÏÍ ÐÏÄÓÔÁÎÏ×ÏË. ×ÙÄÅÌÅÎÎÙÈ ÞÁÓÔÅÊ ÎÅ ÓÏ×ÐÁÄÁÅÔ Ó ÞÉÓÌÏÍ ÐÏÄÓÔÁÎÏ×ÏË.
</para> </para>
<para lang="en"> <para lang="en">
the correct handling of the regular exporession, that the correct handling of the regular expression, that
has different number of the captures and substitutions. has different number of the captures and substitutions.
</para> </para>
</change> </change>
@ -432,7 +507,7 @@ location,
</para> </para>
<para lang="en"> <para lang="en">
the location, that is passed to the FastCGI server, can be the location, that is passed to the FastCGI server, can be
regualar expression. regular expression.
</para> </para>
</change> </change>
@ -480,9 +555,9 @@ bug appeared in 0.1.14.
ÔÏ ÐÒÏÉÓÈÏÄÉÌ segmentation fault. ÔÏ ÐÒÏÉÓÈÏÄÉÌ segmentation fault.
</para> </para>
<para lang="en"> <para lang="en">
the same pathes in autoconfiguration paramters the same paths in autoconfiguration parameters
--http-client-body-temp-path=PATH and --http-proxy-temp-path=PATH, --http-client-body-temp-path=PATH and --http-proxy-temp-path=PATH,
or --http-client-body-temp-path=PATH nad --http-fastcgi-temp-path=PATH or --http-client-body-temp-path=PATH and --http-fastcgi-temp-path=PATH
caused segmentation fault. caused segmentation fault.
</para> </para>
</change> </change>
@ -783,7 +858,7 @@ method was used.
Á×ÔÏÍÁÔÉÞÅÓËÏÅ ÏÐÒÅÄÅÌÅÎÉÅ ÇÒÕÐÐ nobody É nogroup. Á×ÔÏÍÁÔÉÞÅÓËÏÅ ÏÐÒÅÄÅÌÅÎÉÅ ÇÒÕÐÐ nobody É nogroup.
</para> </para>
<para lang="en"> <para lang="en">
the autodetection of the nobody and nogroup groups. the autodetection of the "nobody" and "nogroup" groups.
</para> </para>
</change> </change>
@ -960,7 +1035,7 @@ bug appeared in 0.1.5.
ÉÓÐÏÌØÚÏ×ÁÌÁÓØ ËÏÎÆÉÇÕÒÁÃÉÑ ÎÅ ÉÚ ÔÏÇÏ location. ÉÓÐÏÌØÚÏ×ÁÌÁÓØ ËÏÎÆÉÇÕÒÁÃÉÑ ÎÅ ÉÚ ÔÏÇÏ location.
</para> </para>
<para lang="en"> <para lang="en">
some location directive combiations with the regular expressions caused some location directive combinations with the regular expressions caused
the wrong configuration choose. the wrong configuration choose.
</para> </para>
</change> </change>

View File

@ -8,7 +8,7 @@
#define _NGINX_H_INCLUDED_ #define _NGINX_H_INCLUDED_
#define NGINX_VER "nginx/0.1.22" #define NGINX_VER "nginx/0.1.23"
#define NGINX_VAR "NGINX" #define NGINX_VAR "NGINX"
#define NGX_NEWPID_EXT ".newbin" #define NGX_NEWPID_EXT ".newbin"

View File

@ -7,7 +7,6 @@
#include <ngx_config.h> #include <ngx_config.h>
#include <ngx_core.h> #include <ngx_core.h>
#include <ngx_event.h> #include <ngx_event.h>
#include <nginx.h>
void ngx_event_acceptex(ngx_event_t *rev) void ngx_event_acceptex(ngx_event_t *rev)

View File

@ -241,7 +241,7 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r)
if (len == 2 if (len == 2
&& ngx_de_name(&dir)[0] == '.' && ngx_de_name(&dir)[0] == '.'
&& ngx_de_name(&dir)[0] == '.') && ngx_de_name(&dir)[1] == '.')
{ {
continue; continue;
} }
@ -263,9 +263,20 @@ static ngx_int_t ngx_http_autoindex_handler(ngx_http_request_t *r)
ngx_cpystrn(last, ngx_de_name(&dir), len + 1); ngx_cpystrn(last, ngx_de_name(&dir), len + 1);
if (ngx_de_info(fname.data, &dir) == NGX_FILE_ERROR) { if (ngx_de_info(fname.data, &dir) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, err = ngx_errno;
ngx_de_info_n " \"%s\" failed", fname.data);
return ngx_http_autoindex_error(r, &dir, dname.data); if (err != NGX_ENOENT) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, err,
ngx_de_info_n " \"%s\" failed", fname.data);
return ngx_http_autoindex_error(r, &dir, dname.data);
}
if (ngx_de_link_info(fname.data, &dir) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
ngx_de_link_info_n " \"%s\" failed",
fname.data);
return ngx_http_autoindex_error(r, &dir, dname.data);
}
} }
} }

View File

@ -76,23 +76,23 @@ typedef struct {
static ngx_int_t ngx_http_gzip_proxied(ngx_http_request_t *r, static ngx_int_t ngx_http_gzip_proxied(ngx_http_request_t *r,
ngx_http_gzip_conf_t *conf); ngx_http_gzip_conf_t *conf);
static void *ngx_http_gzip_filter_alloc(void *opaque, u_int items, static void *ngx_http_gzip_filter_alloc(void *opaque, u_int items,
u_int size); u_int size);
static void ngx_http_gzip_filter_free(void *opaque, void *address); static void ngx_http_gzip_filter_free(void *opaque, void *address);
static void ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx); static void ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx);
static u_char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static ngx_int_t ngx_http_gzip_add_log_formats(ngx_conf_t *cf); static ngx_int_t ngx_http_gzip_add_log_formats(ngx_conf_t *cf);
static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle); static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle);
static void *ngx_http_gzip_create_conf(ngx_conf_t *cf); static void *ngx_http_gzip_create_conf(ngx_conf_t *cf);
static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf, static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
void *parent, void *child); void *parent, void *child);
static char *ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf); void *conf);
static char *ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data); static char *ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data);
static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data); static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data);
@ -261,7 +261,8 @@ 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 ngx_http_output_body_filter_pt ngx_http_next_body_filter;
static ngx_int_t ngx_http_gzip_header_filter(ngx_http_request_t *r) static ngx_int_t
ngx_http_gzip_header_filter(ngx_http_request_t *r)
{ {
ngx_uint_t i, found; ngx_uint_t i, found;
ngx_http_gzip_ctx_t *ctx; ngx_http_gzip_ctx_t *ctx;
@ -357,8 +358,8 @@ static ngx_int_t ngx_http_gzip_header_filter(ngx_http_request_t *r)
} }
static ngx_int_t ngx_http_gzip_proxied(ngx_http_request_t *r, static ngx_int_t
ngx_http_gzip_conf_t *conf) ngx_http_gzip_proxied(ngx_http_request_t *r, ngx_http_gzip_conf_t *conf)
{ {
time_t date, expires; time_t date, expires;
@ -437,8 +438,8 @@ static ngx_int_t ngx_http_gzip_proxied(ngx_http_request_t *r,
} }
static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r, static ngx_int_t
ngx_chain_t *in) ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{ {
int rc, wbits, memlevel; int rc, wbits, memlevel;
ngx_int_t last; ngx_int_t last;
@ -825,7 +826,8 @@ static ngx_int_t ngx_http_gzip_body_filter(ngx_http_request_t *r,
} }
static void *ngx_http_gzip_filter_alloc(void *opaque, u_int items, u_int size) static void *
ngx_http_gzip_filter_alloc(void *opaque, u_int items, u_int size)
{ {
ngx_http_gzip_ctx_t *ctx = opaque; ngx_http_gzip_ctx_t *ctx = opaque;
@ -866,7 +868,8 @@ static void *ngx_http_gzip_filter_alloc(void *opaque, u_int items, u_int size)
} }
static void ngx_http_gzip_filter_free(void *opaque, void *address) static void
ngx_http_gzip_filter_free(void *opaque, void *address)
{ {
#if 0 #if 0
ngx_http_gzip_ctx_t *ctx = opaque; ngx_http_gzip_ctx_t *ctx = opaque;
@ -877,8 +880,9 @@ static void ngx_http_gzip_filter_free(void *opaque, void *address)
} }
static u_char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_gzip_log_ratio(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
ngx_uint_t zint, zfrac; ngx_uint_t zint, zfrac;
ngx_http_gzip_ctx_t *ctx; ngx_http_gzip_ctx_t *ctx;
@ -909,7 +913,8 @@ static u_char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, u_char *buf,
} }
static void ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx) static void
ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx)
{ {
deflateEnd(&ctx->zstream); deflateEnd(&ctx->zstream);
@ -926,7 +931,8 @@ static void ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx)
} }
static ngx_int_t ngx_http_gzip_add_log_formats(ngx_conf_t *cf) static ngx_int_t
ngx_http_gzip_add_log_formats(ngx_conf_t *cf)
{ {
ngx_http_log_op_name_t *op; ngx_http_log_op_name_t *op;
@ -945,7 +951,8 @@ static ngx_int_t ngx_http_gzip_add_log_formats(ngx_conf_t *cf)
} }
static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle) static ngx_int_t
ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
{ {
ngx_http_next_header_filter = ngx_http_top_header_filter; ngx_http_next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_gzip_header_filter; ngx_http_top_header_filter = ngx_http_gzip_header_filter;
@ -957,7 +964,8 @@ static ngx_int_t ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
} }
static void *ngx_http_gzip_create_conf(ngx_conf_t *cf) static void *
ngx_http_gzip_create_conf(ngx_conf_t *cf)
{ {
ngx_http_gzip_conf_t *conf; ngx_http_gzip_conf_t *conf;
@ -987,8 +995,8 @@ static void *ngx_http_gzip_create_conf(ngx_conf_t *cf)
} }
static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf, static char *
void *parent, void *child) ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{ {
ngx_http_gzip_conf_t *prev = parent; ngx_http_gzip_conf_t *prev = parent;
ngx_http_gzip_conf_t *conf = child; ngx_http_gzip_conf_t *conf = child;
@ -1000,10 +1008,9 @@ static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 4, ngx_pagesize); ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 4, ngx_pagesize);
ngx_conf_merge_unsigned_value(conf->http_version, prev->http_version, ngx_conf_merge_unsigned_value(conf->http_version, prev->http_version,
NGX_HTTP_VERSION_11); NGX_HTTP_VERSION_11);
ngx_conf_merge_bitmask_value(conf->proxied, prev->proxied, ngx_conf_merge_bitmask_value(conf->proxied, prev->proxied,
(NGX_CONF_BITMASK_SET (NGX_CONF_BITMASK_SET|NGX_HTTP_GZIP_PROXIED_OFF));
|NGX_HTTP_GZIP_PROXIED_OFF));
ngx_conf_merge_value(conf->level, prev->level, 1); ngx_conf_merge_value(conf->level, prev->level, 1);
ngx_conf_merge_size_value(conf->wbits, prev->wbits, MAX_WBITS); ngx_conf_merge_size_value(conf->wbits, prev->wbits, MAX_WBITS);
@ -1037,8 +1044,8 @@ static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
} }
static char *ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, static char *
void *conf) ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ {
ngx_http_gzip_conf_t *gcf = conf; ngx_http_gzip_conf_t *gcf = conf;
@ -1047,7 +1054,7 @@ static char *ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd,
ngx_http_gzip_type_t *type; ngx_http_gzip_type_t *type;
if (gcf->types == NULL) { if (gcf->types == NULL) {
gcf->types = ngx_array_create(cf->pool, 5, gcf->types = ngx_array_create(cf->pool, 4,
sizeof(ngx_http_gzip_type_t)); sizeof(ngx_http_gzip_type_t));
if (gcf->types == NULL) { if (gcf->types == NULL) {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
@ -1087,7 +1094,8 @@ static char *ngx_http_gzip_set_types(ngx_conf_t *cf, ngx_command_t *cmd,
} }
static char *ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data) static char *
ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data)
{ {
int *np = data; int *np = data;
@ -1110,7 +1118,8 @@ static char *ngx_http_gzip_set_window(ngx_conf_t *cf, void *post, void *data)
} }
static char *ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data) static char *
ngx_http_gzip_set_hash(ngx_conf_t *cf, void *post, void *data)
{ {
int *np = data; int *np = data;

File diff suppressed because it is too large Load Diff

View File

@ -145,10 +145,18 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p)
} }
if (p->lcf->preserve_host && r->headers_in.host) { if (p->lcf->preserve_host) {
len += sizeof(host_header) - 1 if (r->headers_in.host) {
+ r->headers_in.host_name_len + sizeof(":") - 1 + uc->port_text.len len += sizeof(host_header) - 1
+ sizeof(CRLF) - 1; + r->headers_in.host_name_len + sizeof(":") - 1
+ uc->port_text.len + sizeof(CRLF) - 1;
} else {
len += sizeof(host_header) - 1
+ r->server_name.len + sizeof(":") - 1
+ uc->port_text.len + sizeof(CRLF) - 1;
}
} else { } else {
len += sizeof(host_header) - 1 + uc->host_header.len len += sizeof(host_header) - 1 + uc->host_header.len
+ sizeof(CRLF) - 1; + sizeof(CRLF) - 1;
@ -278,9 +286,14 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p)
b->last = ngx_cpymem(b->last, host_header, sizeof(host_header) - 1); b->last = ngx_cpymem(b->last, host_header, sizeof(host_header) - 1);
if (p->lcf->preserve_host && r->headers_in.host) { if (p->lcf->preserve_host) {
b->last = ngx_cpymem(b->last, r->headers_in.host->value.data, if (r->headers_in.host) {
r->headers_in.host_name_len); b->last = ngx_cpymem(b->last, r->headers_in.host->value.data,
r->headers_in.host_name_len);
} else {
b->last = ngx_cpymem(b->last, r->server_name.data,
r->server_name.len);
}
if (!uc->default_port) { if (!uc->default_port) {
*b->last++ = ':'; *b->last++ = ':';

View File

@ -11,93 +11,91 @@
static u_char *ngx_http_log_addr(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_addr(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op);
static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static size_t ngx_http_log_request_getlen(ngx_http_request_t *r, static size_t ngx_http_log_request_getlen(ngx_http_request_t *r,
uintptr_t data); uintptr_t data);
static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static ngx_int_t ngx_http_log_header_in_compile(ngx_http_log_op_t *op, static ngx_int_t ngx_http_log_header_in_compile(ngx_http_log_op_t *op,
ngx_str_t *value); ngx_str_t *value);
static size_t ngx_http_log_header_in_getlen(ngx_http_request_t *r, static size_t ngx_http_log_header_in_getlen(ngx_http_request_t *r,
uintptr_t data); uintptr_t data);
static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static size_t ngx_http_log_unknown_header_in_getlen(ngx_http_request_t *r, static size_t ngx_http_log_unknown_header_in_getlen(ngx_http_request_t *r,
uintptr_t data); uintptr_t data);
static u_char *ngx_http_log_unknown_header_in(ngx_http_request_t *r, static u_char *ngx_http_log_unknown_header_in(ngx_http_request_t *r,
u_char *buf, u_char *buf, ngx_http_log_op_t *op);
ngx_http_log_op_t *op);
static ngx_int_t ngx_http_log_header_out_compile(ngx_http_log_op_t *op, static ngx_int_t ngx_http_log_header_out_compile(ngx_http_log_op_t *op,
ngx_str_t *value); ngx_str_t *value);
static size_t ngx_http_log_header_out_getlen(ngx_http_request_t *r, static size_t ngx_http_log_header_out_getlen(ngx_http_request_t *r,
uintptr_t data); uintptr_t data);
static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf, static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op); ngx_http_log_op_t *op);
static size_t ngx_http_log_unknown_header_out_getlen(ngx_http_request_t *r, static size_t ngx_http_log_unknown_header_out_getlen(ngx_http_request_t *r,
uintptr_t data); uintptr_t data);
static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r,
u_char *buf, u_char *buf, ngx_http_log_op_t *op);
ngx_http_log_op_t *op);
static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r, static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
u_char *buf, u_char *buf, ngx_http_log_op_t *op);
ngx_http_log_op_t *op);
static u_char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r, static u_char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r,
u_char *buf, u_char *buf, ngx_http_log_op_t *op);
ngx_http_log_op_t *op);
static ngx_table_elt_t *ngx_http_log_unknown_header(ngx_list_t *headers, static ngx_table_elt_t *ngx_http_log_unknown_header(ngx_list_t *headers,
ngx_str_t *value); ngx_str_t *value);
static ngx_int_t ngx_http_log_set_formats(ngx_conf_t *cf); static ngx_int_t ngx_http_log_set_formats(ngx_conf_t *cf);
static void *ngx_http_log_create_main_conf(ngx_conf_t *cf); static void *ngx_http_log_create_main_conf(ngx_conf_t *cf);
static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf); static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent,
void *child); void *child);
static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf); void *conf);
static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf); void *conf);
static ngx_int_t ngx_http_log_parse_format(ngx_conf_t *cf, ngx_array_t *ops, static ngx_int_t ngx_http_log_parse_format(ngx_conf_t *cf, ngx_array_t *ops,
ngx_str_t *line); ngx_str_t *line);
static ngx_command_t ngx_http_log_commands[] = { static ngx_command_t ngx_http_log_commands[] = {
{ngx_string("log_format"), { ngx_string("log_format"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_2MORE, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_2MORE,
ngx_http_log_set_format, ngx_http_log_set_format,
NGX_HTTP_MAIN_CONF_OFFSET, NGX_HTTP_MAIN_CONF_OFFSET,
0, 0,
NULL}, NULL },
{ngx_string("access_log"), { ngx_string("access_log"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
ngx_http_log_set_log, ngx_http_log_set_log,
NGX_HTTP_LOC_CONF_OFFSET, NGX_HTTP_LOC_CONF_OFFSET,
0, 0,
NULL}, NULL },
ngx_null_command ngx_null_command
}; };
@ -141,6 +139,8 @@ ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
{ ngx_string("time"), sizeof("28/Sep/1970:12:00:00 +0600") - 1, { ngx_string("time"), sizeof("28/Sep/1970:12:00:00 +0600") - 1,
NULL, NULL, ngx_http_log_time }, NULL, NULL, ngx_http_log_time },
{ ngx_string("msec"), NGX_TIME_T_LEN + 4, NULL, NULL, ngx_http_log_msec }, { ngx_string("msec"), NGX_TIME_T_LEN + 4, NULL, NULL, ngx_http_log_msec },
{ ngx_string("request_time"), NGX_TIME_T_LEN, NULL, NULL,
ngx_http_log_request_time },
{ ngx_string("status"), 3, NULL, NULL, ngx_http_log_status }, { ngx_string("status"), 3, NULL, NULL, ngx_http_log_status },
{ ngx_string("length"), NGX_OFF_T_LEN, NULL, NULL, ngx_http_log_length }, { ngx_string("length"), NGX_OFF_T_LEN, NULL, NULL, ngx_http_log_length },
{ ngx_string("apache_length"), NGX_OFF_T_LEN, { ngx_string("apache_length"), NGX_OFF_T_LEN,
@ -164,7 +164,8 @@ ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
}; };
ngx_int_t ngx_http_log_handler(ngx_http_request_t *r) ngx_int_t
ngx_http_log_handler(ngx_http_request_t *r)
{ {
ngx_uint_t i, l; ngx_uint_t i, l;
u_char *line, *p; u_char *line, *p;
@ -228,8 +229,9 @@ ngx_int_t ngx_http_log_handler(ngx_http_request_t *r)
} }
static u_char *ngx_http_log_copy_short(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_copy_short(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
size_t len; size_t len;
uintptr_t data; uintptr_t data;
@ -246,30 +248,32 @@ static u_char *ngx_http_log_copy_short(ngx_http_request_t *r, u_char *buf,
} }
static u_char *ngx_http_log_copy_long(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_copy_long(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
return ngx_cpymem(buf, (u_char *) op->data, op->len); return ngx_cpymem(buf, (u_char *) op->data, op->len);
} }
static u_char *ngx_http_log_addr(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_addr(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ {
return ngx_cpymem(buf, r->connection->addr_text.data, return ngx_cpymem(buf, r->connection->addr_text.data,
r->connection->addr_text.len); r->connection->addr_text.len);
} }
static u_char *ngx_http_log_connection(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_connection(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
return ngx_sprintf(buf, "%ui", r->connection->number); return ngx_sprintf(buf, "%ui", r->connection->number);
} }
static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ {
if (r->pipeline) { if (r->pipeline) {
*buf = 'p'; *buf = 'p';
@ -281,16 +285,16 @@ static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
} }
static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_time(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ {
return ngx_cpymem(buf, ngx_cached_http_log_time.data, return ngx_cpymem(buf, ngx_cached_http_log_time.data,
ngx_cached_http_log_time.len); ngx_cached_http_log_time.len);
} }
static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_msec(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ {
struct timeval tv; struct timeval tv;
@ -300,51 +304,75 @@ static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf,
} }
static size_t ngx_http_log_request_getlen(ngx_http_request_t *r, static u_char *
uintptr_t data) ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{
time_t elapsed;
elapsed = ngx_time() - r->start_time;
return ngx_sprintf(buf, "%T", elapsed);
}
static size_t
ngx_http_log_request_getlen(ngx_http_request_t *r, uintptr_t data)
{ {
return r->request_line.len; return r->request_line.len;
} }
static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_request(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ {
return ngx_cpymem(buf, r->request_line.data, r->request_line.len); return ngx_cpymem(buf, r->request_line.data, r->request_line.len);
} }
static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_status(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ {
return ngx_sprintf(buf, "%ui", return ngx_sprintf(buf, "%ui",
r->err_status ? r->err_status : r->headers_out.status); r->err_status ? r->err_status : r->headers_out.status);
} }
static u_char *ngx_http_log_length(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_length(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op)
{ {
return ngx_sprintf(buf, "%O", r->connection->sent); return ngx_sprintf(buf, "%O", r->connection->sent);
} }
static u_char *ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_apache_length(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
return ngx_sprintf(buf, "%O", r->connection->sent - r->header_size); off_t length;
length = r->connection->sent - r->header_size;
if (length > 0) {
return ngx_sprintf(buf, "%O", length);
}
*buf = '0';
return buf + 1;
} }
static u_char *ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_request_length(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
return ngx_sprintf(buf, "%z", r->request_length); return ngx_sprintf(buf, "%z", r->request_length);
} }
static ngx_int_t ngx_http_log_header_in_compile(ngx_http_log_op_t *op, static ngx_int_t
ngx_str_t *value) ngx_http_log_header_in_compile(ngx_http_log_op_t *op, ngx_str_t *value)
{ {
ngx_uint_t i; ngx_uint_t i;
@ -375,8 +403,8 @@ static ngx_int_t ngx_http_log_header_in_compile(ngx_http_log_op_t *op,
} }
static size_t ngx_http_log_header_in_getlen(ngx_http_request_t *r, static size_t
uintptr_t data) ngx_http_log_header_in_getlen(ngx_http_request_t *r, uintptr_t data)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -390,8 +418,9 @@ static size_t ngx_http_log_header_in_getlen(ngx_http_request_t *r,
} }
static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -407,8 +436,8 @@ static u_char *ngx_http_log_header_in(ngx_http_request_t *r, u_char *buf,
} }
static size_t ngx_http_log_unknown_header_in_getlen(ngx_http_request_t *r, static size_t
uintptr_t data) ngx_http_log_unknown_header_in_getlen(ngx_http_request_t *r, uintptr_t data)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -422,9 +451,9 @@ static size_t ngx_http_log_unknown_header_in_getlen(ngx_http_request_t *r,
} }
static u_char *ngx_http_log_unknown_header_in(ngx_http_request_t *r, static u_char *
u_char *buf, ngx_http_log_unknown_header_in(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op) ngx_http_log_op_t *op)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -441,8 +470,8 @@ static u_char *ngx_http_log_unknown_header_in(ngx_http_request_t *r,
} }
static ngx_int_t ngx_http_log_header_out_compile(ngx_http_log_op_t *op, static ngx_int_t
ngx_str_t *value) ngx_http_log_header_out_compile(ngx_http_log_op_t *op, ngx_str_t *value)
{ {
ngx_uint_t i; ngx_uint_t i;
@ -455,7 +484,7 @@ static ngx_int_t ngx_http_log_header_out_compile(ngx_http_log_op_t *op,
} }
if (ngx_strncasecmp(ngx_http_headers_out[i].name.data, value->data, if (ngx_strncasecmp(ngx_http_headers_out[i].name.data, value->data,
value->len) == 0) value->len) == 0)
{ {
op->getlen = ngx_http_log_header_out_getlen; op->getlen = ngx_http_log_header_out_getlen;
op->run = ngx_http_log_header_out; op->run = ngx_http_log_header_out;
@ -493,8 +522,8 @@ static ngx_int_t ngx_http_log_header_out_compile(ngx_http_log_op_t *op,
} }
static size_t ngx_http_log_header_out_getlen(ngx_http_request_t *r, static size_t
uintptr_t data) ngx_http_log_header_out_getlen(ngx_http_request_t *r, uintptr_t data)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -540,8 +569,9 @@ static size_t ngx_http_log_header_out_getlen(ngx_http_request_t *r,
} }
static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf, static u_char *
ngx_http_log_op_t *op) ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -594,8 +624,8 @@ static u_char *ngx_http_log_header_out(ngx_http_request_t *r, u_char *buf,
} }
static size_t ngx_http_log_unknown_header_out_getlen(ngx_http_request_t *r, static size_t
uintptr_t data) ngx_http_log_unknown_header_out_getlen(ngx_http_request_t *r, uintptr_t data)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -610,9 +640,9 @@ static size_t ngx_http_log_unknown_header_out_getlen(ngx_http_request_t *r,
} }
static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, static u_char *
u_char *buf, ngx_http_log_unknown_header_out(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op) ngx_http_log_op_t *op)
{ {
ngx_table_elt_t *h; ngx_table_elt_t *h;
@ -629,8 +659,8 @@ static u_char *ngx_http_log_unknown_header_out(ngx_http_request_t *r,
} }
static ngx_table_elt_t *ngx_http_log_unknown_header(ngx_list_t *headers, static ngx_table_elt_t *
ngx_str_t *value) ngx_http_log_unknown_header(ngx_list_t *headers, ngx_str_t *value)
{ {
ngx_uint_t i; ngx_uint_t i;
ngx_list_part_t *part; ngx_list_part_t *part;
@ -664,9 +694,9 @@ static ngx_table_elt_t *ngx_http_log_unknown_header(ngx_list_t *headers,
} }
static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r, static u_char *
u_char *buf, ngx_http_log_connection_header_out(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op) ngx_http_log_op_t *op)
{ {
if (r->keepalive) { if (r->keepalive) {
return ngx_cpymem(buf, "keep-alive", sizeof("keep-alive") - 1); return ngx_cpymem(buf, "keep-alive", sizeof("keep-alive") - 1);
@ -677,9 +707,9 @@ static u_char *ngx_http_log_connection_header_out(ngx_http_request_t *r,
} }
static u_char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r, static u_char *
u_char *buf, ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op) ngx_http_log_op_t *op)
{ {
if (r->chunked) { if (r->chunked) {
return ngx_cpymem(buf, "chunked", sizeof("chunked") - 1); return ngx_cpymem(buf, "chunked", sizeof("chunked") - 1);
@ -691,7 +721,8 @@ static u_char *ngx_http_log_transfer_encoding_header_out(ngx_http_request_t *r,
} }
static ngx_int_t ngx_http_log_set_formats(ngx_conf_t *cf) static ngx_int_t
ngx_http_log_set_formats(ngx_conf_t *cf)
{ {
ngx_http_log_op_name_t *op; ngx_http_log_op_name_t *op;
@ -702,7 +733,8 @@ static ngx_int_t ngx_http_log_set_formats(ngx_conf_t *cf)
} }
static void *ngx_http_log_create_main_conf(ngx_conf_t *cf) static void *
ngx_http_log_create_main_conf(ngx_conf_t *cf)
{ {
ngx_http_log_main_conf_t *conf; ngx_http_log_main_conf_t *conf;
@ -713,23 +745,26 @@ static void *ngx_http_log_create_main_conf(ngx_conf_t *cf)
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
ngx_init_array(conf->formats, cf->pool, 5, sizeof(ngx_http_log_fmt_t), if (ngx_array_init(&conf->formats, cf->pool, 4, sizeof(ngx_http_log_fmt_t))
NGX_CONF_ERROR); == NGX_ERROR)
{
cf->args->nelts = 0;
if (!(value = ngx_push_array(cf->args))) {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
if (!(value = ngx_push_array(cf->args))) { cf->args->nelts = 0;
if (!(value = ngx_array_push(cf->args))) {
return NGX_CONF_ERROR;
}
if (!(value = ngx_array_push(cf->args))) {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
value->len = sizeof("combined") - 1; value->len = sizeof("combined") - 1;
value->data = (u_char *) "combined"; value->data = (u_char *) "combined";
if (!(value = ngx_push_array(cf->args))) { if (!(value = ngx_array_push(cf->args))) {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }
@ -744,7 +779,8 @@ static void *ngx_http_log_create_main_conf(ngx_conf_t *cf)
} }
static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf) static void *
ngx_http_log_create_loc_conf(ngx_conf_t *cf)
{ {
ngx_http_log_loc_conf_t *conf; ngx_http_log_loc_conf_t *conf;
@ -756,8 +792,8 @@ static void *ngx_http_log_create_loc_conf(ngx_conf_t *cf)
} }
static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, static char *
void *child) ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{ {
ngx_http_log_loc_conf_t *prev = parent; ngx_http_log_loc_conf_t *prev = parent;
ngx_http_log_loc_conf_t *conf = child; ngx_http_log_loc_conf_t *conf = child;
@ -808,8 +844,8 @@ static char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent,
} }
static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, static char *
void *conf) ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ {
ngx_http_log_loc_conf_t *llcf = conf; ngx_http_log_loc_conf_t *llcf = conf;
@ -867,8 +903,8 @@ static char *ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd,
} }
static char *ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, static char *
void *conf) ngx_http_log_set_format(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{ {
ngx_http_log_main_conf_t *lmcf = conf; ngx_http_log_main_conf_t *lmcf = conf;

View File

@ -422,6 +422,8 @@ static void ngx_http_init_request(ngx_event_t *rev)
c->single_connection = 1; c->single_connection = 1;
r->connection = c; r->connection = c;
r->start_time = ngx_time();
r->file.fd = NGX_INVALID_FILE; r->file.fd = NGX_INVALID_FILE;
r->headers_in.content_length_n = -1; r->headers_in.content_length_n = -1;

View File

@ -275,7 +275,8 @@ struct ngx_http_request_s {
ngx_http_request_body_t *request_body; ngx_http_request_body_t *request_body;
time_t lingering_time; time_t lingering_time;
time_t start_time;
ngx_uint_t method; ngx_uint_t method;
ngx_uint_t http_version; ngx_uint_t http_version;

View File

@ -388,6 +388,7 @@ ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
typedef int32_t ngx_atomic_int_t; typedef int32_t ngx_atomic_int_t;
typedef uint32_t ngx_atomic_uint_t; typedef uint32_t ngx_atomic_uint_t;
typedef volatile ngx_atomic_uint_t ngx_atomic_t; typedef volatile ngx_atomic_uint_t ngx_atomic_t;
#define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1
#define ngx_atomic_inc(x) ++(*(x)) #define ngx_atomic_inc(x) ++(*(x))
#define ngx_atomic_dec(x) --(*(x)) #define ngx_atomic_dec(x) --(*(x))

View File

@ -18,7 +18,7 @@
#define ngx_open_file(name, access, create) \ #define ngx_open_file(name, access, create) \
open((const char *) name, access|create, 0644) open((const char *) name, access|create, 0644)
#define ngx_open_file_n "open()" #define ngx_open_file_n "open()"
#define NGX_FILE_RDONLY O_RDONLY #define NGX_FILE_RDONLY O_RDONLY
@ -46,10 +46,10 @@ ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset);
ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size,
off_t offset); off_t offset);
ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce, ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce,
off_t offset, ngx_pool_t *pool); off_t offset, ngx_pool_t *pool);
#define ngx_rename_file rename #define ngx_rename_file rename
@ -86,7 +86,7 @@ ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
#define ngx_read_dir(d) \ #define ngx_read_dir(d) \
(((d)->de = readdir((d)->dir)) ? NGX_OK : NGX_ERROR) (((d)->de = readdir((d)->dir)) ? NGX_OK : NGX_ERROR)
#define ngx_read_dir_n "readdir()" #define ngx_read_dir_n "readdir()"
@ -104,10 +104,13 @@ ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir);
#else #else
#define ngx_de_namelen(dir) ngx_strlen((dir)->de->d_name) #define ngx_de_namelen(dir) ngx_strlen((dir)->de->d_name)
#endif #endif
#define ngx_de_info(name, dir) lstat((const char *) name, &(dir)->info) #define ngx_de_info(name, dir) stat((const char *) name, &(dir)->info)
#define ngx_de_info_n "stat()" #define ngx_de_info_n "stat()"
#define ngx_de_link_info(name, dir) lstat((const char *) name, &(dir)->info)
#define ngx_de_link_info_n "lstat()"
#define ngx_de_is_dir(dir) (S_ISDIR((dir)->info.st_mode)) #define ngx_de_is_dir(dir) (S_ISDIR((dir)->info.st_mode))
#define ngx_de_is_file(dir) (S_ISREG((dir)->info.st_mode)) #define ngx_de_is_file(dir) (S_ISREG((dir)->info.st_mode))
#define ngx_de_is_link(dir) (S_ISLNK((dir)->info.st_mode))
#define ngx_de_size(dir) (dir)->info.st_size #define ngx_de_size(dir) (dir)->info.st_size
#define ngx_de_mtime(dir) (dir)->info.st_mtime #define ngx_de_mtime(dir) (dir)->info.st_mtime

View File

@ -14,8 +14,9 @@
#define NGX_HAVE_ATOMIC_OPS 1 #define NGX_HAVE_ATOMIC_OPS 1
typedef uint32_t ngx_atomic_int_t; typedef int32_t ngx_atomic_int_t;
typedef volatile ngx_atomic_int_t ngx_atomic_t; typedef uint32_t ngx_atomic_uint_t;
typedef volatile ngx_atomic_uint_t ngx_atomic_t;
#define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1 #define NGX_ATOMIC_T_LEN sizeof("-2147483648") - 1

View File

@ -29,11 +29,11 @@
#define ngx_open_file(name, access, create) \ #define ngx_open_file(name, access, create) \
CreateFile((const char *) name, access, \ CreateFile((const char *) name, access, \
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \
NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL) NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL)
/* /*
NULL, OPEN_EXISTING, 0, NULL) NULL, OPEN_EXISTING, 0, NULL)
*/ */
#define ngx_open_file_n "CreateFile()" #define ngx_open_file_n "CreateFile()"
@ -49,14 +49,14 @@ ngx_int_t ngx_file_append_mode(ngx_fd_t fd);
#define ngx_open_tempfile(name, persistent) \ #define ngx_open_tempfile(name, persistent) \
CreateFile((const char *) name, \ CreateFile((const char *) name, \
GENERIC_READ|GENERIC_WRITE, \ GENERIC_READ|GENERIC_WRITE, \
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \
NULL, \ NULL, \
CREATE_NEW, \ CREATE_NEW, \
persistent ? 0: \ persistent ? 0: \
FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, \ FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, \
NULL); NULL);
#define ngx_open_tempfile_n "CreateFile()" #define ngx_open_tempfile_n "CreateFile()"
@ -72,7 +72,7 @@ ngx_int_t ngx_file_append_mode(ngx_fd_t fd);
#define ngx_rename_file MoveFile #define ngx_rename_file MoveFile
#define ngx_rename_file_n "MoveFile()" #define ngx_rename_file_n "MoveFile()"
ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
ngx_pool_t *pool); ngx_pool_t *pool);
ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi); ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi);
@ -88,7 +88,7 @@ ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi);
#define ngx_file_size(fi) \ #define ngx_file_size(fi) \
(((off_t) (fi)->nFileSizeHigh << 32) | (fi)->nFileSizeLow) (((off_t) (fi)->nFileSizeHigh << 32) | (fi)->nFileSizeLow)
#define ngx_file_uniq(fi) (*(ngx_file_uniq_t *) &(fi)->nFileIndexHigh) #define ngx_file_uniq(fi) (*(ngx_file_uniq_t *) &(fi)->nFileIndexHigh)
@ -134,17 +134,20 @@ ngx_int_t ngx_read_dir(ngx_dir_t *dir);
#define ngx_de_namelen(dir) ngx_strlen((dir)->fd.cFileName) #define ngx_de_namelen(dir) ngx_strlen((dir)->fd.cFileName)
#define ngx_de_info(name, dir) NGX_OK #define ngx_de_info(name, dir) NGX_OK
#define ngx_de_info_n "dummy()" #define ngx_de_info_n "dummy()"
#define ngx_de_link_info(name, dir) NGX_OK
#define ngx_de_link_info_n "dummy()"
#define ngx_de_is_dir(dir) \ #define ngx_de_is_dir(dir) \
((dir)->fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ((dir)->fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#define ngx_de_is_file(dir) \ #define ngx_de_is_file(dir) \
!((dir)->fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !((dir)->fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#define ngx_de_is_link(dir) 0
#define ngx_de_size(dir) \ #define ngx_de_size(dir) \
(((off_t) (dir)->fd.nFileSizeHigh << 32) | (dir)->fd.nFileSizeLow) (((off_t) (dir)->fd.nFileSizeHigh << 32) | (dir)->fd.nFileSizeLow)
/* 116444736000000000 is commented in src/os/win32/ngx_time.c */ /* 116444736000000000 is commented in src/os/win32/ngx_time.c */
#define ngx_de_mtime(dir) \ #define ngx_de_mtime(dir) \
(time_t) (((((unsigned __int64) \ (time_t) (((((unsigned __int64) \
(dir)->fd.ftLastWriteTime.dwHighDateTime << 32) \ (dir)->fd.ftLastWriteTime.dwHighDateTime << 32) \
| (dir)->fd.ftLastWriteTime.dwLowDateTime) \ | (dir)->fd.ftLastWriteTime.dwLowDateTime) \
- 116444736000000000) / 10000000) - 116444736000000000) / 10000000)
@ -155,10 +158,10 @@ ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset);
#define ngx_read_file_n "ReadFile()" #define ngx_read_file_n "ReadFile()"
ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size,
off_t offset); off_t offset);
ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce, ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce,
off_t offset, ngx_pool_t *pool); off_t offset, ngx_pool_t *pool);
#endif /* _NGX_FILES_H_INCLUDED_ */ #endif /* _NGX_FILES_H_INCLUDED_ */