nginx-0.0.1-2003-11-10-20:17:31 import
diff --git a/src/http/modules/ngx_http_charset_filter.c b/src/http/modules/ngx_http_charset_filter.c
index dd48f0b..a545eaf 100644
--- a/src/http/modules/ngx_http_charset_filter.c
+++ b/src/http/modules/ngx_http_charset_filter.c
@@ -29,6 +29,8 @@
static ngx_http_module_t ngx_http_charset_filter_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/modules/ngx_http_chunked_filter.c b/src/http/modules/ngx_http_chunked_filter.c
index 20a5d0d..5e7bd28 100644
--- a/src/http/modules/ngx_http_chunked_filter.c
+++ b/src/http/modules/ngx_http_chunked_filter.c
@@ -8,6 +8,8 @@
static ngx_http_module_t ngx_http_chunked_filter_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/modules/ngx_http_gzip_filter.c b/src/http/modules/ngx_http_gzip_filter.c
index 5a091b4..09980ef 100644
--- a/src/http/modules/ngx_http_gzip_filter.c
+++ b/src/http/modules/ngx_http_gzip_filter.c
@@ -34,6 +34,10 @@
unsigned flush:4;
unsigned redo:1;
+ unsigned done:1;
+
+ size_t zin;
+ size_t zout;
u_int crc32;
z_stream zstream;
@@ -46,6 +50,11 @@
static void ngx_http_gzip_filter_free(void *opaque, void *address);
ngx_inline static int ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx);
+
+static char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, char *buf,
+ uintptr_t data);
+
+static int ngx_http_gzip_pre_conf(ngx_conf_t *cf);
static int ngx_http_gzip_filter_init(ngx_cycle_t *cycle);
static void *ngx_http_gzip_create_conf(ngx_conf_t *cf);
static char *ngx_http_gzip_merge_conf(ngx_conf_t *cf,
@@ -114,6 +123,8 @@
static ngx_http_module_t ngx_http_gzip_filter_module_ctx = {
+ ngx_http_gzip_pre_conf, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -135,6 +146,13 @@
};
+static ngx_http_log_op_name_t ngx_http_gzip_log_fmt_ops[] = {
+ { ngx_string("gzip_ratio"), NGX_INT32_LEN + 3, ngx_http_gzip_log_ratio },
+ { ngx_null_string, 0, NULL }
+};
+
+
+
static u_char gzheader[10] = { 0x1f, 0x8b, Z_DEFLATED, 0, 0, 0, 0, 0, 0, 3 };
#if (HAVE_LITTLE_ENDIAN)
@@ -215,7 +233,7 @@
static int ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
- int rc, wbits, memlevel, zin, zout, last;
+ int rc, wbits, memlevel, last;
struct gztrailer *trailer;
ngx_hunk_t *h;
ngx_chain_t *cl;
@@ -226,6 +244,10 @@
return ngx_http_next_body_filter(r, in);
}
+ if (ctx->done) {
+ return ngx_http_next_body_filter(r, in);
+ }
+
conf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_filter_module);
if (ctx->preallocated == NULL) {
@@ -400,8 +422,8 @@
/* rc == Z_STREAM_END */
- zin = ctx->zstream.total_in;
- zout = 10 + ctx->zstream.total_out + 8;
+ ctx->zin = ctx->zstream.total_in;
+ ctx->zout = 10 + ctx->zstream.total_out + 8;
rc = deflateEnd(&ctx->zstream);
if (rc != Z_OK) {
@@ -441,7 +463,7 @@
#if (HAVE_LITTLE_ENDIAN)
trailer->crc32 = ctx->crc32;
- trailer->zlen = zin;
+ trailer->zlen = ctx->zin;
#else
/* STUB */
#endif
@@ -449,7 +471,11 @@
ctx->zstream.avail_in = 0;
ctx->zstream.avail_out = 0;
+ ctx->done = 1;
+
+#if 0
ngx_http_delete_ctx(r, ngx_http_gzip_filter_module);
+#endif
break;
@@ -531,6 +557,40 @@
}
+static char *ngx_http_gzip_log_ratio(ngx_http_request_t *r, char *buf,
+ uintptr_t data)
+{
+ int zint, zfrac;
+ ngx_http_gzip_ctx_t *ctx;
+
+ ctx = ngx_http_get_module_ctx(r, ngx_http_gzip_filter_module);
+
+ if (ctx == NULL || ctx->zout == 0) {
+ *buf = '-';
+ return buf + 1;
+ }
+
+#if 0
+ return buf + ngx_snprintf(buf, NGX_INT32_LEN + 4, "%.2f",
+ (float) ctx->zin / ctx->zout);
+#endif
+
+ /* we prefer do not use FPU */
+
+ zint = ctx->zin / ctx->zout;
+ zfrac = (ctx->zin * 100 / ctx->zout) % 100;
+
+ if ((ctx->zin * 1000 / ctx->zout) %10 > 4) {
+ if (++zfrac > 99) {
+ zint++;
+ zfrac = 0;
+ }
+ }
+
+ return buf + ngx_snprintf(buf, NGX_INT32_LEN + 4, "%d.%02d", zint, zfrac);
+}
+
+
ngx_inline static int ngx_http_gzip_error(ngx_http_gzip_ctx_t *ctx)
{
deflateEnd(&ctx->zstream);
@@ -544,6 +604,27 @@
}
+static int ngx_http_gzip_pre_conf(ngx_conf_t *cf)
+{
+ ngx_http_log_op_name_t *op;
+
+ for (op = ngx_http_gzip_log_fmt_ops; op->name.len; op++) { /* void */ }
+ op->op = NULL;
+
+ op = ngx_http_log_fmt_ops;
+
+ for (op = ngx_http_log_fmt_ops; op->op; op++) {
+ if (op->name.len == 0) {
+ op = (ngx_http_log_op_name_t *) op->op;
+ }
+ }
+
+ op->op = (ngx_http_log_op_pt) ngx_http_gzip_log_fmt_ops;
+
+ return NGX_OK;
+}
+
+
static int ngx_http_gzip_filter_init(ngx_cycle_t *cycle)
{
ngx_http_next_header_filter = ngx_http_top_header_filter;
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index 9ec9325..f4c7157 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -46,6 +46,8 @@
ngx_http_module_t ngx_http_index_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/modules/ngx_http_not_modified_filter.c b/src/http/modules/ngx_http_not_modified_filter.c
index b00e2ff..c623752 100644
--- a/src/http/modules/ngx_http_not_modified_filter.c
+++ b/src/http/modules/ngx_http_not_modified_filter.c
@@ -9,6 +9,8 @@
static ngx_http_module_t ngx_http_not_modified_filter_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/modules/ngx_http_range_filter.c b/src/http/modules/ngx_http_range_filter.c
index 850235a..11b7d0f 100644
--- a/src/http/modules/ngx_http_range_filter.c
+++ b/src/http/modules/ngx_http_range_filter.c
@@ -48,6 +48,8 @@
static ngx_http_module_t ngx_http_range_filter_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index 9849dbf..33d293a 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -16,6 +16,8 @@
ngx_http_module_t ngx_http_static_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/modules/proxy/ngx_http_proxy_cache.c b/src/http/modules/proxy/ngx_http_proxy_cache.c
index 0f56686..3c4f5ca 100644
--- a/src/http/modules/proxy/ngx_http_proxy_cache.c
+++ b/src/http/modules/proxy/ngx_http_proxy_cache.c
@@ -302,6 +302,7 @@
return;
}
+ p->state->status = NGX_HTTP_SERVICE_UNAVAILABLE;
ngx_http_proxy_finalize_request(p, NGX_HTTP_SERVICE_UNAVAILABLE);
}
@@ -468,7 +469,7 @@
int ngx_http_proxy_is_cachable(ngx_http_proxy_ctx_t *p)
{
- time_t date, last_modified, expires;
+ time_t date, last_modified, expires, t;
ngx_http_proxy_headers_in_t *h;
switch (p->upstream->status) {
@@ -509,6 +510,7 @@
h->x_accel_expires->value.len);
if (expires != NGX_ERROR) {
p->state->reason = NGX_HTTP_PROXY_CACHE_XAE;
+ p->state->expires = expires;
p->cache->ctx.expires = date + expires;
return (expires > 0);
}
@@ -523,6 +525,7 @@
h->expires->value.len);
if (expires != NGX_ERROR) {
p->state->reason = NGX_HTTP_PROXY_CACHE_EXP;
+ p->state->expires = expires - date;
p->cache->ctx.expires = expires;
return (date < expires);
}
@@ -531,6 +534,7 @@
if (p->upstream->status == NGX_HTTP_MOVED_PERMANENTLY) {
p->state->reason = NGX_HTTP_PROXY_CACHE_MVD;
+ p->state->expires = /* STUB: 1 hour */ 60 * 60;
p->cache->ctx.expires = /* STUB: 1 hour */ 60 * 60;
return 1;
}
@@ -544,14 +548,17 @@
/* FIXME: time_t == int_64_t, we can use fpu */
p->state->reason = NGX_HTTP_PROXY_CACHE_LMF;
- p->cache->ctx.expires = (time_t) (ngx_time()
- + (((int64_t) (date - last_modified)) * p->lcf->lm_factor) / 100);
+ t = (time_t)
+ ((((int64_t) (date - last_modified)) * p->lcf->lm_factor) / 100);
+ p->state->expires = t;
+ p->cache->ctx.expires = ngx_time() + t;
return 1;
}
if (p->lcf->default_expires > 0) {
p->state->reason = NGX_HTTP_PROXY_CACHE_PDE;
- p->cache->ctx.expires = p->lcf->default_expires;
+ p->state->expires = p->lcf->default_expires;
+ p->cache->ctx.expires = ngx_time() + p->lcf->default_expires;
return 1;
}
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c
index 4a48250..ad719ca 100644
--- a/src/http/modules/proxy/ngx_http_proxy_handler.c
+++ b/src/http/modules/proxy/ngx_http_proxy_handler.c
@@ -7,7 +7,14 @@
static int ngx_http_proxy_handler(ngx_http_request_t *r);
-static int ngx_http_proxy_init(ngx_cycle_t *cycle);
+static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
+ uintptr_t data);
+static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf,
+ uintptr_t data);
+static char *ngx_http_proxy_log_reason(ngx_http_request_t *r, char *buf,
+ uintptr_t data);
+
+static int ngx_http_proxy_pre_conf(ngx_conf_t *cf);
static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
@@ -194,6 +201,8 @@
ngx_http_module_t ngx_http_proxy_module_ctx = {
+ ngx_http_proxy_pre_conf, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
@@ -215,6 +224,19 @@
};
+
+static ngx_http_log_op_name_t ngx_http_proxy_log_fmt_ops[] = {
+ { ngx_string("proxy"), /* STUB */ 100,
+ ngx_http_proxy_log_proxy_state },
+ { ngx_string("proxy_cache_state"), sizeof("BYPASS") - 1,
+ ngx_http_proxy_log_cache_state },
+ { ngx_string("proxy_reason"), sizeof("BPS") - 1,
+ ngx_http_proxy_log_reason },
+ { ngx_null_string, 0, NULL }
+};
+
+
+
ngx_http_header_t ngx_http_proxy_headers_in[] = {
{ ngx_string("Date"), offsetof(ngx_http_proxy_headers_in_t, date) },
{ ngx_string("Server"), offsetof(ngx_http_proxy_headers_in_t, server) },
@@ -252,7 +274,7 @@
};
-static ngx_str_t cache_reason[] = {
+static ngx_str_t cache_reasons[] = {
ngx_string("BPS"),
ngx_string("XAE"),
ngx_string("CTL"),
@@ -453,12 +475,6 @@
}
-size_t ngx_http_proxy_log_state(void *data, char *buf, size_t len)
-{
- return 0;
-}
-
-
size_t ngx_http_proxy_log_error(void *data, char *buf, size_t len)
{
ngx_http_proxy_ctx_t *p = data;
@@ -482,6 +498,121 @@
}
+static char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, char *buf,
+ uintptr_t data)
+{
+ ngx_http_proxy_ctx_t *p;
+
+ p = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
+
+ if (p == NULL) {
+ *buf = '-';
+ return buf + 1;
+ }
+
+ if (p->state->cache_state == 0) {
+ *buf++ = '-';
+
+ } else {
+ buf = ngx_cpymem(buf, cache_states[p->state->cache_state - 1].data,
+ cache_states[p->state->cache_state - 1].len);
+ }
+
+ *buf++ = '/';
+
+ *buf++ = 'X';
+
+ *buf++ = '/';
+
+ *buf++ = 'X';
+
+ *buf++ = ' ';
+
+ if (p->state->status == 0) {
+ *buf++ = '-';
+
+ } else {
+ buf += ngx_snprintf(buf, 4, "%d", p->state->status);
+ }
+
+ *buf++ = '/';
+
+ if (p->state->reason == 0) {
+ *buf++ = '-';
+
+ } else {
+ buf = ngx_cpymem(buf, cache_reasons[p->state->reason - 1].data,
+ cache_reasons[p->state->reason - 1].len);
+ }
+
+ *buf++ = '/';
+
+ if (p->state->reason >= NGX_HTTP_PROXY_CACHE_XAE) {
+ *buf++ = '-';
+
+ } else {
+ buf += ngx_snprintf(buf, NGX_TIME_LEN, TIME_FMT, p->state->expires);
+ }
+
+ return buf;
+}
+
+
+static char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, char *buf,
+ uintptr_t data)
+{
+ ngx_http_proxy_ctx_t *p;
+
+ p = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
+
+ if (p == NULL || p->state->cache_state == 0) {
+ *buf = '-';
+ return buf + 1;
+ }
+
+ return ngx_cpymem(buf, cache_states[p->state->cache_state - 1].data,
+ cache_states[p->state->cache_state - 1].len);
+}
+
+
+static char *ngx_http_proxy_log_reason(ngx_http_request_t *r, char *buf,
+ uintptr_t data)
+{
+ ngx_http_proxy_ctx_t *p;
+
+ p = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
+
+ if (p == NULL || p->state->reason == 0) {
+ *buf = '-';
+ return buf + 1;
+ }
+
+ return ngx_cpymem(buf, cache_reasons[p->state->reason - 1].data,
+ cache_reasons[p->state->reason - 1].len);
+}
+
+
+static int ngx_http_proxy_pre_conf(ngx_conf_t *cf)
+{
+ ngx_http_log_op_name_t *op;
+
+ for (op = ngx_http_proxy_log_fmt_ops; op->name.len; op++) { /* void */ }
+ op->op = NULL;
+
+ op = ngx_http_log_fmt_ops;
+
+ for (op = ngx_http_log_fmt_ops; op->op; op++) {
+ if (op->name.len == 0) {
+ op = (ngx_http_log_op_name_t *) op->op;
+ }
+ }
+
+ op->op = (ngx_http_log_op_pt) ngx_http_proxy_log_fmt_ops;
+
+ return NGX_OK;
+}
+
+
static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
{
ngx_http_proxy_loc_conf_t *conf;
diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c
index 0ec2fee..d404993 100644
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -305,6 +305,13 @@
}
}
+ /* add one more state */
+
+ if (!(p->state = ngx_push_array(&p->states))) {
+ ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
p->status = 0;
p->status_count = 0;
}
@@ -344,6 +351,7 @@
return;
}
+ p->state->status = NGX_HTTP_SERVICE_UNAVAILABLE;
ngx_http_proxy_finalize_request(p, NGX_HTTP_SERVICE_UNAVAILABLE);
}
@@ -407,11 +415,6 @@
p->request_sent = 0;
- if (!(p->state = ngx_push_array(&p->states))) {
- ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
- return;
- }
-
if (rc == NGX_AGAIN) {
ngx_add_timer(c->write, p->lcf->connect_timeout);
return;
@@ -636,6 +639,7 @@
/* rc == NGX_OK */
p->upstream->status = p->status;
+ p->state->status = p->status;
if (p->status == NGX_HTTP_INTERNAL_SERVER_ERROR) {
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 5f561f7..9fa8f62 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -107,6 +107,12 @@
module = ngx_modules[m]->ctx;
mi = ngx_modules[m]->ctx_index;
+ if (module->pre_conf) {
+ if (module->pre_conf(cf) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+ }
+
if (module->create_main_conf) {
ngx_test_null(ctx->main_conf[mi], module->create_main_conf(cf),
NGX_CONF_ERROR);
@@ -157,6 +163,7 @@
if (module->init_main_conf) {
rv = module->init_main_conf(cf, ctx->main_conf[mi]);
if (rv != NGX_CONF_OK) {
+ *cf = pcf;
return rv;
}
}
@@ -170,6 +177,7 @@
ctx->srv_conf[mi],
cscfp[s]->ctx->srv_conf[mi]);
if (rv != NGX_CONF_OK) {
+ *cf = pcf;
return rv;
}
}
@@ -182,6 +190,7 @@
ctx->loc_conf[mi],
cscfp[s]->ctx->loc_conf[mi]);
if (rv != NGX_CONF_OK) {
+ *cf = pcf;
return rv;
}
@@ -194,6 +203,7 @@
cscfp[s]->ctx->loc_conf[mi],
clcfp[l]->loc_conf[mi]);
if (rv != NGX_CONF_OK) {
+ *cf = pcf;
return rv;
}
}
@@ -201,6 +211,8 @@
}
}
+ /* we needed "http"'s cf->ctx while merging configuration */
+ *cf = pcf;
/* init lists of the handlers */
@@ -557,6 +569,5 @@
}
/**/
- *cf = pcf;
return NGX_CONF_OK;
}
diff --git a/src/http/ngx_http_config.h b/src/http/ngx_http_config.h
index d12dfca..ab5b477 100644
--- a/src/http/ngx_http_config.h
+++ b/src/http/ngx_http_config.h
@@ -20,6 +20,8 @@
typedef struct {
+ int (*pre_conf)(ngx_conf_t *cf);
+
void *(*create_main_conf)(ngx_conf_t *cf);
char *(*init_main_conf)(ngx_conf_t *cf, void *conf);
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index d7b4fac..a5f5c38 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -212,6 +212,8 @@
ngx_http_module_t ngx_http_core_module_ctx = {
+ NULL, /* pre conf */
+
ngx_http_core_create_main_conf, /* create main configuration */
ngx_http_core_init_main_conf, /* init main configuration */
diff --git a/src/http/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index 3f56563..64cf4bb 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -10,6 +10,8 @@
static ngx_http_module_t ngx_http_header_filter_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/ngx_http_log_handler.c b/src/http/ngx_http_log_handler.c
index b4811c8..7a2bf9e 100644
--- a/src/http/ngx_http_log_handler.c
+++ b/src/http/ngx_http_log_handler.c
@@ -28,6 +28,7 @@
static char *ngx_http_log_unknown_header_out(ngx_http_request_t *r, char *buf,
uintptr_t data);
+static int ngx_http_log_pre_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 char *ngx_http_log_merge_loc_conf(ngx_conf_t *cf, void *parent,
@@ -61,6 +62,8 @@
ngx_http_module_t ngx_http_log_module_ctx = {
+ ngx_http_log_pre_conf, /* pre conf */
+
ngx_http_log_create_main_conf, /* create main configuration */
NULL, /* init main configuration */
@@ -93,7 +96,7 @@
"\"%{Referer}i\" %{User-Agent}i\"");
-static ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
+ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
{ ngx_string("addr"), INET_ADDRSTRLEN - 1, ngx_http_log_addr },
{ ngx_string("conn"), NGX_INT32_LEN, ngx_http_log_connection },
{ ngx_string("pipe"), 1, ngx_http_log_pipe },
@@ -439,6 +442,17 @@
}
+static int ngx_http_log_pre_conf(ngx_conf_t *cf)
+{
+ ngx_http_log_op_name_t *op;
+
+ for (op = ngx_http_log_fmt_ops; op->name.len; op++) { /* void */ }
+ op->op = NULL;
+
+ return NGX_OK;
+}
+
+
static void *ngx_http_log_create_main_conf(ngx_conf_t *cf)
{
ngx_http_log_main_conf_t *conf;
@@ -474,7 +488,7 @@
rc = ngx_http_log_set_format(cf, NULL, conf);
if (rc != NGX_CONF_OK) {
- return rc;
+ return NULL;
}
return conf;
@@ -597,9 +611,6 @@
ngx_http_log_op_name_t *name;
value = cf->args->elts;
-#if 0
- lmcf = ngx_http_conf_module_main_conf(cf, ngx_http_log_module);
-#endif
fmt = lmcf->formats.elts;
for (f = 0; f < lmcf->formats.nelts; f++) {
@@ -669,8 +680,8 @@
fname = &value[s].data[i];
while (i < value[s].len
- && value[s].data[i] >= 'a'
- && value[s].data[i] <= 'z')
+ && ((value[s].data[i] >= 'a' && value[s].data[i] <= 'z')
+ || value[s].data[i] == '_'))
{
i++;
}
@@ -682,7 +693,11 @@
break;
}
- for (name = ngx_http_log_fmt_ops; name->name.len; name++) {
+ for (name = ngx_http_log_fmt_ops; name->op; name++) {
+ if (name->name.len == 0) {
+ name = (ngx_http_log_op_name_t *) name->op;
+ }
+
if (name->name.len == fname_len
&& ngx_strncmp(name->name.data, fname, fname_len) == 0)
{
diff --git a/src/http/ngx_http_log_handler.h b/src/http/ngx_http_log_handler.h
index ba301ae..40e70df 100644
--- a/src/http/ngx_http_log_handler.h
+++ b/src/http/ngx_http_log_handler.h
@@ -17,6 +17,7 @@
/* STUB */
#define NGX_INT32_LEN sizeof("4294967296") - 1
+#define NGX_TIME_LEN sizeof("4294967296") - 1
#define NGX_OFF_LEN sizeof("18446744073709551616") - 1
@@ -56,4 +57,7 @@
} ngx_http_log_loc_conf_t;
+extern ngx_http_log_op_name_t ngx_http_log_fmt_ops[];
+
+
#endif /* _NGX_HTTP_LOG_HANDLER_H_INCLUDED_ */
diff --git a/src/http/ngx_http_output_filter.c b/src/http/ngx_http_output_filter.c
index b8ce332..f6cc85d 100644
--- a/src/http/ngx_http_output_filter.c
+++ b/src/http/ngx_http_output_filter.c
@@ -28,6 +28,8 @@
static ngx_http_module_t ngx_http_output_filter_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */
diff --git a/src/http/ngx_http_write_filter.c b/src/http/ngx_http_write_filter.c
index 143f38c..50f7f93 100644
--- a/src/http/ngx_http_write_filter.c
+++ b/src/http/ngx_http_write_filter.c
@@ -35,6 +35,8 @@
ngx_http_module_t ngx_http_write_filter_module_ctx = {
+ NULL, /* pre conf */
+
NULL, /* create main configuration */
NULL, /* init main configuration */