nginxtra 1.8.1.12 → 1.10.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/nginxtra +1 -1
- data/bin/nginxtra_rails +1 -1
- data/lib/nginxtra/version.rb +1 -1
- data/vendor/nginx/CHANGES +363 -25
- data/vendor/nginx/CHANGES.ru +365 -21
- data/vendor/nginx/LICENSE +2 -2
- data/vendor/nginx/auto/cc/conf +32 -0
- data/vendor/nginx/auto/cc/gcc +1 -1
- data/vendor/nginx/auto/cc/icc +2 -2
- data/vendor/nginx/auto/cc/msvc +29 -8
- data/vendor/nginx/auto/cc/name +2 -25
- data/vendor/nginx/auto/cc/sunc +3 -0
- data/vendor/nginx/auto/endianness +7 -2
- data/vendor/nginx/auto/install +60 -26
- data/vendor/nginx/auto/lib/conf +4 -4
- data/vendor/nginx/auto/lib/geoip/conf +6 -1
- data/vendor/nginx/auto/lib/libgd/conf +6 -1
- data/vendor/nginx/auto/lib/libxslt/conf +11 -2
- data/vendor/nginx/auto/lib/make +1 -1
- data/vendor/nginx/auto/lib/md5/conf +2 -2
- data/vendor/nginx/auto/lib/md5/make +2 -2
- data/vendor/nginx/auto/lib/openssl/conf +52 -3
- data/vendor/nginx/auto/lib/openssl/make +1 -1
- data/vendor/nginx/auto/lib/pcre/conf +2 -2
- data/vendor/nginx/auto/lib/pcre/make +2 -2
- data/vendor/nginx/auto/lib/perl/conf +6 -3
- data/vendor/nginx/auto/lib/perl/make +4 -1
- data/vendor/nginx/auto/lib/sha1/conf +2 -2
- data/vendor/nginx/auto/lib/sha1/make +2 -2
- data/vendor/nginx/auto/lib/zlib/conf +2 -2
- data/vendor/nginx/auto/lib/zlib/make +2 -2
- data/vendor/nginx/auto/make +281 -16
- data/vendor/nginx/auto/module +122 -0
- data/vendor/nginx/auto/modules +909 -178
- data/vendor/nginx/auto/options +81 -19
- data/vendor/nginx/auto/os/conf +9 -0
- data/vendor/nginx/auto/os/darwin +3 -0
- data/vendor/nginx/auto/os/freebsd +0 -20
- data/vendor/nginx/auto/os/linux +0 -12
- data/vendor/nginx/auto/os/win32 +5 -1
- data/vendor/nginx/auto/sources +11 -311
- data/vendor/nginx/auto/summary +1 -0
- data/vendor/nginx/auto/types/sizeof +5 -3
- data/vendor/nginx/auto/types/typedef +9 -4
- data/vendor/nginx/auto/types/uintptr_t +7 -2
- data/vendor/nginx/auto/unix +72 -12
- data/vendor/nginx/conf/fastcgi.conf +1 -0
- data/vendor/nginx/conf/fastcgi_params +1 -0
- data/vendor/nginx/conf/scgi_params +1 -0
- data/vendor/nginx/conf/uwsgi_params +1 -0
- data/vendor/nginx/configure +1 -1
- data/vendor/nginx/contrib/vim/syntax/nginx.vim +2 -2
- data/vendor/nginx/man/nginx.8 +6 -2
- data/vendor/nginx/src/core/nginx.c +281 -114
- data/vendor/nginx/src/core/nginx.h +2 -2
- data/vendor/nginx/src/core/ngx_conf_file.c +54 -13
- data/vendor/nginx/src/core/ngx_conf_file.h +8 -52
- data/vendor/nginx/src/core/ngx_config.h +0 -5
- data/vendor/nginx/src/core/ngx_connection.c +270 -37
- data/vendor/nginx/src/core/ngx_connection.h +35 -12
- data/vendor/nginx/src/core/ngx_core.h +4 -0
- data/vendor/nginx/src/core/ngx_crypt.c +2 -2
- data/vendor/nginx/src/core/ngx_cycle.c +72 -25
- data/vendor/nginx/src/core/ngx_cycle.h +28 -39
- data/vendor/nginx/src/core/ngx_file.c +14 -5
- data/vendor/nginx/src/core/ngx_file.h +2 -0
- data/vendor/nginx/src/core/ngx_hash.c +13 -1
- data/vendor/nginx/src/core/ngx_inet.c +20 -18
- data/vendor/nginx/src/core/ngx_log.c +12 -12
- data/vendor/nginx/src/core/ngx_log.h +13 -6
- data/vendor/nginx/src/core/ngx_module.c +360 -0
- data/vendor/nginx/src/core/ngx_module.h +307 -0
- data/vendor/nginx/src/core/ngx_open_file_cache.c +2 -2
- data/vendor/nginx/src/core/ngx_output_chain.c +8 -4
- data/vendor/nginx/src/core/ngx_palloc.c +42 -44
- data/vendor/nginx/src/{http/ngx_http_parse_time.c → core/ngx_parse_time.c} +2 -3
- data/vendor/nginx/src/core/ngx_parse_time.h +22 -0
- data/vendor/nginx/src/core/ngx_proxy_protocol.c +50 -1
- data/vendor/nginx/src/core/ngx_proxy_protocol.h +3 -1
- data/vendor/nginx/src/core/ngx_regex.c +1 -38
- data/vendor/nginx/src/core/ngx_resolver.c +1814 -320
- data/vendor/nginx/src/core/ngx_resolver.h +67 -10
- data/vendor/nginx/src/core/ngx_rwlock.c +120 -0
- data/vendor/nginx/src/core/ngx_rwlock.h +21 -0
- data/vendor/nginx/src/core/ngx_slab.c +6 -5
- data/vendor/nginx/src/core/ngx_string.c +1 -1
- data/vendor/nginx/src/core/ngx_syslog.c +11 -3
- data/vendor/nginx/src/core/ngx_syslog.h +2 -1
- data/vendor/nginx/src/core/ngx_thread_pool.c +4 -0
- data/vendor/nginx/src/core/ngx_times.c +2 -2
- data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +3 -1
- data/vendor/nginx/src/event/modules/ngx_epoll_module.c +5 -2
- data/vendor/nginx/src/event/modules/ngx_eventport_module.c +5 -5
- data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +15 -8
- data/vendor/nginx/src/event/modules/ngx_poll_module.c +0 -10
- data/vendor/nginx/src/event/modules/ngx_select_module.c +0 -10
- data/vendor/nginx/src/event/ngx_event.c +60 -103
- data/vendor/nginx/src/event/ngx_event.h +22 -26
- data/vendor/nginx/src/event/ngx_event_accept.c +414 -88
- data/vendor/nginx/src/event/ngx_event_connect.c +27 -18
- data/vendor/nginx/src/event/ngx_event_connect.h +1 -0
- data/vendor/nginx/src/event/ngx_event_openssl.c +65 -25
- data/vendor/nginx/src/event/ngx_event_openssl.h +17 -0
- data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +73 -7
- data/vendor/nginx/src/event/ngx_event_pipe.c +85 -27
- data/vendor/nginx/src/event/ngx_event_pipe.h +10 -0
- data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_chunked_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +17 -11
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +9 -9
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +0 -7
- data/vendor/nginx/src/http/modules/ngx_http_map_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +2 -1
- data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +13 -13
- data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +26 -21
- data/vendor/nginx/src/http/modules/ngx_http_random_index_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +26 -8
- data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +73 -3
- data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +5 -3
- data/vendor/nginx/src/http/modules/ngx_http_slice_filter_module.c +526 -0
- data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +7 -7
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +19 -16
- data/vendor/nginx/src/http/modules/ngx_http_static_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +373 -173
- data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +72 -46
- data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +18 -30
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +50 -39
- data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +38 -129
- data/vendor/nginx/src/http/modules/ngx_http_upstream_zone_module.c +246 -0
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +6 -5
- data/vendor/nginx/src/http/modules/perl/nginx.xs +9 -9
- data/vendor/nginx/src/http/ngx_http.c +46 -43
- data/vendor/nginx/src/http/ngx_http.h +4 -9
- data/vendor/nginx/src/http/ngx_http_cache.h +4 -0
- data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +13 -5
- data/vendor/nginx/src/http/ngx_http_core_module.c +92 -91
- data/vendor/nginx/src/http/ngx_http_core_module.h +12 -8
- data/vendor/nginx/src/http/ngx_http_file_cache.c +61 -10
- data/vendor/nginx/src/http/ngx_http_request.c +37 -50
- data/vendor/nginx/src/http/ngx_http_request.h +10 -15
- data/vendor/nginx/src/http/ngx_http_request_body.c +64 -88
- data/vendor/nginx/src/http/ngx_http_script.c +3 -3
- data/vendor/nginx/src/http/ngx_http_special_response.c +1 -4
- data/vendor/nginx/src/http/ngx_http_upstream.c +245 -109
- data/vendor/nginx/src/http/ngx_http_upstream.h +11 -5
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +212 -65
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +66 -5
- data/vendor/nginx/src/http/ngx_http_variables.c +28 -15
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +1 -1
- data/vendor/nginx/src/http/v2/ngx_http_v2.c +4349 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2.h +337 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_filter_module.c +1391 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_huff_decode.c +2714 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_huff_encode.c +254 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_module.c +469 -0
- data/vendor/nginx/src/http/{ngx_http_spdy_module.h → v2/ngx_http_v2_module.h} +10 -9
- data/vendor/nginx/src/http/v2/ngx_http_v2_table.c +349 -0
- data/vendor/nginx/src/mail/ngx_mail.c +49 -82
- data/vendor/nginx/src/mail/ngx_mail.h +16 -23
- data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +1 -1
- data/vendor/nginx/src/mail/ngx_mail_core_module.c +60 -34
- data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -12
- data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +1 -14
- data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +1 -1
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +5 -5
- data/vendor/nginx/src/os/unix/ngx_atomic.h +10 -10
- data/vendor/nginx/src/os/unix/ngx_channel.h +4 -4
- data/vendor/nginx/src/os/unix/ngx_darwin_config.h +2 -0
- data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_dlopen.c +28 -0
- data/vendor/nginx/src/os/unix/ngx_dlopen.h +31 -0
- data/vendor/nginx/src/os/unix/ngx_errno.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_files.c +313 -80
- data/vendor/nginx/src/os/unix/ngx_files.h +5 -2
- data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +3 -1
- data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +13 -0
- data/vendor/nginx/src/os/unix/ngx_linux.h +0 -2
- data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_linux_config.h +2 -6
- data/vendor/nginx/src/os/unix/ngx_linux_init.c +1 -33
- data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +55 -12
- data/vendor/nginx/src/os/unix/ngx_os.h +3 -9
- data/vendor/nginx/src/os/unix/ngx_posix_config.h +14 -1
- data/vendor/nginx/src/os/unix/ngx_posix_init.c +2 -1
- data/vendor/nginx/src/os/unix/ngx_process.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_process_cycle.c +25 -51
- data/vendor/nginx/src/os/unix/ngx_process_cycle.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_readv_chain.c +24 -28
- data/vendor/nginx/src/os/unix/ngx_recv.c +30 -79
- data/vendor/nginx/src/os/unix/ngx_send.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_setaffinity.c +14 -30
- data/vendor/nginx/src/os/unix/ngx_setaffinity.h +15 -1
- data/vendor/nginx/src/os/unix/ngx_solaris_config.h +2 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +23 -0
- data/vendor/nginx/src/os/unix/ngx_sunpro_amd64.il +3 -3
- data/vendor/nginx/src/os/unix/ngx_sunpro_x86.il +3 -3
- data/vendor/nginx/src/os/unix/ngx_udp_recv.c +5 -48
- data/vendor/nginx/src/os/unix/ngx_udp_send.c +56 -0
- data/vendor/nginx/src/stream/ngx_stream.c +564 -0
- data/vendor/nginx/src/stream/ngx_stream.h +212 -0
- data/vendor/nginx/src/stream/ngx_stream_access_module.c +451 -0
- data/vendor/nginx/src/stream/ngx_stream_core_module.c +562 -0
- data/vendor/nginx/src/stream/ngx_stream_handler.c +344 -0
- data/vendor/nginx/src/stream/ngx_stream_limit_conn_module.c +632 -0
- data/vendor/nginx/src/stream/ngx_stream_proxy_module.c +1674 -0
- data/vendor/nginx/src/stream/ngx_stream_ssl_module.c +460 -0
- data/vendor/nginx/src/stream/ngx_stream_ssl_module.h +49 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream.c +464 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream.h +107 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_hash_module.c +656 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_least_conn_module.c +307 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.c +702 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.h +139 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_zone_module.c +242 -0
- metadata +39 -15
- data/vendor/nginx/src/event/modules/ngx_aio_module.c +0 -171
- data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +0 -735
- data/vendor/nginx/src/http/ngx_http_spdy.c +0 -3701
- data/vendor/nginx/src/http/ngx_http_spdy.h +0 -261
- data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +0 -1222
- data/vendor/nginx/src/http/ngx_http_spdy_module.c +0 -408
- data/vendor/nginx/src/os/unix/ngx_aio_read.c +0 -109
- data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +0 -78
- data/vendor/nginx/src/os/unix/ngx_aio_write.c +0 -109
- data/vendor/nginx/src/os/unix/ngx_aio_write_chain.c +0 -100
@@ -124,6 +124,15 @@ ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
|
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
|
+
#if (NGX_THREADS && NGX_HAVE_PWRITEV)
|
128
|
+
|
129
|
+
if (tf->thread_write) {
|
130
|
+
return ngx_thread_write_chain_to_file(&tf->file, chain, tf->offset,
|
131
|
+
tf->pool);
|
132
|
+
}
|
133
|
+
|
134
|
+
#endif
|
135
|
+
|
127
136
|
return ngx_write_chain_to_file(&tf->file, chain, tf->offset, tf->pool);
|
128
137
|
}
|
129
138
|
|
@@ -146,7 +155,7 @@ ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
|
|
146
155
|
|
147
156
|
#if 0
|
148
157
|
for (i = 0; i < file->name.len; i++) {
|
149
|
-
|
158
|
+
file->name.data[i] = 'X';
|
150
159
|
}
|
151
160
|
#endif
|
152
161
|
|
@@ -187,7 +196,7 @@ ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
|
|
187
196
|
|
188
197
|
err = ngx_errno;
|
189
198
|
|
190
|
-
if (err ==
|
199
|
+
if (err == NGX_EEXIST_FILE) {
|
191
200
|
n = (uint32_t) ngx_next_temp_number(1);
|
192
201
|
continue;
|
193
202
|
}
|
@@ -683,7 +692,7 @@ ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to, ngx_ext_rename_file_t *ext)
|
|
683
692
|
|
684
693
|
#if (NGX_WIN32)
|
685
694
|
|
686
|
-
if (err == NGX_EEXIST) {
|
695
|
+
if (err == NGX_EEXIST || err == NGX_EEXIST_FILE) {
|
687
696
|
err = ngx_win32_rename_file(src, to, ext->log);
|
688
697
|
|
689
698
|
if (err == 0) {
|
@@ -832,7 +841,7 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
|
|
832
841
|
|
833
842
|
if ((size_t) n != len) {
|
834
843
|
ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
|
835
|
-
ngx_read_fd_n " has read only %z of %
|
844
|
+
ngx_read_fd_n " has read only %z of %O from %s",
|
836
845
|
n, size, from);
|
837
846
|
goto failed;
|
838
847
|
}
|
@@ -847,7 +856,7 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
|
|
847
856
|
|
848
857
|
if ((size_t) n != len) {
|
849
858
|
ngx_log_error(NGX_LOG_ALERT, cf->log, 0,
|
850
|
-
ngx_write_fd_n " has written only %z of %
|
859
|
+
ngx_write_fd_n " has written only %z of %O to %s",
|
851
860
|
n, size, to);
|
852
861
|
goto failed;
|
853
862
|
}
|
@@ -27,6 +27,7 @@ struct ngx_file_s {
|
|
27
27
|
ngx_int_t (*thread_handler)(ngx_thread_task_t *task,
|
28
28
|
ngx_file_t *file);
|
29
29
|
void *thread_ctx;
|
30
|
+
ngx_thread_task_t *thread_task;
|
30
31
|
#endif
|
31
32
|
|
32
33
|
#if (NGX_HAVE_FILE_AIO)
|
@@ -77,6 +78,7 @@ typedef struct {
|
|
77
78
|
unsigned log_level:8;
|
78
79
|
unsigned persistent:1;
|
79
80
|
unsigned clean:1;
|
81
|
+
unsigned thread_write:1;
|
80
82
|
} ngx_temp_file_t;
|
81
83
|
|
82
84
|
|
@@ -257,11 +257,19 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
|
|
257
257
|
ngx_uint_t i, n, key, size, start, bucket_size;
|
258
258
|
ngx_hash_elt_t *elt, **buckets;
|
259
259
|
|
260
|
+
if (hinit->max_size == 0) {
|
261
|
+
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
|
262
|
+
"could not build %s, you should "
|
263
|
+
"increase %s_max_size: %i",
|
264
|
+
hinit->name, hinit->name, hinit->max_size);
|
265
|
+
return NGX_ERROR;
|
266
|
+
}
|
267
|
+
|
260
268
|
for (n = 0; n < nelts; n++) {
|
261
269
|
if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *))
|
262
270
|
{
|
263
271
|
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
|
264
|
-
"could not build
|
272
|
+
"could not build %s, you should "
|
265
273
|
"increase %s_bucket_size: %i",
|
266
274
|
hinit->name, hinit->name, hinit->bucket_size);
|
267
275
|
return NGX_ERROR;
|
@@ -735,6 +743,10 @@ ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
|
|
735
743
|
if (key->data[i] == '.' && key->data[i + 1] == '.') {
|
736
744
|
return NGX_DECLINED;
|
737
745
|
}
|
746
|
+
|
747
|
+
if (key->data[i] == '\0') {
|
748
|
+
return NGX_DECLINED;
|
749
|
+
}
|
738
750
|
}
|
739
751
|
|
740
752
|
if (key->len > 1 && key->data[0] == '.') {
|
@@ -26,15 +26,15 @@ ngx_inet_addr(u_char *text, size_t len)
|
|
26
26
|
n = 0;
|
27
27
|
|
28
28
|
for (p = text; p < text + len; p++) {
|
29
|
-
|
30
|
-
if (octet > 255) {
|
31
|
-
return INADDR_NONE;
|
32
|
-
}
|
33
|
-
|
34
29
|
c = *p;
|
35
30
|
|
36
31
|
if (c >= '0' && c <= '9') {
|
37
32
|
octet = octet * 10 + (c - '0');
|
33
|
+
|
34
|
+
if (octet > 255) {
|
35
|
+
return INADDR_NONE;
|
36
|
+
}
|
37
|
+
|
38
38
|
continue;
|
39
39
|
}
|
40
40
|
|
@@ -348,7 +348,7 @@ ngx_inet6_ntop(u_char *p, u_char *text, size_t len)
|
|
348
348
|
continue;
|
349
349
|
}
|
350
350
|
|
351
|
-
dst = ngx_sprintf(dst, "%
|
351
|
+
dst = ngx_sprintf(dst, "%xd", p[i] * 256 + p[i + 1]);
|
352
352
|
|
353
353
|
if (i < 14) {
|
354
354
|
*dst++ = ':';
|
@@ -529,14 +529,16 @@ ngx_int_t
|
|
529
529
|
ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u)
|
530
530
|
{
|
531
531
|
u_char *p;
|
532
|
+
size_t len;
|
532
533
|
|
533
534
|
p = u->url.data;
|
535
|
+
len = u->url.len;
|
534
536
|
|
535
|
-
if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) {
|
537
|
+
if (len >= 5 && ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) {
|
536
538
|
return ngx_parse_unix_domain_url(pool, u);
|
537
539
|
}
|
538
540
|
|
539
|
-
if (p[0] == '[') {
|
541
|
+
if (len && p[0] == '[') {
|
540
542
|
return ngx_parse_inet6_url(pool, u);
|
541
543
|
}
|
542
544
|
|
@@ -1240,19 +1242,19 @@ ngx_cmp_sockaddr(struct sockaddr *sa1, socklen_t slen1,
|
|
1240
1242
|
#if (NGX_HAVE_UNIX_DOMAIN)
|
1241
1243
|
case AF_UNIX:
|
1242
1244
|
|
1243
|
-
|
1245
|
+
/* TODO length */
|
1244
1246
|
|
1245
|
-
|
1246
|
-
|
1247
|
+
saun1 = (struct sockaddr_un *) sa1;
|
1248
|
+
saun2 = (struct sockaddr_un *) sa2;
|
1247
1249
|
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1250
|
+
if (ngx_memcmp(&saun1->sun_path, &saun2->sun_path,
|
1251
|
+
sizeof(saun1->sun_path))
|
1252
|
+
!= 0)
|
1253
|
+
{
|
1254
|
+
return NGX_DECLINED;
|
1255
|
+
}
|
1254
1256
|
|
1255
|
-
|
1257
|
+
break;
|
1256
1258
|
#endif
|
1257
1259
|
|
1258
1260
|
default: /* AF_INET */
|
@@ -33,14 +33,14 @@ typedef struct {
|
|
33
33
|
|
34
34
|
static ngx_command_t ngx_errlog_commands[] = {
|
35
35
|
|
36
|
-
{ngx_string("error_log"),
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
36
|
+
{ ngx_string("error_log"),
|
37
|
+
NGX_MAIN_CONF|NGX_CONF_1MORE,
|
38
|
+
ngx_error_log,
|
39
|
+
0,
|
40
|
+
0,
|
41
|
+
NULL },
|
42
|
+
|
43
|
+
ngx_null_command
|
44
44
|
};
|
45
45
|
|
46
46
|
|
@@ -86,7 +86,7 @@ static ngx_str_t err_levels[] = {
|
|
86
86
|
|
87
87
|
static const char *debug_levels[] = {
|
88
88
|
"debug_core", "debug_alloc", "debug_mutex", "debug_event",
|
89
|
-
"debug_http", "debug_mail", "
|
89
|
+
"debug_http", "debug_mail", "debug_stream"
|
90
90
|
};
|
91
91
|
|
92
92
|
|
@@ -585,7 +585,7 @@ ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head)
|
|
585
585
|
return NGX_CONF_ERROR;
|
586
586
|
}
|
587
587
|
|
588
|
-
|
588
|
+
} else if (ngx_strncmp(value[1].data, "memory:", 7) == 0) {
|
589
589
|
|
590
590
|
#if (NGX_DEBUG)
|
591
591
|
size_t size, needed;
|
@@ -609,7 +609,7 @@ ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head)
|
|
609
609
|
return NGX_CONF_ERROR;
|
610
610
|
}
|
611
611
|
|
612
|
-
buf =
|
612
|
+
buf = ngx_pcalloc(cf->pool, sizeof(ngx_log_memory_buf_t));
|
613
613
|
if (buf == NULL) {
|
614
614
|
return NGX_CONF_ERROR;
|
615
615
|
}
|
@@ -644,7 +644,7 @@ ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head)
|
|
644
644
|
return NGX_CONF_ERROR;
|
645
645
|
#endif
|
646
646
|
|
647
|
-
|
647
|
+
} else if (ngx_strncmp(value[1].data, "syslog:", 7) == 0) {
|
648
648
|
peer = ngx_pcalloc(cf->pool, sizeof(ngx_syslog_peer_t));
|
649
649
|
if (peer == NULL) {
|
650
650
|
return NGX_CONF_ERROR;
|
@@ -29,7 +29,7 @@
|
|
29
29
|
#define NGX_LOG_DEBUG_EVENT 0x080
|
30
30
|
#define NGX_LOG_DEBUG_HTTP 0x100
|
31
31
|
#define NGX_LOG_DEBUG_MAIL 0x200
|
32
|
-
#define
|
32
|
+
#define NGX_LOG_DEBUG_STREAM 0x400
|
33
33
|
|
34
34
|
/*
|
35
35
|
* do not forget to update debug_levels[] in src/core/ngx_log.c
|
@@ -37,7 +37,7 @@
|
|
37
37
|
*/
|
38
38
|
|
39
39
|
#define NGX_LOG_DEBUG_FIRST NGX_LOG_DEBUG_CORE
|
40
|
-
#define NGX_LOG_DEBUG_LAST
|
40
|
+
#define NGX_LOG_DEBUG_LAST NGX_LOG_DEBUG_STREAM
|
41
41
|
#define NGX_LOG_DEBUG_CONNECTION 0x80000000
|
42
42
|
#define NGX_LOG_DEBUG_ALL 0x7ffffff0
|
43
43
|
|
@@ -110,7 +110,7 @@ void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
|
|
110
110
|
|
111
111
|
/*********************************/
|
112
112
|
|
113
|
-
#else /*
|
113
|
+
#else /* no variadic macros */
|
114
114
|
|
115
115
|
#define NGX_HAVE_VARIADIC_MACROS 0
|
116
116
|
|
@@ -122,7 +122,7 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err,
|
|
122
122
|
const char *fmt, ...);
|
123
123
|
|
124
124
|
|
125
|
-
#endif /*
|
125
|
+
#endif /* variadic macros */
|
126
126
|
|
127
127
|
|
128
128
|
/*********************************/
|
@@ -165,7 +165,7 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err,
|
|
165
165
|
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
|
166
166
|
|
167
167
|
|
168
|
-
#else /*
|
168
|
+
#else /* no variadic macros */
|
169
169
|
|
170
170
|
#define ngx_log_debug0(level, log, err, fmt) \
|
171
171
|
if ((log)->log_level & level) \
|
@@ -210,7 +210,7 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err,
|
|
210
210
|
|
211
211
|
#endif
|
212
212
|
|
213
|
-
#else /*
|
213
|
+
#else /* !NGX_DEBUG */
|
214
214
|
|
215
215
|
#define ngx_log_debug0(level, log, err, fmt)
|
216
216
|
#define ngx_log_debug1(level, log, err, fmt, arg1)
|
@@ -254,6 +254,13 @@ ngx_write_stderr(char *text)
|
|
254
254
|
}
|
255
255
|
|
256
256
|
|
257
|
+
static ngx_inline void
|
258
|
+
ngx_write_stdout(char *text)
|
259
|
+
{
|
260
|
+
(void) ngx_write_fd(ngx_stdout, text, ngx_strlen(text));
|
261
|
+
}
|
262
|
+
|
263
|
+
|
257
264
|
extern ngx_module_t ngx_errlog_module;
|
258
265
|
extern ngx_uint_t ngx_use_stderr;
|
259
266
|
|
@@ -0,0 +1,360 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Maxim Dounin
|
5
|
+
* Copyright (C) Nginx, Inc.
|
6
|
+
*/
|
7
|
+
|
8
|
+
|
9
|
+
#include <ngx_config.h>
|
10
|
+
#include <ngx_core.h>
|
11
|
+
|
12
|
+
|
13
|
+
#define NGX_MAX_DYNAMIC_MODULES 128
|
14
|
+
|
15
|
+
|
16
|
+
static ngx_uint_t ngx_module_index(ngx_cycle_t *cycle);
|
17
|
+
static ngx_uint_t ngx_module_ctx_index(ngx_cycle_t *cycle, ngx_uint_t type,
|
18
|
+
ngx_uint_t index);
|
19
|
+
|
20
|
+
|
21
|
+
ngx_uint_t ngx_max_module;
|
22
|
+
static ngx_uint_t ngx_modules_n;
|
23
|
+
|
24
|
+
|
25
|
+
ngx_int_t
|
26
|
+
ngx_preinit_modules(void)
|
27
|
+
{
|
28
|
+
ngx_uint_t i;
|
29
|
+
|
30
|
+
for (i = 0; ngx_modules[i]; i++) {
|
31
|
+
ngx_modules[i]->index = i;
|
32
|
+
ngx_modules[i]->name = ngx_module_names[i];
|
33
|
+
}
|
34
|
+
|
35
|
+
ngx_modules_n = i;
|
36
|
+
ngx_max_module = ngx_modules_n + NGX_MAX_DYNAMIC_MODULES;
|
37
|
+
|
38
|
+
return NGX_OK;
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
ngx_int_t
|
43
|
+
ngx_cycle_modules(ngx_cycle_t *cycle)
|
44
|
+
{
|
45
|
+
/*
|
46
|
+
* create a list of modules to be used for this cycle,
|
47
|
+
* copy static modules to it
|
48
|
+
*/
|
49
|
+
|
50
|
+
cycle->modules = ngx_pcalloc(cycle->pool, (ngx_max_module + 1)
|
51
|
+
* sizeof(ngx_module_t *));
|
52
|
+
if (cycle->modules == NULL) {
|
53
|
+
return NGX_ERROR;
|
54
|
+
}
|
55
|
+
|
56
|
+
ngx_memcpy(cycle->modules, ngx_modules,
|
57
|
+
ngx_modules_n * sizeof(ngx_module_t *));
|
58
|
+
|
59
|
+
cycle->modules_n = ngx_modules_n;
|
60
|
+
|
61
|
+
return NGX_OK;
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
ngx_int_t
|
66
|
+
ngx_init_modules(ngx_cycle_t *cycle)
|
67
|
+
{
|
68
|
+
ngx_uint_t i;
|
69
|
+
|
70
|
+
for (i = 0; cycle->modules[i]; i++) {
|
71
|
+
if (cycle->modules[i]->init_module) {
|
72
|
+
if (cycle->modules[i]->init_module(cycle) != NGX_OK) {
|
73
|
+
return NGX_ERROR;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
return NGX_OK;
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
ngx_int_t
|
83
|
+
ngx_count_modules(ngx_cycle_t *cycle, ngx_uint_t type)
|
84
|
+
{
|
85
|
+
ngx_uint_t i, next, max;
|
86
|
+
ngx_module_t *module;
|
87
|
+
|
88
|
+
next = 0;
|
89
|
+
max = 0;
|
90
|
+
|
91
|
+
/* count appropriate modules, set up their indices */
|
92
|
+
|
93
|
+
for (i = 0; cycle->modules[i]; i++) {
|
94
|
+
module = cycle->modules[i];
|
95
|
+
|
96
|
+
if (module->type != type) {
|
97
|
+
continue;
|
98
|
+
}
|
99
|
+
|
100
|
+
if (module->ctx_index != NGX_MODULE_UNSET_INDEX) {
|
101
|
+
|
102
|
+
/* if ctx_index was assigned, preserve it */
|
103
|
+
|
104
|
+
if (module->ctx_index > max) {
|
105
|
+
max = module->ctx_index;
|
106
|
+
}
|
107
|
+
|
108
|
+
if (module->ctx_index == next) {
|
109
|
+
next++;
|
110
|
+
}
|
111
|
+
|
112
|
+
continue;
|
113
|
+
}
|
114
|
+
|
115
|
+
/* search for some free index */
|
116
|
+
|
117
|
+
module->ctx_index = ngx_module_ctx_index(cycle, type, next);
|
118
|
+
|
119
|
+
if (module->ctx_index > max) {
|
120
|
+
max = module->ctx_index;
|
121
|
+
}
|
122
|
+
|
123
|
+
next = module->ctx_index + 1;
|
124
|
+
}
|
125
|
+
|
126
|
+
/*
|
127
|
+
* make sure the number returned is big enough for previous
|
128
|
+
* cycle as well, else there will be problems if the number
|
129
|
+
* will be stored in a global variable (as it's used to be)
|
130
|
+
* and we'll have to roll back to the previous cycle
|
131
|
+
*/
|
132
|
+
|
133
|
+
if (cycle->old_cycle && cycle->old_cycle->modules) {
|
134
|
+
|
135
|
+
for (i = 0; cycle->old_cycle->modules[i]; i++) {
|
136
|
+
module = cycle->old_cycle->modules[i];
|
137
|
+
|
138
|
+
if (module->type != type) {
|
139
|
+
continue;
|
140
|
+
}
|
141
|
+
|
142
|
+
if (module->ctx_index > max) {
|
143
|
+
max = module->ctx_index;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
/* prevent loading of additional modules */
|
149
|
+
|
150
|
+
cycle->modules_used = 1;
|
151
|
+
|
152
|
+
return max + 1;
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
ngx_int_t
|
157
|
+
ngx_add_module(ngx_conf_t *cf, ngx_str_t *file, ngx_module_t *module,
|
158
|
+
char **order)
|
159
|
+
{
|
160
|
+
void *rv;
|
161
|
+
ngx_uint_t i, m, before;
|
162
|
+
ngx_core_module_t *core_module;
|
163
|
+
|
164
|
+
if (cf->cycle->modules_n >= ngx_max_module) {
|
165
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
166
|
+
"too many modules loaded");
|
167
|
+
return NGX_ERROR;
|
168
|
+
}
|
169
|
+
|
170
|
+
if (module->version != nginx_version) {
|
171
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
172
|
+
"module \"%V\" version %ui instead of %ui",
|
173
|
+
file, module->version, (ngx_uint_t) nginx_version);
|
174
|
+
return NGX_ERROR;
|
175
|
+
}
|
176
|
+
|
177
|
+
if (ngx_strcmp(module->signature, NGX_MODULE_SIGNATURE) != 0) {
|
178
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
179
|
+
"module \"%V\" is not binary compatible",
|
180
|
+
file);
|
181
|
+
return NGX_ERROR;
|
182
|
+
}
|
183
|
+
|
184
|
+
for (m = 0; cf->cycle->modules[m]; m++) {
|
185
|
+
if (ngx_strcmp(cf->cycle->modules[m]->name, module->name) == 0) {
|
186
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
187
|
+
"module \"%s\" is already loaded",
|
188
|
+
module->name);
|
189
|
+
return NGX_ERROR;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/*
|
194
|
+
* if the module wasn't previously loaded, assign an index
|
195
|
+
*/
|
196
|
+
|
197
|
+
if (module->index == NGX_MODULE_UNSET_INDEX) {
|
198
|
+
module->index = ngx_module_index(cf->cycle);
|
199
|
+
|
200
|
+
if (module->index >= ngx_max_module) {
|
201
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
202
|
+
"too many modules loaded");
|
203
|
+
return NGX_ERROR;
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
/*
|
208
|
+
* put the module into the cycle->modules array
|
209
|
+
*/
|
210
|
+
|
211
|
+
before = cf->cycle->modules_n;
|
212
|
+
|
213
|
+
if (order) {
|
214
|
+
for (i = 0; order[i]; i++) {
|
215
|
+
if (ngx_strcmp(order[i], module->name) == 0) {
|
216
|
+
i++;
|
217
|
+
break;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
for ( /* void */ ; order[i]; i++) {
|
222
|
+
|
223
|
+
#if 0
|
224
|
+
ngx_log_debug2(NGX_LOG_DEBUG_CORE, cf->log, 0,
|
225
|
+
"module: %s before %s",
|
226
|
+
module->name, order[i]);
|
227
|
+
#endif
|
228
|
+
|
229
|
+
for (m = 0; m < before; m++) {
|
230
|
+
if (ngx_strcmp(cf->cycle->modules[m]->name, order[i]) == 0) {
|
231
|
+
|
232
|
+
ngx_log_debug3(NGX_LOG_DEBUG_CORE, cf->log, 0,
|
233
|
+
"module: %s before %s:%i",
|
234
|
+
module->name, order[i], m);
|
235
|
+
|
236
|
+
before = m;
|
237
|
+
break;
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
/* put the module before modules[before] */
|
244
|
+
|
245
|
+
if (before != cf->cycle->modules_n) {
|
246
|
+
ngx_memmove(&cf->cycle->modules[before + 1],
|
247
|
+
&cf->cycle->modules[before],
|
248
|
+
(cf->cycle->modules_n - before) * sizeof(ngx_module_t *));
|
249
|
+
}
|
250
|
+
|
251
|
+
cf->cycle->modules[before] = module;
|
252
|
+
cf->cycle->modules_n++;
|
253
|
+
|
254
|
+
if (module->type == NGX_CORE_MODULE) {
|
255
|
+
|
256
|
+
/*
|
257
|
+
* we are smart enough to initialize core modules;
|
258
|
+
* other modules are expected to be loaded before
|
259
|
+
* initialization - e.g., http modules must be loaded
|
260
|
+
* before http{} block
|
261
|
+
*/
|
262
|
+
|
263
|
+
core_module = module->ctx;
|
264
|
+
|
265
|
+
if (core_module->create_conf) {
|
266
|
+
rv = core_module->create_conf(cf->cycle);
|
267
|
+
if (rv == NULL) {
|
268
|
+
return NGX_ERROR;
|
269
|
+
}
|
270
|
+
|
271
|
+
cf->cycle->conf_ctx[module->index] = rv;
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
275
|
+
return NGX_OK;
|
276
|
+
}
|
277
|
+
|
278
|
+
|
279
|
+
static ngx_uint_t
|
280
|
+
ngx_module_index(ngx_cycle_t *cycle)
|
281
|
+
{
|
282
|
+
ngx_uint_t i, index;
|
283
|
+
ngx_module_t *module;
|
284
|
+
|
285
|
+
index = 0;
|
286
|
+
|
287
|
+
again:
|
288
|
+
|
289
|
+
/* find an unused index */
|
290
|
+
|
291
|
+
for (i = 0; cycle->modules[i]; i++) {
|
292
|
+
module = cycle->modules[i];
|
293
|
+
|
294
|
+
if (module->index == index) {
|
295
|
+
index++;
|
296
|
+
goto again;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
/* check previous cycle */
|
301
|
+
|
302
|
+
if (cycle->old_cycle && cycle->old_cycle->modules) {
|
303
|
+
|
304
|
+
for (i = 0; cycle->old_cycle->modules[i]; i++) {
|
305
|
+
module = cycle->old_cycle->modules[i];
|
306
|
+
|
307
|
+
if (module->index == index) {
|
308
|
+
index++;
|
309
|
+
goto again;
|
310
|
+
}
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
return index;
|
315
|
+
}
|
316
|
+
|
317
|
+
|
318
|
+
static ngx_uint_t
|
319
|
+
ngx_module_ctx_index(ngx_cycle_t *cycle, ngx_uint_t type, ngx_uint_t index)
|
320
|
+
{
|
321
|
+
ngx_uint_t i;
|
322
|
+
ngx_module_t *module;
|
323
|
+
|
324
|
+
again:
|
325
|
+
|
326
|
+
/* find an unused ctx_index */
|
327
|
+
|
328
|
+
for (i = 0; cycle->modules[i]; i++) {
|
329
|
+
module = cycle->modules[i];
|
330
|
+
|
331
|
+
if (module->type != type) {
|
332
|
+
continue;
|
333
|
+
}
|
334
|
+
|
335
|
+
if (module->ctx_index == index) {
|
336
|
+
index++;
|
337
|
+
goto again;
|
338
|
+
}
|
339
|
+
}
|
340
|
+
|
341
|
+
/* check previous cycle */
|
342
|
+
|
343
|
+
if (cycle->old_cycle && cycle->old_cycle->modules) {
|
344
|
+
|
345
|
+
for (i = 0; cycle->old_cycle->modules[i]; i++) {
|
346
|
+
module = cycle->old_cycle->modules[i];
|
347
|
+
|
348
|
+
if (module->type != type) {
|
349
|
+
continue;
|
350
|
+
}
|
351
|
+
|
352
|
+
if (module->ctx_index == index) {
|
353
|
+
index++;
|
354
|
+
goto again;
|
355
|
+
}
|
356
|
+
}
|
357
|
+
}
|
358
|
+
|
359
|
+
return index;
|
360
|
+
}
|