nginxtra 1.2.6.8 → 1.2.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/nginxtra +1 -1
- data/bin/nginxtra_rails +1 -1
- data/lib/nginxtra/version.rb +1 -1
- data/vendor/nginx/CHANGES +72 -0
- data/vendor/nginx/CHANGES.ru +76 -0
- data/vendor/nginx/LICENSE +2 -2
- data/vendor/nginx/auto/cc/msvc +0 -3
- data/vendor/nginx/auto/lib/geoip/conf +17 -2
- data/vendor/nginx/auto/lib/libgd/conf +1 -1
- data/vendor/nginx/auto/lib/pcre/conf +1 -0
- data/vendor/nginx/auto/lib/perl/make +1 -3
- data/vendor/nginx/auto/lib/zlib/conf +4 -1
- data/vendor/nginx/man/nginx.8 +2 -2
- data/vendor/nginx/src/core/nginx.h +2 -2
- data/vendor/nginx/src/core/ngx_conf_file.c +4 -19
- data/vendor/nginx/src/core/ngx_conf_file.h +1 -10
- data/vendor/nginx/src/core/ngx_cycle.c +2 -19
- data/vendor/nginx/src/core/ngx_file.c +4 -4
- data/vendor/nginx/src/core/ngx_inet.c +1 -1
- data/vendor/nginx/src/core/ngx_inet.h +1 -1
- data/vendor/nginx/src/core/ngx_radix_tree.c +202 -5
- data/vendor/nginx/src/core/ngx_radix_tree.h +9 -0
- data/vendor/nginx/src/event/modules/ngx_poll_module.c +2 -2
- data/vendor/nginx/src/event/ngx_event.c +4 -0
- data/vendor/nginx/src/event/ngx_event_openssl.c +27 -13
- data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +38 -49
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +44 -59
- data/vendor/nginx/src/http/modules/ngx_http_geo_module.c +310 -103
- data/vendor/nginx/src/http/modules/ngx_http_geoip_module.c +145 -15
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +5 -1
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +1 -0
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +27 -13
- data/vendor/nginx/src/http/modules/ngx_http_log_module.c +378 -40
- data/vendor/nginx/src/http/modules/ngx_http_map_module.c +7 -0
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +9 -7
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_secure_link_module.c +15 -2
- data/vendor/nginx/src/http/modules/ngx_http_split_clients_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +4 -0
- data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +3 -1
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/perl/Makefile.PL +3 -14
- data/vendor/nginx/src/http/modules/perl/nginx.pm +2 -2
- data/vendor/nginx/src/http/ngx_http_core_module.c +2 -1
- data/vendor/nginx/src/http/ngx_http_script.c +3 -7
- data/vendor/nginx/src/http/ngx_http_upstream.c +9 -0
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +3 -1
- data/vendor/nginx/src/http/ngx_http_variables.c +114 -0
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_files.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_user.c +13 -14
- metadata +2 -2
@@ -209,6 +209,13 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
209
209
|
}
|
210
210
|
|
211
211
|
name = value[2];
|
212
|
+
|
213
|
+
if (name.data[0] != '$') {
|
214
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
215
|
+
"invalid variable name \"%V\"", &name);
|
216
|
+
return NGX_CONF_ERROR;
|
217
|
+
}
|
218
|
+
|
212
219
|
name.len--;
|
213
220
|
name.data++;
|
214
221
|
|
@@ -836,7 +836,7 @@ ngx_http_proxy_create_key(ngx_http_request_t *r)
|
|
836
836
|
return NGX_ERROR;
|
837
837
|
}
|
838
838
|
|
839
|
-
if (plcf->cache_key.value.
|
839
|
+
if (plcf->cache_key.value.data) {
|
840
840
|
|
841
841
|
if (ngx_http_complex_value(r, &plcf->cache_key, key) != NGX_OK) {
|
842
842
|
return NGX_ERROR;
|
@@ -1610,7 +1610,8 @@ ngx_http_proxy_copy_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
|
|
1610
1610
|
p->upstream_done = 1;
|
1611
1611
|
|
1612
1612
|
ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
|
1613
|
-
"upstream sent
|
1613
|
+
"upstream sent more data than specified in "
|
1614
|
+
"\"Content-Length\" header");
|
1614
1615
|
}
|
1615
1616
|
|
1616
1617
|
return NGX_OK;
|
@@ -2607,7 +2608,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
|
|
2607
2608
|
* conf->upstream.store_lengths = NULL;
|
2608
2609
|
* conf->upstream.store_values = NULL;
|
2609
2610
|
*
|
2610
|
-
* conf->method = NULL;
|
2611
|
+
* conf->method = { 0, NULL };
|
2611
2612
|
* conf->headers_source = NULL;
|
2612
2613
|
* conf->headers_set_len = NULL;
|
2613
2614
|
* conf->headers_set = NULL;
|
@@ -2906,10 +2907,11 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2906
2907
|
|
2907
2908
|
#endif
|
2908
2909
|
|
2909
|
-
|
2910
|
-
conf->method = prev->method;
|
2910
|
+
ngx_conf_merge_str_value(conf->method, prev->method, "");
|
2911
2911
|
|
2912
|
-
|
2912
|
+
if (conf->method.len
|
2913
|
+
&& conf->method.data[conf->method.len - 1] != ' ')
|
2914
|
+
{
|
2913
2915
|
conf->method.data[conf->method.len] = ' ';
|
2914
2916
|
conf->method.len++;
|
2915
2917
|
}
|
@@ -3918,7 +3920,7 @@ ngx_http_proxy_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
3918
3920
|
|
3919
3921
|
value = cf->args->elts;
|
3920
3922
|
|
3921
|
-
if (plcf->cache_key.value.
|
3923
|
+
if (plcf->cache_key.value.data) {
|
3922
3924
|
return "is duplicate";
|
3923
3925
|
}
|
3924
3926
|
|
@@ -111,7 +111,7 @@ ngx_http_secure_link_variable(ngx_http_request_t *r,
|
|
111
111
|
|
112
112
|
conf = ngx_http_get_module_loc_conf(r, ngx_http_secure_link_module);
|
113
113
|
|
114
|
-
if (conf->secret.
|
114
|
+
if (conf->secret.data) {
|
115
115
|
return ngx_http_secure_link_old_variable(r, conf, v, data);
|
116
116
|
}
|
117
117
|
|
@@ -318,7 +318,16 @@ ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
318
318
|
ngx_http_secure_link_conf_t *prev = parent;
|
319
319
|
ngx_http_secure_link_conf_t *conf = child;
|
320
320
|
|
321
|
-
|
321
|
+
if (conf->secret.data) {
|
322
|
+
if (conf->variable || conf->md5) {
|
323
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
324
|
+
"\"secure_link_secret\" cannot be mixed with "
|
325
|
+
"\"secure_link\" and \"secure_link_md5\"");
|
326
|
+
return NGX_CONF_ERROR;
|
327
|
+
}
|
328
|
+
|
329
|
+
return NGX_CONF_OK;
|
330
|
+
}
|
322
331
|
|
323
332
|
if (conf->variable == NULL) {
|
324
333
|
conf->variable = prev->variable;
|
@@ -328,6 +337,10 @@ ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
328
337
|
conf->md5 = prev->md5;
|
329
338
|
}
|
330
339
|
|
340
|
+
if (conf->variable == NULL && conf->md5 == NULL) {
|
341
|
+
conf->secret = prev->secret;
|
342
|
+
}
|
343
|
+
|
331
344
|
return NGX_CONF_OK;
|
332
345
|
}
|
333
346
|
|
@@ -139,7 +139,7 @@ ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
139
139
|
|
140
140
|
name = value[2];
|
141
141
|
|
142
|
-
if (name.
|
142
|
+
if (name.data[0] != '$') {
|
143
143
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
144
144
|
"invalid variable name \"%V\"", &name);
|
145
145
|
return NGX_CONF_ERROR;
|
@@ -627,7 +627,7 @@ ngx_http_sub_filter(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
627
627
|
ngx_str_t *value;
|
628
628
|
ngx_http_compile_complex_value_t ccv;
|
629
629
|
|
630
|
-
if (slcf->match.
|
630
|
+
if (slcf->match.data) {
|
631
631
|
return "is duplicate";
|
632
632
|
}
|
633
633
|
|
@@ -687,7 +687,7 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
687
687
|
ngx_conf_merge_value(conf->once, prev->once, 1);
|
688
688
|
ngx_conf_merge_str_value(conf->match, prev->match, "");
|
689
689
|
|
690
|
-
if (conf->value.value.
|
690
|
+
if (conf->value.value.data == NULL) {
|
691
691
|
conf->value = prev->value;
|
692
692
|
}
|
693
693
|
|
@@ -502,6 +502,10 @@ ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
502
502
|
kcf = ngx_http_conf_upstream_srv_conf(uscf,
|
503
503
|
ngx_http_upstream_keepalive_module);
|
504
504
|
|
505
|
+
if (kcf->original_init_upstream) {
|
506
|
+
return "is duplicate";
|
507
|
+
}
|
508
|
+
|
505
509
|
kcf->original_init_upstream = uscf->peer.init_upstream
|
506
510
|
? uscf->peer.init_upstream
|
507
511
|
: ngx_http_upstream_init_round_robin;
|
@@ -313,7 +313,9 @@ failed:
|
|
313
313
|
lcp->rrp.peers = peers->next;
|
314
314
|
pc->tries = lcp->rrp.peers->number;
|
315
315
|
|
316
|
-
n = lcp->rrp.peers->number
|
316
|
+
n = (lcp->rrp.peers->number + (8 * sizeof(uintptr_t) - 1))
|
317
|
+
/ (8 * sizeof(uintptr_t));
|
318
|
+
|
317
319
|
for (i = 0; i < n; i++) {
|
318
320
|
lcp->rrp.tried[i] = 0;
|
319
321
|
}
|
@@ -307,7 +307,7 @@ ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
|
|
307
307
|
ctx->done = 1;
|
308
308
|
|
309
309
|
if (b == NULL) {
|
310
|
-
return ngx_http_filter_finalize_request(r,
|
310
|
+
return ngx_http_filter_finalize_request(r, &ngx_http_xslt_filter_module,
|
311
311
|
NGX_HTTP_INTERNAL_SERVER_ERROR);
|
312
312
|
}
|
313
313
|
|
@@ -315,7 +315,7 @@ ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
|
|
315
315
|
|
316
316
|
if (cln == NULL) {
|
317
317
|
ngx_free(b->pos);
|
318
|
-
return ngx_http_filter_finalize_request(r,
|
318
|
+
return ngx_http_filter_finalize_request(r, &ngx_http_xslt_filter_module,
|
319
319
|
NGX_HTTP_INTERNAL_SERVER_ERROR);
|
320
320
|
}
|
321
321
|
|
@@ -16,20 +16,9 @@ WriteMakefile(
|
|
16
16
|
CCFLAGS => "$ENV{NGX_PM_CFLAGS}",
|
17
17
|
OPTIMIZE => '-O',
|
18
18
|
|
19
|
-
INC => "
|
20
|
-
|
21
|
-
|
22
|
-
"-I ../../../../../src/http " .
|
23
|
-
"-I ../../../../../src/http/modules " .
|
24
|
-
"-I ../../../../../src/http/modules/perl " .
|
25
|
-
"-I ../../../../../$ENV{NGX_OBJS} " .
|
26
|
-
($ENV{NGX_PCRE} =~ /^(YES|NO)/ ? "" :
|
27
|
-
($ENV{NGX_PCRE} =~ m#^/# ? "-I $ENV{NGX_PCRE} " :
|
28
|
-
"-I ../../../../../$ENV{NGX_PCRE} ")) .
|
29
|
-
($ENV{NGX_OPENSSL} =~ /^(YES|NO)/ ? "" :
|
30
|
-
($ENV{NGX_OPENSSL} =~ m#^/# ?
|
31
|
-
"-I $ENV{NGX_OPENSSL}/.openssl/include " :
|
32
|
-
"-I ../../../../../$ENV{NGX_OPENSSL}/.openssl/include ")),
|
19
|
+
INC => join(" ", map {
|
20
|
+
m#^/# ? "-I $_" : "-I ../../../../../$_"
|
21
|
+
} (split /\s+/, $ENV{NGX_INCS})),
|
33
22
|
|
34
23
|
depend => {
|
35
24
|
'nginx.c' =>
|
@@ -50,7 +50,7 @@ our @EXPORT = qw(
|
|
50
50
|
HTTP_INSUFFICIENT_STORAGE
|
51
51
|
);
|
52
52
|
|
53
|
-
our $VERSION = '1.2.
|
53
|
+
our $VERSION = '1.2.7';
|
54
54
|
|
55
55
|
require XSLoader;
|
56
56
|
XSLoader::load('nginx', $VERSION);
|
@@ -123,7 +123,7 @@ This module provides a Perl interface to the nginx HTTP server API.
|
|
123
123
|
|
124
124
|
=head1 SEE ALSO
|
125
125
|
|
126
|
-
http://
|
126
|
+
http://nginx.org/en/docs/http/ngx_http_perl_module.html
|
127
127
|
|
128
128
|
=head1 AUTHOR
|
129
129
|
|
@@ -993,6 +993,7 @@ ngx_http_core_find_config_phase(ngx_http_request_t *r,
|
|
993
993
|
"client intended to send too large body: %O bytes",
|
994
994
|
r->headers_in.content_length_n);
|
995
995
|
|
996
|
+
r->expect_tested = 1;
|
996
997
|
(void) ngx_http_discard_request_body(r);
|
997
998
|
ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);
|
998
999
|
return NGX_OK;
|
@@ -4544,7 +4545,7 @@ ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4544
4545
|
|
4545
4546
|
ngx_str_null(&args);
|
4546
4547
|
|
4547
|
-
if (cv.lengths == NULL && uri.data[0] == '/') {
|
4548
|
+
if (cv.lengths == NULL && uri.len && uri.data[0] == '/') {
|
4548
4549
|
p = (u_char *) ngx_strchr(uri.data, '?');
|
4549
4550
|
|
4550
4551
|
if (p) {
|
@@ -114,11 +114,6 @@ ngx_http_compile_complex_value(ngx_http_compile_complex_value_t *ccv)
|
|
114
114
|
|
115
115
|
v = ccv->value;
|
116
116
|
|
117
|
-
if (v->len == 0) {
|
118
|
-
ngx_conf_log_error(NGX_LOG_EMERG, ccv->cf, 0, "empty parameter");
|
119
|
-
return NGX_ERROR;
|
120
|
-
}
|
121
|
-
|
122
117
|
nv = 0;
|
123
118
|
nc = 0;
|
124
119
|
|
@@ -133,8 +128,9 @@ ngx_http_compile_complex_value(ngx_http_compile_complex_value_t *ccv)
|
|
133
128
|
}
|
134
129
|
}
|
135
130
|
|
136
|
-
if (v->data[0] != '$'
|
137
|
-
|
131
|
+
if ((v->len == 0 || v->data[0] != '$')
|
132
|
+
&& (ccv->conf_prefix || ccv->root_prefix))
|
133
|
+
{
|
138
134
|
if (ngx_conf_full_name(ccv->cf->cycle, v, ccv->conf_prefix) != NGX_OK) {
|
139
135
|
return NGX_ERROR;
|
140
136
|
}
|
@@ -636,6 +636,14 @@ ngx_http_upstream_init_request(ngx_http_request_t *r)
|
|
636
636
|
|
637
637
|
found:
|
638
638
|
|
639
|
+
if (uscf == NULL) {
|
640
|
+
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
|
641
|
+
"no upstream configuration");
|
642
|
+
ngx_http_upstream_finalize_request(r, u,
|
643
|
+
NGX_HTTP_INTERNAL_SERVER_ERROR);
|
644
|
+
return;
|
645
|
+
}
|
646
|
+
|
639
647
|
if (uscf->peer.init(r, uscf) != NGX_OK) {
|
640
648
|
ngx_http_upstream_finalize_request(r, u,
|
641
649
|
NGX_HTTP_INTERNAL_SERVER_ERROR);
|
@@ -3091,6 +3099,7 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
|
|
3091
3099
|
r->connection->log->action = "sending to client";
|
3092
3100
|
|
3093
3101
|
if (rc == 0
|
3102
|
+
&& !r->header_only
|
3094
3103
|
#if (NGX_HTTP_CACHE)
|
3095
3104
|
&& !r->cached
|
3096
3105
|
#endif
|
@@ -474,7 +474,9 @@ failed:
|
|
474
474
|
rrp->peers = peers->next;
|
475
475
|
pc->tries = rrp->peers->number;
|
476
476
|
|
477
|
-
n = rrp->peers->number
|
477
|
+
n = (rrp->peers->number + (8 * sizeof(uintptr_t) - 1))
|
478
|
+
/ (8 * sizeof(uintptr_t));
|
479
|
+
|
478
480
|
for (i = 0; i < n; i++) {
|
479
481
|
rrp->tried[i] = 0;
|
480
482
|
}
|
@@ -73,12 +73,16 @@ static ngx_int_t ngx_http_variable_bytes_sent(ngx_http_request_t *r,
|
|
73
73
|
ngx_http_variable_value_t *v, uintptr_t data);
|
74
74
|
static ngx_int_t ngx_http_variable_body_bytes_sent(ngx_http_request_t *r,
|
75
75
|
ngx_http_variable_value_t *v, uintptr_t data);
|
76
|
+
static ngx_int_t ngx_http_variable_pipe(ngx_http_request_t *r,
|
77
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
76
78
|
static ngx_int_t ngx_http_variable_request_completion(ngx_http_request_t *r,
|
77
79
|
ngx_http_variable_value_t *v, uintptr_t data);
|
78
80
|
static ngx_int_t ngx_http_variable_request_body(ngx_http_request_t *r,
|
79
81
|
ngx_http_variable_value_t *v, uintptr_t data);
|
80
82
|
static ngx_int_t ngx_http_variable_request_body_file(ngx_http_request_t *r,
|
81
83
|
ngx_http_variable_value_t *v, uintptr_t data);
|
84
|
+
static ngx_int_t ngx_http_variable_request_length(ngx_http_request_t *r,
|
85
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
82
86
|
static ngx_int_t ngx_http_variable_request_time(ngx_http_request_t *r,
|
83
87
|
ngx_http_variable_value_t *v, uintptr_t data);
|
84
88
|
static ngx_int_t ngx_http_variable_status(ngx_http_request_t *r,
|
@@ -112,6 +116,10 @@ static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
|
|
112
116
|
ngx_http_variable_value_t *v, uintptr_t data);
|
113
117
|
static ngx_int_t ngx_http_variable_msec(ngx_http_request_t *r,
|
114
118
|
ngx_http_variable_value_t *v, uintptr_t data);
|
119
|
+
static ngx_int_t ngx_http_variable_time_iso8601(ngx_http_request_t *r,
|
120
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
121
|
+
static ngx_int_t ngx_http_variable_time_local(ngx_http_request_t *r,
|
122
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
115
123
|
|
116
124
|
/*
|
117
125
|
* TODO:
|
@@ -229,6 +237,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
|
|
229
237
|
{ ngx_string("body_bytes_sent"), NULL, ngx_http_variable_body_bytes_sent,
|
230
238
|
0, 0, 0 },
|
231
239
|
|
240
|
+
{ ngx_string("pipe"), NULL, ngx_http_variable_pipe,
|
241
|
+
0, 0, 0 },
|
242
|
+
|
232
243
|
{ ngx_string("request_completion"), NULL,
|
233
244
|
ngx_http_variable_request_completion,
|
234
245
|
0, 0, 0 },
|
@@ -241,6 +252,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
|
|
241
252
|
ngx_http_variable_request_body_file,
|
242
253
|
0, 0, 0 },
|
243
254
|
|
255
|
+
{ ngx_string("request_length"), NULL, ngx_http_variable_request_length,
|
256
|
+
0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
257
|
+
|
244
258
|
{ ngx_string("request_time"), NULL, ngx_http_variable_request_time,
|
245
259
|
0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
246
260
|
|
@@ -295,6 +309,12 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
|
|
295
309
|
{ ngx_string("msec"), NULL, ngx_http_variable_msec,
|
296
310
|
0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
297
311
|
|
312
|
+
{ ngx_string("time_iso8601"), NULL, ngx_http_variable_time_iso8601,
|
313
|
+
0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
314
|
+
|
315
|
+
{ ngx_string("time_local"), NULL, ngx_http_variable_time_local,
|
316
|
+
0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
317
|
+
|
298
318
|
#if (NGX_HAVE_TCP_INFO)
|
299
319
|
{ ngx_string("tcpinfo_rtt"), NULL, ngx_http_variable_tcpinfo,
|
300
320
|
0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
|
@@ -328,6 +348,12 @@ ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags)
|
|
328
348
|
ngx_http_variable_t *v;
|
329
349
|
ngx_http_core_main_conf_t *cmcf;
|
330
350
|
|
351
|
+
if (name->len == 0) {
|
352
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
353
|
+
"invalid variable name \"$\"");
|
354
|
+
return NULL;
|
355
|
+
}
|
356
|
+
|
331
357
|
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
332
358
|
|
333
359
|
key = cmcf->variables_keys->keys.elts;
|
@@ -391,6 +417,12 @@ ngx_http_get_variable_index(ngx_conf_t *cf, ngx_str_t *name)
|
|
391
417
|
ngx_http_variable_t *v;
|
392
418
|
ngx_http_core_main_conf_t *cmcf;
|
393
419
|
|
420
|
+
if (name->len == 0) {
|
421
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
422
|
+
"invalid variable name \"$\"");
|
423
|
+
return NGX_ERROR;
|
424
|
+
}
|
425
|
+
|
394
426
|
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
395
427
|
|
396
428
|
v = cmcf->variables.elts;
|
@@ -1508,6 +1540,20 @@ ngx_http_variable_body_bytes_sent(ngx_http_request_t *r,
|
|
1508
1540
|
}
|
1509
1541
|
|
1510
1542
|
|
1543
|
+
static ngx_int_t
|
1544
|
+
ngx_http_variable_pipe(ngx_http_request_t *r,
|
1545
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
1546
|
+
{
|
1547
|
+
v->data = (u_char *) (r->pipeline ? "p" : ".");
|
1548
|
+
v->len = 1;
|
1549
|
+
v->valid = 1;
|
1550
|
+
v->no_cacheable = 0;
|
1551
|
+
v->not_found = 0;
|
1552
|
+
|
1553
|
+
return NGX_OK;
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
|
1511
1557
|
static ngx_int_t
|
1512
1558
|
ngx_http_variable_status(ngx_http_request_t *r,
|
1513
1559
|
ngx_http_variable_value_t *v, uintptr_t data)
|
@@ -1842,6 +1888,27 @@ ngx_http_variable_request_body_file(ngx_http_request_t *r,
|
|
1842
1888
|
}
|
1843
1889
|
|
1844
1890
|
|
1891
|
+
static ngx_int_t
|
1892
|
+
ngx_http_variable_request_length(ngx_http_request_t *r,
|
1893
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
1894
|
+
{
|
1895
|
+
u_char *p;
|
1896
|
+
|
1897
|
+
p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN);
|
1898
|
+
if (p == NULL) {
|
1899
|
+
return NGX_ERROR;
|
1900
|
+
}
|
1901
|
+
|
1902
|
+
v->len = ngx_sprintf(p, "%O", r->request_length) - p;
|
1903
|
+
v->valid = 1;
|
1904
|
+
v->no_cacheable = 0;
|
1905
|
+
v->not_found = 0;
|
1906
|
+
v->data = p;
|
1907
|
+
|
1908
|
+
return NGX_OK;
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
|
1845
1912
|
static ngx_int_t
|
1846
1913
|
ngx_http_variable_request_time(ngx_http_request_t *r,
|
1847
1914
|
ngx_http_variable_value_t *v, uintptr_t data)
|
@@ -1986,6 +2053,53 @@ ngx_http_variable_msec(ngx_http_request_t *r,
|
|
1986
2053
|
}
|
1987
2054
|
|
1988
2055
|
|
2056
|
+
static ngx_int_t
|
2057
|
+
ngx_http_variable_time_iso8601(ngx_http_request_t *r,
|
2058
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
2059
|
+
{
|
2060
|
+
u_char *p;
|
2061
|
+
|
2062
|
+
p = ngx_pnalloc(r->pool, ngx_cached_http_log_iso8601.len);
|
2063
|
+
if (p == NULL) {
|
2064
|
+
return NGX_ERROR;
|
2065
|
+
}
|
2066
|
+
|
2067
|
+
ngx_memcpy(p, ngx_cached_http_log_iso8601.data,
|
2068
|
+
ngx_cached_http_log_iso8601.len);
|
2069
|
+
|
2070
|
+
v->len = ngx_cached_http_log_iso8601.len;
|
2071
|
+
v->valid = 1;
|
2072
|
+
v->no_cacheable = 0;
|
2073
|
+
v->not_found = 0;
|
2074
|
+
v->data = p;
|
2075
|
+
|
2076
|
+
return NGX_OK;
|
2077
|
+
}
|
2078
|
+
|
2079
|
+
|
2080
|
+
static ngx_int_t
|
2081
|
+
ngx_http_variable_time_local(ngx_http_request_t *r,
|
2082
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
2083
|
+
{
|
2084
|
+
u_char *p;
|
2085
|
+
|
2086
|
+
p = ngx_pnalloc(r->pool, ngx_cached_http_log_time.len);
|
2087
|
+
if (p == NULL) {
|
2088
|
+
return NGX_ERROR;
|
2089
|
+
}
|
2090
|
+
|
2091
|
+
ngx_memcpy(p, ngx_cached_http_log_time.data, ngx_cached_http_log_time.len);
|
2092
|
+
|
2093
|
+
v->len = ngx_cached_http_log_time.len;
|
2094
|
+
v->valid = 1;
|
2095
|
+
v->no_cacheable = 0;
|
2096
|
+
v->not_found = 0;
|
2097
|
+
v->data = p;
|
2098
|
+
|
2099
|
+
return NGX_OK;
|
2100
|
+
}
|
2101
|
+
|
2102
|
+
|
1989
2103
|
void *
|
1990
2104
|
ngx_http_map_find(ngx_http_request_t *r, ngx_http_map_t *map, ngx_str_t *match)
|
1991
2105
|
{
|