nginxtra 1.0.15.0 → 1.2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/nginxtra +1 -1
- data/lib/nginxtra/action.rb +10 -0
- data/lib/nginxtra/actions/compile.rb +16 -2
- data/lib/nginxtra/actions/start.rb +18 -2
- data/lib/nginxtra/actions/status.rb +1 -10
- data/lib/nginxtra/actions/stop.rb +18 -0
- data/lib/nginxtra/cli.rb +12 -3
- data/lib/nginxtra/config.rb +10 -0
- data/src/nginx/CHANGES +311 -90
- data/src/nginx/CHANGES.ru +315 -88
- data/src/nginx/auto/lib/pcre/conf +22 -5
- data/src/nginx/auto/lib/pcre/make +1 -1
- data/src/nginx/auto/modules +14 -3
- data/src/nginx/auto/options +17 -3
- data/src/nginx/auto/os/freebsd +8 -0
- data/src/nginx/auto/os/linux +5 -4
- data/src/nginx/auto/os/solaris +2 -1
- data/src/nginx/auto/sources +10 -2
- data/src/nginx/auto/summary +2 -0
- data/src/nginx/auto/types/sizeof +2 -1
- data/src/nginx/auto/types/typedef +1 -1
- data/src/nginx/auto/types/uintptr_t +7 -4
- data/src/nginx/auto/unix +82 -21
- data/src/nginx/conf/fastcgi.conf +1 -0
- data/src/nginx/conf/fastcgi_params +1 -0
- data/src/nginx/conf/scgi_params +1 -0
- data/src/nginx/conf/uwsgi_params +1 -0
- data/src/nginx/man/nginx.8 +49 -49
- data/src/nginx/src/core/nginx.c +10 -12
- data/src/nginx/src/core/nginx.h +2 -2
- data/src/nginx/src/core/ngx_buf.c +9 -7
- data/src/nginx/src/core/ngx_buf.h +2 -2
- data/src/nginx/src/core/ngx_conf_file.c +4 -11
- data/src/nginx/src/core/ngx_conf_file.h +1 -1
- data/src/nginx/src/core/ngx_connection.c +52 -1
- data/src/nginx/src/core/ngx_connection.h +6 -0
- data/src/nginx/src/core/ngx_core.h +5 -0
- data/src/nginx/src/core/ngx_cycle.c +1 -1
- data/src/nginx/src/core/ngx_cycle.h +2 -2
- data/src/nginx/src/core/ngx_file.c +1 -1
- data/src/nginx/src/core/ngx_inet.c +11 -8
- data/src/nginx/src/core/ngx_murmurhash.h +1 -1
- data/src/nginx/src/core/ngx_open_file_cache.c +343 -38
- data/src/nginx/src/core/ngx_open_file_cache.h +10 -0
- data/src/nginx/src/core/ngx_output_chain.c +2 -1
- data/src/nginx/src/core/ngx_parse.h +0 -3
- data/src/nginx/src/core/ngx_rbtree.c +1 -2
- data/src/nginx/src/core/ngx_regex.c +263 -5
- data/src/nginx/src/core/ngx_regex.h +6 -2
- data/src/nginx/src/core/ngx_resolver.c +88 -21
- data/src/nginx/src/core/ngx_resolver.h +7 -8
- data/src/nginx/src/core/ngx_shmtx.c +69 -44
- data/src/nginx/src/core/ngx_shmtx.h +12 -1
- data/src/nginx/src/core/ngx_slab.c +3 -3
- data/src/nginx/src/core/ngx_slab.h +1 -1
- data/src/nginx/src/core/ngx_string.c +19 -16
- data/src/nginx/src/core/ngx_times.c +2 -2
- data/src/nginx/src/event/modules/ngx_epoll_module.c +2 -2
- data/src/nginx/src/event/modules/ngx_eventport_module.c +1 -1
- data/src/nginx/src/event/modules/ngx_kqueue_module.c +1 -1
- data/src/nginx/src/event/ngx_event.c +25 -17
- data/src/nginx/src/event/ngx_event_openssl.c +3 -1
- data/src/nginx/src/event/ngx_event_pipe.c +108 -85
- data/src/nginx/src/event/ngx_event_pipe.h +1 -2
- data/src/nginx/src/event/ngx_event_timer.c +2 -3
- data/src/nginx/src/http/modules/ngx_http_access_module.c +9 -4
- data/src/nginx/src/http/modules/ngx_http_browser_module.c +5 -3
- data/src/nginx/src/http/modules/ngx_http_chunked_filter_module.c +1 -1
- data/src/nginx/src/http/modules/ngx_http_degradation_module.c +1 -1
- data/src/nginx/src/http/modules/ngx_http_fastcgi_module.c +144 -22
- data/src/nginx/src/http/modules/ngx_http_flv_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_geo_module.c +3 -3
- data/src/nginx/src/http/modules/ngx_http_gzip_filter_module.c +20 -6
- data/src/nginx/src/http/modules/ngx_http_gzip_static_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_headers_filter_module.c +23 -27
- data/src/nginx/src/http/modules/ngx_http_image_filter_module.c +1 -3
- data/src/nginx/src/http/modules/ngx_http_index_module.c +24 -0
- data/src/nginx/src/http/modules/ngx_http_limit_conn_module.c +747 -0
- data/src/nginx/src/http/modules/ngx_http_limit_req_module.c +289 -133
- data/src/nginx/src/http/modules/ngx_http_log_module.c +34 -6
- data/src/nginx/src/http/modules/ngx_http_memcached_module.c +19 -3
- data/src/nginx/src/http/modules/ngx_http_mp4_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_proxy_module.c +1446 -239
- data/src/nginx/src/http/modules/ngx_http_realip_module.c +4 -10
- data/src/nginx/src/http/modules/ngx_http_scgi_module.c +90 -21
- data/src/nginx/src/http/modules/ngx_http_split_clients_module.c +8 -11
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.c +16 -6
- data/src/nginx/src/http/modules/ngx_http_static_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +2 -2
- data/src/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +570 -0
- data/src/nginx/src/http/modules/ngx_http_userid_filter_module.c +1 -5
- data/src/nginx/src/http/modules/ngx_http_uwsgi_module.c +77 -26
- data/src/nginx/src/http/modules/ngx_http_xslt_filter_module.c +171 -37
- data/src/nginx/src/http/modules/perl/nginx.pm +2 -1
- data/src/nginx/src/http/modules/perl/nginx.xs +4 -0
- data/src/nginx/src/http/ngx_http.c +8 -1
- data/src/nginx/src/http/ngx_http.h +1 -0
- data/src/nginx/src/http/ngx_http_busy_lock.c +2 -2
- data/src/nginx/src/http/ngx_http_cache.h +12 -1
- data/src/nginx/src/http/ngx_http_copy_filter_module.c +4 -3
- data/src/nginx/src/http/ngx_http_core_module.c +303 -37
- data/src/nginx/src/http/ngx_http_core_module.h +15 -0
- data/src/nginx/src/http/ngx_http_file_cache.c +226 -52
- data/src/nginx/src/http/ngx_http_parse.c +69 -3
- data/src/nginx/src/http/ngx_http_postpone_filter_module.c +4 -4
- data/src/nginx/src/http/ngx_http_request.c +61 -27
- data/src/nginx/src/http/ngx_http_request.h +3 -3
- data/src/nginx/src/http/ngx_http_request_body.c +1 -1
- data/src/nginx/src/http/ngx_http_script.c +6 -0
- data/src/nginx/src/http/ngx_http_upstream.c +200 -47
- data/src/nginx/src/http/ngx_http_upstream.h +20 -1
- data/src/nginx/src/http/ngx_http_upstream_round_robin.c +22 -6
- data/src/nginx/src/http/ngx_http_upstream_round_robin.h +1 -0
- data/src/nginx/src/http/ngx_http_variables.c +123 -4
- data/src/nginx/src/mail/ngx_mail.c +13 -0
- data/src/nginx/src/mail/ngx_mail.h +12 -0
- data/src/nginx/src/mail/ngx_mail_core_module.c +100 -15
- data/src/nginx/src/os/unix/ngx_daemon.c +2 -1
- data/src/nginx/src/os/unix/ngx_darwin.h +3 -0
- data/src/nginx/src/os/unix/ngx_darwin_config.h +1 -0
- data/src/nginx/src/os/unix/ngx_darwin_init.c +30 -0
- data/src/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +11 -5
- data/src/nginx/src/os/unix/ngx_errno.h +5 -0
- data/src/nginx/src/os/unix/ngx_files.h +50 -1
- data/src/nginx/src/os/unix/ngx_freebsd.h +2 -1
- data/src/nginx/src/os/unix/ngx_freebsd_config.h +2 -0
- data/src/nginx/src/os/unix/ngx_freebsd_init.c +4 -3
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +2 -2
- data/src/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +12 -6
- data/src/nginx/src/os/unix/ngx_gcc_atomic_sparc64.h +1 -1
- data/src/nginx/src/os/unix/ngx_linux_config.h +1 -0
- data/src/nginx/src/os/unix/ngx_linux_sendfile_chain.c +6 -4
- data/src/nginx/src/os/unix/ngx_os.h +0 -1
- data/src/nginx/src/os/unix/ngx_posix_config.h +3 -0
- data/src/nginx/src/os/unix/ngx_process.c +50 -11
- data/src/nginx/src/os/unix/ngx_process.h +1 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.c +6 -15
- data/src/nginx/src/os/unix/ngx_readv_chain.c +8 -0
- data/src/nginx/src/os/unix/ngx_setaffinity.c +69 -0
- data/src/nginx/src/os/unix/ngx_setaffinity.h +23 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.c +1 -1
- data/src/nginx/src/os/unix/ngx_solaris_config.h +2 -0
- data/src/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +11 -3
- data/src/nginx/src/os/unix/ngx_writev_chain.c +7 -3
- metadata +7 -4
- data/src/nginx/src/http/modules/ngx_http_limit_zone_module.c +0 -553
@@ -50,7 +50,7 @@ our @EXPORT = qw(
|
|
50
50
|
HTTP_INSUFFICIENT_STORAGE
|
51
51
|
);
|
52
52
|
|
53
|
-
our $VERSION = '1.0
|
53
|
+
our $VERSION = '1.2.0';
|
54
54
|
|
55
55
|
require XSLoader;
|
56
56
|
XSLoader::load('nginx', $VERSION);
|
@@ -132,6 +132,7 @@ Igor Sysoev
|
|
132
132
|
=head1 COPYRIGHT AND LICENSE
|
133
133
|
|
134
134
|
Copyright (C) Igor Sysoev
|
135
|
+
Copyright (C) Nginx, Inc.
|
135
136
|
|
136
137
|
|
137
138
|
=cut
|
@@ -663,6 +663,10 @@ sendfile(r, filename, offset = -1, bytes = 0)
|
|
663
663
|
of.errors = clcf->open_file_cache_errors;
|
664
664
|
of.events = clcf->open_file_cache_events;
|
665
665
|
|
666
|
+
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
667
|
+
XSRETURN_EMPTY;
|
668
|
+
}
|
669
|
+
|
666
670
|
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
667
671
|
!= NGX_OK)
|
668
672
|
{
|
@@ -1417,7 +1417,7 @@ ngx_http_optimize_servers(ngx_conf_t *cf, ngx_http_core_main_conf_t *cmcf,
|
|
1417
1417
|
|
1418
1418
|
/*
|
1419
1419
|
* check whether all name-based servers have the same
|
1420
|
-
*
|
1420
|
+
* configuration as a default server for given address:port
|
1421
1421
|
*/
|
1422
1422
|
|
1423
1423
|
addr = port[p].addrs.elts;
|
@@ -1763,6 +1763,13 @@ ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr)
|
|
1763
1763
|
ls->rcvbuf = addr->opt.rcvbuf;
|
1764
1764
|
ls->sndbuf = addr->opt.sndbuf;
|
1765
1765
|
|
1766
|
+
ls->keepalive = addr->opt.so_keepalive;
|
1767
|
+
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
|
1768
|
+
ls->keepidle = addr->opt.tcp_keepidle;
|
1769
|
+
ls->keepintvl = addr->opt.tcp_keepintvl;
|
1770
|
+
ls->keepcnt = addr->opt.tcp_keepcnt;
|
1771
|
+
#endif
|
1772
|
+
|
1766
1773
|
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
|
1767
1774
|
ls->accept_filter = addr->opt.accept_filter;
|
1768
1775
|
#endif
|
@@ -274,7 +274,7 @@ char *ngx_http_set_busy_lock_slot(ngx_conf_t *cf, ngx_command_t *cmd,
|
|
274
274
|
line.data = value[i].data + 2;
|
275
275
|
|
276
276
|
bl->timeout = ngx_parse_time(&line, 1);
|
277
|
-
if (bl->timeout == NGX_ERROR) {
|
277
|
+
if (bl->timeout == (time_t) NGX_ERROR) {
|
278
278
|
invalid = 1;
|
279
279
|
break;
|
280
280
|
}
|
@@ -300,7 +300,7 @@ char *ngx_http_set_busy_lock_slot(ngx_conf_t *cf, ngx_command_t *cmd,
|
|
300
300
|
|
301
301
|
if (bl->timeout == 0 && bl->max_waiting) {
|
302
302
|
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
303
|
-
|
303
|
+
"busy lock waiting is useless with zero timeout, ignoring");
|
304
304
|
}
|
305
305
|
|
306
306
|
return NGX_CONF_OK;
|
@@ -80,6 +80,14 @@ struct ngx_http_cache_s {
|
|
80
80
|
ngx_http_file_cache_t *file_cache;
|
81
81
|
ngx_http_file_cache_node_t *node;
|
82
82
|
|
83
|
+
ngx_msec_t lock_timeout;
|
84
|
+
ngx_msec_t wait_time;
|
85
|
+
|
86
|
+
ngx_event_t wait_event;
|
87
|
+
|
88
|
+
unsigned lock:1;
|
89
|
+
unsigned waiting:1;
|
90
|
+
|
83
91
|
unsigned updated:1;
|
84
92
|
unsigned updating:1;
|
85
93
|
unsigned exists:1;
|
@@ -119,8 +127,11 @@ struct ngx_http_file_cache_s {
|
|
119
127
|
|
120
128
|
time_t inactive;
|
121
129
|
|
122
|
-
ngx_msec_t last;
|
123
130
|
ngx_uint_t files;
|
131
|
+
ngx_uint_t loader_files;
|
132
|
+
ngx_msec_t last;
|
133
|
+
ngx_msec_t loader_sleep;
|
134
|
+
ngx_msec_t loader_threshold;
|
124
135
|
|
125
136
|
ngx_shm_zone_t *shm_zone;
|
126
137
|
};
|
@@ -74,7 +74,7 @@ ngx_module_t ngx_http_copy_filter_module = {
|
|
74
74
|
};
|
75
75
|
|
76
76
|
|
77
|
-
static ngx_http_output_body_filter_pt
|
77
|
+
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
|
78
78
|
|
79
79
|
|
80
80
|
static ngx_int_t
|
@@ -115,7 +115,8 @@ ngx_http_copy_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
115
115
|
ctx->bufs = conf->bufs;
|
116
116
|
ctx->tag = (ngx_buf_tag_t) &ngx_http_copy_filter_module;
|
117
117
|
|
118
|
-
ctx->output_filter = (ngx_output_chain_filter_pt)
|
118
|
+
ctx->output_filter = (ngx_output_chain_filter_pt)
|
119
|
+
ngx_http_next_body_filter;
|
119
120
|
ctx->filter_ctx = r;
|
120
121
|
|
121
122
|
#if (NGX_HAVE_FILE_AIO)
|
@@ -292,7 +293,7 @@ ngx_http_copy_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
292
293
|
static ngx_int_t
|
293
294
|
ngx_http_copy_filter_init(ngx_conf_t *cf)
|
294
295
|
{
|
295
|
-
|
296
|
+
ngx_http_next_body_filter = ngx_http_top_body_filter;
|
296
297
|
ngx_http_top_body_filter = ngx_http_copy_filter;
|
297
298
|
|
298
299
|
return NGX_OK;
|
@@ -76,6 +76,10 @@ static ngx_uint_t ngx_http_gzip_quantity(u_char *p, u_char *last);
|
|
76
76
|
static char *ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd,
|
77
77
|
void *conf);
|
78
78
|
#endif
|
79
|
+
#if (NGX_HAVE_OPENAT)
|
80
|
+
static char *ngx_http_disable_symlinks(ngx_conf_t *cf, ngx_command_t *cmd,
|
81
|
+
void *conf);
|
82
|
+
#endif
|
79
83
|
|
80
84
|
static char *ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data);
|
81
85
|
static char *ngx_http_core_pool_size(ngx_conf_t *cf, void *post, void *data);
|
@@ -719,7 +723,7 @@ static ngx_command_t ngx_http_core_commands[] = {
|
|
719
723
|
NULL },
|
720
724
|
|
721
725
|
{ ngx_string("resolver"),
|
722
|
-
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|
|
726
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
|
723
727
|
ngx_http_core_resolver,
|
724
728
|
NGX_HTTP_LOC_CONF_OFFSET,
|
725
729
|
0,
|
@@ -762,6 +766,17 @@ static ngx_command_t ngx_http_core_commands[] = {
|
|
762
766
|
0,
|
763
767
|
NULL },
|
764
768
|
|
769
|
+
#endif
|
770
|
+
|
771
|
+
#if (NGX_HAVE_OPENAT)
|
772
|
+
|
773
|
+
{ ngx_string("disable_symlinks"),
|
774
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
|
775
|
+
ngx_http_disable_symlinks,
|
776
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
777
|
+
0,
|
778
|
+
NULL },
|
779
|
+
|
765
780
|
#endif
|
766
781
|
|
767
782
|
ngx_null_command
|
@@ -1213,20 +1228,29 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
|
|
1213
1228
|
len = tf->name.len;
|
1214
1229
|
}
|
1215
1230
|
|
1216
|
-
|
1217
|
-
|
1231
|
+
if (!alias) {
|
1232
|
+
reserve = len > r->uri.len ? len - r->uri.len : 0;
|
1218
1233
|
|
1219
|
-
|
1234
|
+
#if (NGX_PCRE)
|
1235
|
+
} else if (clcf->regex) {
|
1236
|
+
reserve = len;
|
1237
|
+
#endif
|
1220
1238
|
|
1221
|
-
|
1239
|
+
} else {
|
1240
|
+
reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;
|
1241
|
+
}
|
1222
1242
|
|
1223
|
-
|
1243
|
+
if (reserve > allocated || !allocated) {
|
1244
|
+
|
1245
|
+
/* 16 bytes are preallocation */
|
1246
|
+
allocated = reserve + 16;
|
1247
|
+
|
1248
|
+
if (ngx_http_map_uri_to_path(r, &path, &root, allocated) == NULL) {
|
1224
1249
|
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
1225
1250
|
return NGX_OK;
|
1226
1251
|
}
|
1227
1252
|
|
1228
1253
|
name = path.data + root;
|
1229
|
-
allocated = path.len - root - (r->uri.len - alias);
|
1230
1254
|
}
|
1231
1255
|
|
1232
1256
|
if (tf->values == NULL) {
|
@@ -1298,6 +1322,11 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
|
|
1298
1322
|
of.errors = clcf->open_file_cache_errors;
|
1299
1323
|
of.events = clcf->open_file_cache_events;
|
1300
1324
|
|
1325
|
+
if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
|
1326
|
+
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
|
1327
|
+
return NGX_OK;
|
1328
|
+
}
|
1329
|
+
|
1301
1330
|
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
1302
1331
|
!= NGX_OK)
|
1303
1332
|
{
|
@@ -2456,7 +2485,6 @@ ngx_http_subrequest(ngx_http_request_t *r,
|
|
2456
2485
|
sr->start_sec = tp->sec;
|
2457
2486
|
sr->start_msec = tp->msec;
|
2458
2487
|
|
2459
|
-
r->main->subrequests++;
|
2460
2488
|
r->main->count++;
|
2461
2489
|
|
2462
2490
|
*psr = sr;
|
@@ -2510,6 +2538,7 @@ ngx_http_internal_redirect(ngx_http_request_t *r,
|
|
2510
2538
|
#endif
|
2511
2539
|
|
2512
2540
|
r->internal = 1;
|
2541
|
+
r->valid_unparsed_uri = 0;
|
2513
2542
|
r->add_uri_to_alias = 0;
|
2514
2543
|
r->main->count++;
|
2515
2544
|
|
@@ -2561,6 +2590,9 @@ ngx_http_named_location(ngx_http_request_t *r, ngx_str_t *name)
|
|
2561
2590
|
r->content_handler = NULL;
|
2562
2591
|
r->loc_conf = (*clcfp)->loc_conf;
|
2563
2592
|
|
2593
|
+
/* clear the modules contexts */
|
2594
|
+
ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
|
2595
|
+
|
2564
2596
|
ngx_http_update_location_config(r);
|
2565
2597
|
|
2566
2598
|
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
@@ -2616,6 +2648,56 @@ ngx_http_cleanup_add(ngx_http_request_t *r, size_t size)
|
|
2616
2648
|
}
|
2617
2649
|
|
2618
2650
|
|
2651
|
+
ngx_int_t
|
2652
|
+
ngx_http_set_disable_symlinks(ngx_http_request_t *r,
|
2653
|
+
ngx_http_core_loc_conf_t *clcf, ngx_str_t *path, ngx_open_file_info_t *of)
|
2654
|
+
{
|
2655
|
+
#if (NGX_HAVE_OPENAT)
|
2656
|
+
u_char *p;
|
2657
|
+
ngx_str_t from;
|
2658
|
+
|
2659
|
+
of->disable_symlinks = clcf->disable_symlinks;
|
2660
|
+
|
2661
|
+
if (clcf->disable_symlinks_from == NULL) {
|
2662
|
+
return NGX_OK;
|
2663
|
+
}
|
2664
|
+
|
2665
|
+
if (ngx_http_complex_value(r, clcf->disable_symlinks_from, &from)
|
2666
|
+
!= NGX_OK)
|
2667
|
+
{
|
2668
|
+
return NGX_ERROR;
|
2669
|
+
}
|
2670
|
+
|
2671
|
+
if (from.len == 0
|
2672
|
+
|| from.len > path->len
|
2673
|
+
|| ngx_memcmp(path->data, from.data, from.len) != 0)
|
2674
|
+
{
|
2675
|
+
return NGX_OK;
|
2676
|
+
}
|
2677
|
+
|
2678
|
+
if (from.len == path->len) {
|
2679
|
+
of->disable_symlinks = NGX_DISABLE_SYMLINKS_OFF;
|
2680
|
+
return NGX_OK;
|
2681
|
+
}
|
2682
|
+
|
2683
|
+
p = path->data + from.len;
|
2684
|
+
|
2685
|
+
if (*p == '/') {
|
2686
|
+
of->disable_symlinks_from = from.len;
|
2687
|
+
return NGX_OK;
|
2688
|
+
}
|
2689
|
+
|
2690
|
+
p--;
|
2691
|
+
|
2692
|
+
if (*p == '/') {
|
2693
|
+
of->disable_symlinks_from = from.len - 1;
|
2694
|
+
}
|
2695
|
+
#endif
|
2696
|
+
|
2697
|
+
return NGX_OK;
|
2698
|
+
}
|
2699
|
+
|
2700
|
+
|
2619
2701
|
static char *
|
2620
2702
|
ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
|
2621
2703
|
{
|
@@ -3344,6 +3426,11 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf)
|
|
3344
3426
|
#endif
|
3345
3427
|
#endif
|
3346
3428
|
|
3429
|
+
#if (NGX_HAVE_OPENAT)
|
3430
|
+
clcf->disable_symlinks = NGX_CONF_UNSET_UINT;
|
3431
|
+
clcf->disable_symlinks_from = NGX_CONF_UNSET_PTR;
|
3432
|
+
#endif
|
3433
|
+
|
3347
3434
|
return clcf;
|
3348
3435
|
}
|
3349
3436
|
|
@@ -3490,8 +3577,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
3490
3577
|
ngx_conf_merge_bitmask_value(conf->keepalive_disable,
|
3491
3578
|
prev->keepalive_disable,
|
3492
3579
|
(NGX_CONF_BITMASK_SET
|
3493
|
-
|NGX_HTTP_KEEPALIVE_DISABLE_MSIE6
|
3494
|
-
|NGX_HTTP_KEEPALIVE_DISABLE_SAFARI));
|
3580
|
+
|NGX_HTTP_KEEPALIVE_DISABLE_MSIE6));
|
3495
3581
|
ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
|
3496
3582
|
NGX_HTTP_SATISFY_ALL);
|
3497
3583
|
ngx_conf_merge_uint_value(conf->if_modified_since, prev->if_modified_since,
|
@@ -3549,7 +3635,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
3549
3635
|
* to inherit it in all servers
|
3550
3636
|
*/
|
3551
3637
|
|
3552
|
-
prev->resolver = ngx_resolver_create(cf, NULL);
|
3638
|
+
prev->resolver = ngx_resolver_create(cf, NULL, 0);
|
3553
3639
|
if (prev->resolver == NULL) {
|
3554
3640
|
return NGX_CONF_ERROR;
|
3555
3641
|
}
|
@@ -3623,6 +3709,13 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
3623
3709
|
#endif
|
3624
3710
|
#endif
|
3625
3711
|
|
3712
|
+
#if (NGX_HAVE_OPENAT)
|
3713
|
+
ngx_conf_merge_uint_value(conf->disable_symlinks, prev->disable_symlinks,
|
3714
|
+
NGX_DISABLE_SYMLINKS_OFF);
|
3715
|
+
ngx_conf_merge_ptr_value(conf->disable_symlinks_from,
|
3716
|
+
prev->disable_symlinks_from, NULL);
|
3717
|
+
#endif
|
3718
|
+
|
3626
3719
|
return NGX_CONF_OK;
|
3627
3720
|
}
|
3628
3721
|
|
@@ -3827,6 +3920,97 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
3827
3920
|
#endif
|
3828
3921
|
}
|
3829
3922
|
|
3923
|
+
if (ngx_strncmp(value[n].data, "so_keepalive=", 13) == 0) {
|
3924
|
+
|
3925
|
+
if (ngx_strcmp(&value[n].data[13], "on") == 0) {
|
3926
|
+
lsopt.so_keepalive = 1;
|
3927
|
+
|
3928
|
+
} else if (ngx_strcmp(&value[n].data[13], "off") == 0) {
|
3929
|
+
lsopt.so_keepalive = 2;
|
3930
|
+
|
3931
|
+
} else {
|
3932
|
+
|
3933
|
+
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
|
3934
|
+
u_char *p, *end;
|
3935
|
+
ngx_str_t s;
|
3936
|
+
|
3937
|
+
end = value[n].data + value[n].len;
|
3938
|
+
s.data = value[n].data + 13;
|
3939
|
+
|
3940
|
+
p = ngx_strlchr(s.data, end, ':');
|
3941
|
+
if (p == NULL) {
|
3942
|
+
p = end;
|
3943
|
+
}
|
3944
|
+
|
3945
|
+
if (p > s.data) {
|
3946
|
+
s.len = p - s.data;
|
3947
|
+
|
3948
|
+
lsopt.tcp_keepidle = ngx_parse_time(&s, 1);
|
3949
|
+
if (lsopt.tcp_keepidle == (time_t) NGX_ERROR) {
|
3950
|
+
goto invalid_so_keepalive;
|
3951
|
+
}
|
3952
|
+
}
|
3953
|
+
|
3954
|
+
s.data = (p < end) ? (p + 1) : end;
|
3955
|
+
|
3956
|
+
p = ngx_strlchr(s.data, end, ':');
|
3957
|
+
if (p == NULL) {
|
3958
|
+
p = end;
|
3959
|
+
}
|
3960
|
+
|
3961
|
+
if (p > s.data) {
|
3962
|
+
s.len = p - s.data;
|
3963
|
+
|
3964
|
+
lsopt.tcp_keepintvl = ngx_parse_time(&s, 1);
|
3965
|
+
if (lsopt.tcp_keepintvl == (time_t) NGX_ERROR) {
|
3966
|
+
goto invalid_so_keepalive;
|
3967
|
+
}
|
3968
|
+
}
|
3969
|
+
|
3970
|
+
s.data = (p < end) ? (p + 1) : end;
|
3971
|
+
|
3972
|
+
if (s.data < end) {
|
3973
|
+
s.len = end - s.data;
|
3974
|
+
|
3975
|
+
lsopt.tcp_keepcnt = ngx_atoi(s.data, s.len);
|
3976
|
+
if (lsopt.tcp_keepcnt == NGX_ERROR) {
|
3977
|
+
goto invalid_so_keepalive;
|
3978
|
+
}
|
3979
|
+
}
|
3980
|
+
|
3981
|
+
if (lsopt.tcp_keepidle == 0 && lsopt.tcp_keepintvl == 0
|
3982
|
+
&& lsopt.tcp_keepcnt == 0)
|
3983
|
+
{
|
3984
|
+
goto invalid_so_keepalive;
|
3985
|
+
}
|
3986
|
+
|
3987
|
+
lsopt.so_keepalive = 1;
|
3988
|
+
|
3989
|
+
#else
|
3990
|
+
|
3991
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
3992
|
+
"the \"so_keepalive\" parameter accepts "
|
3993
|
+
"only \"on\" or \"off\" on this platform");
|
3994
|
+
return NGX_CONF_ERROR;
|
3995
|
+
|
3996
|
+
#endif
|
3997
|
+
}
|
3998
|
+
|
3999
|
+
lsopt.set = 1;
|
4000
|
+
lsopt.bind = 1;
|
4001
|
+
|
4002
|
+
continue;
|
4003
|
+
|
4004
|
+
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
|
4005
|
+
invalid_so_keepalive:
|
4006
|
+
|
4007
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
4008
|
+
"invalid so_keepalive value: \"%s\"",
|
4009
|
+
&value[n].data[13]);
|
4010
|
+
return NGX_CONF_ERROR;
|
4011
|
+
#endif
|
4012
|
+
}
|
4013
|
+
|
3830
4014
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
3831
4015
|
"invalid parameter \"%V\"", &value[n]);
|
3832
4016
|
return NGX_CONF_ERROR;
|
@@ -4425,7 +4609,7 @@ ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4425
4609
|
s.data = value[i].data + 9;
|
4426
4610
|
|
4427
4611
|
inactive = ngx_parse_time(&s, 1);
|
4428
|
-
if (inactive
|
4612
|
+
if (inactive == (time_t) NGX_ERROR) {
|
4429
4613
|
goto failed;
|
4430
4614
|
}
|
4431
4615
|
|
@@ -4453,7 +4637,7 @@ ngx_http_core_open_file_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4453
4637
|
|
4454
4638
|
if (max == 0) {
|
4455
4639
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
4456
|
-
|
4640
|
+
"\"open_file_cache\" must have the \"max\" parameter");
|
4457
4641
|
return NGX_CONF_ERROR;
|
4458
4642
|
}
|
4459
4643
|
|
@@ -4471,7 +4655,7 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4471
4655
|
{
|
4472
4656
|
ngx_http_core_loc_conf_t *clcf = conf;
|
4473
4657
|
|
4474
|
-
ngx_str_t *value;
|
4658
|
+
ngx_str_t *value, name;
|
4475
4659
|
|
4476
4660
|
if (clcf->error_log) {
|
4477
4661
|
return "is duplicate";
|
@@ -4479,7 +4663,14 @@ ngx_http_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4479
4663
|
|
4480
4664
|
value = cf->args->elts;
|
4481
4665
|
|
4482
|
-
|
4666
|
+
if (ngx_strcmp(value[1].data, "stderr") == 0) {
|
4667
|
+
ngx_str_null(&name);
|
4668
|
+
|
4669
|
+
} else {
|
4670
|
+
name = value[1];
|
4671
|
+
}
|
4672
|
+
|
4673
|
+
clcf->error_log = ngx_log_create(cf->cycle, &name);
|
4483
4674
|
if (clcf->error_log == NULL) {
|
4484
4675
|
return NGX_CONF_ERROR;
|
4485
4676
|
}
|
@@ -4512,24 +4703,16 @@ ngx_http_core_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4512
4703
|
return "invalid value";
|
4513
4704
|
}
|
4514
4705
|
|
4515
|
-
if (clcf->keepalive_timeout == (ngx_msec_t) NGX_PARSE_LARGE_TIME) {
|
4516
|
-
return "value must be less than 597 hours";
|
4517
|
-
}
|
4518
|
-
|
4519
4706
|
if (cf->args->nelts == 2) {
|
4520
4707
|
return NGX_CONF_OK;
|
4521
4708
|
}
|
4522
4709
|
|
4523
4710
|
clcf->keepalive_header = ngx_parse_time(&value[2], 1);
|
4524
4711
|
|
4525
|
-
if (clcf->keepalive_header == NGX_ERROR) {
|
4712
|
+
if (clcf->keepalive_header == (time_t) NGX_ERROR) {
|
4526
4713
|
return "invalid value";
|
4527
4714
|
}
|
4528
4715
|
|
4529
|
-
if (clcf->keepalive_header == NGX_PARSE_LARGE_TIME) {
|
4530
|
-
return "value must be less than 68 years";
|
4531
|
-
}
|
4532
|
-
|
4533
4716
|
return NGX_CONF_OK;
|
4534
4717
|
}
|
4535
4718
|
|
@@ -4554,7 +4737,6 @@ ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4554
4737
|
{
|
4555
4738
|
ngx_http_core_loc_conf_t *clcf = conf;
|
4556
4739
|
|
4557
|
-
ngx_url_t u;
|
4558
4740
|
ngx_str_t *value;
|
4559
4741
|
|
4560
4742
|
if (clcf->resolver) {
|
@@ -4563,19 +4745,9 @@ ngx_http_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4563
4745
|
|
4564
4746
|
value = cf->args->elts;
|
4565
4747
|
|
4566
|
-
|
4567
|
-
|
4568
|
-
u.host = value[1];
|
4569
|
-
u.port = 53;
|
4570
|
-
|
4571
|
-
if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
|
4572
|
-
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V: %s", &u.host, u.err);
|
4573
|
-
return NGX_CONF_ERROR;
|
4574
|
-
}
|
4575
|
-
|
4576
|
-
clcf->resolver = ngx_resolver_create(cf, &u.addrs[0]);
|
4748
|
+
clcf->resolver = ngx_resolver_create(cf, &value[1], cf->args->nelts - 1);
|
4577
4749
|
if (clcf->resolver == NULL) {
|
4578
|
-
return
|
4750
|
+
return NGX_CONF_ERROR;
|
4579
4751
|
}
|
4580
4752
|
|
4581
4753
|
return NGX_CONF_OK;
|
@@ -4684,6 +4856,100 @@ ngx_http_gzip_disable(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
4684
4856
|
#endif
|
4685
4857
|
|
4686
4858
|
|
4859
|
+
#if (NGX_HAVE_OPENAT)
|
4860
|
+
|
4861
|
+
static char *
|
4862
|
+
ngx_http_disable_symlinks(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
4863
|
+
{
|
4864
|
+
ngx_http_core_loc_conf_t *clcf = conf;
|
4865
|
+
|
4866
|
+
ngx_str_t *value;
|
4867
|
+
ngx_uint_t i;
|
4868
|
+
ngx_http_compile_complex_value_t ccv;
|
4869
|
+
|
4870
|
+
if (clcf->disable_symlinks != NGX_CONF_UNSET_UINT) {
|
4871
|
+
return "is duplicate";
|
4872
|
+
}
|
4873
|
+
|
4874
|
+
value = cf->args->elts;
|
4875
|
+
|
4876
|
+
for (i = 1; i < cf->args->nelts; i++) {
|
4877
|
+
|
4878
|
+
if (ngx_strcmp(value[i].data, "off") == 0) {
|
4879
|
+
clcf->disable_symlinks = NGX_DISABLE_SYMLINKS_OFF;
|
4880
|
+
continue;
|
4881
|
+
}
|
4882
|
+
|
4883
|
+
if (ngx_strcmp(value[i].data, "if_not_owner") == 0) {
|
4884
|
+
clcf->disable_symlinks = NGX_DISABLE_SYMLINKS_NOTOWNER;
|
4885
|
+
continue;
|
4886
|
+
}
|
4887
|
+
|
4888
|
+
if (ngx_strcmp(value[i].data, "on") == 0) {
|
4889
|
+
clcf->disable_symlinks = NGX_DISABLE_SYMLINKS_ON;
|
4890
|
+
continue;
|
4891
|
+
}
|
4892
|
+
|
4893
|
+
if (ngx_strncmp(value[i].data, "from=", 5) == 0) {
|
4894
|
+
value[i].len -= 5;
|
4895
|
+
value[i].data += 5;
|
4896
|
+
|
4897
|
+
ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
|
4898
|
+
|
4899
|
+
ccv.cf = cf;
|
4900
|
+
ccv.value = &value[i];
|
4901
|
+
ccv.complex_value = ngx_palloc(cf->pool,
|
4902
|
+
sizeof(ngx_http_complex_value_t));
|
4903
|
+
if (ccv.complex_value == NULL) {
|
4904
|
+
return NGX_CONF_ERROR;
|
4905
|
+
}
|
4906
|
+
|
4907
|
+
if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
|
4908
|
+
return NGX_CONF_ERROR;
|
4909
|
+
}
|
4910
|
+
|
4911
|
+
clcf->disable_symlinks_from = ccv.complex_value;
|
4912
|
+
|
4913
|
+
continue;
|
4914
|
+
}
|
4915
|
+
|
4916
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
4917
|
+
"invalid parameter \"%V\"", &value[i]);
|
4918
|
+
return NGX_CONF_ERROR;
|
4919
|
+
}
|
4920
|
+
|
4921
|
+
if (clcf->disable_symlinks == NGX_CONF_UNSET_UINT) {
|
4922
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
4923
|
+
"\"%V\" must have \"off\", \"on\" "
|
4924
|
+
"or \"if_not_owner\" parameter",
|
4925
|
+
&cmd->name);
|
4926
|
+
return NGX_CONF_ERROR;
|
4927
|
+
}
|
4928
|
+
|
4929
|
+
if (cf->args->nelts == 2) {
|
4930
|
+
clcf->disable_symlinks_from = NULL;
|
4931
|
+
return NGX_CONF_OK;
|
4932
|
+
}
|
4933
|
+
|
4934
|
+
if (clcf->disable_symlinks_from == NGX_CONF_UNSET_PTR) {
|
4935
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
4936
|
+
"duplicate parameters \"%V %V\"",
|
4937
|
+
&value[1], &value[2]);
|
4938
|
+
return NGX_CONF_ERROR;
|
4939
|
+
}
|
4940
|
+
|
4941
|
+
if (clcf->disable_symlinks == NGX_DISABLE_SYMLINKS_OFF) {
|
4942
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
4943
|
+
"\"from=\" cannot be used with \"off\" parameter");
|
4944
|
+
return NGX_CONF_ERROR;
|
4945
|
+
}
|
4946
|
+
|
4947
|
+
return NGX_CONF_OK;
|
4948
|
+
}
|
4949
|
+
|
4950
|
+
#endif
|
4951
|
+
|
4952
|
+
|
4687
4953
|
static char *
|
4688
4954
|
ngx_http_core_lowat_check(ngx_conf_t *cf, void *post, void *data)
|
4689
4955
|
{
|