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
@@ -5,8 +5,8 @@
|
|
5
5
|
*/
|
6
6
|
|
7
7
|
|
8
|
-
#ifndef
|
9
|
-
#define
|
8
|
+
#ifndef _NGX_HTTP_V2_MODULE_H_INCLUDED_
|
9
|
+
#define _NGX_HTTP_V2_MODULE_H_INCLUDED_
|
10
10
|
|
11
11
|
|
12
12
|
#include <ngx_config.h>
|
@@ -17,25 +17,26 @@
|
|
17
17
|
typedef struct {
|
18
18
|
size_t recv_buffer_size;
|
19
19
|
u_char *recv_buffer;
|
20
|
-
}
|
20
|
+
} ngx_http_v2_main_conf_t;
|
21
21
|
|
22
22
|
|
23
23
|
typedef struct {
|
24
24
|
size_t pool_size;
|
25
25
|
ngx_uint_t concurrent_streams;
|
26
|
+
size_t max_field_size;
|
27
|
+
size_t max_header_size;
|
26
28
|
ngx_uint_t streams_index_mask;
|
27
29
|
ngx_msec_t recv_timeout;
|
28
|
-
ngx_msec_t
|
29
|
-
|
30
|
-
} ngx_http_spdy_srv_conf_t;
|
30
|
+
ngx_msec_t idle_timeout;
|
31
|
+
} ngx_http_v2_srv_conf_t;
|
31
32
|
|
32
33
|
|
33
34
|
typedef struct {
|
34
35
|
size_t chunk_size;
|
35
|
-
}
|
36
|
+
} ngx_http_v2_loc_conf_t;
|
36
37
|
|
37
38
|
|
38
|
-
extern ngx_module_t
|
39
|
+
extern ngx_module_t ngx_http_v2_module;
|
39
40
|
|
40
41
|
|
41
|
-
#endif /*
|
42
|
+
#endif /* _NGX_HTTP_V2_MODULE_H_INCLUDED_ */
|
@@ -0,0 +1,349 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Nginx, Inc.
|
4
|
+
* Copyright (C) Valentin V. Bartenev
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
#include <ngx_http.h>
|
11
|
+
|
12
|
+
|
13
|
+
#define NGX_HTTP_V2_TABLE_SIZE 4096
|
14
|
+
|
15
|
+
|
16
|
+
static ngx_int_t ngx_http_v2_table_account(ngx_http_v2_connection_t *h2c,
|
17
|
+
size_t size);
|
18
|
+
|
19
|
+
|
20
|
+
static ngx_http_v2_header_t ngx_http_v2_static_table[] = {
|
21
|
+
{ ngx_string(":authority"), ngx_string("") },
|
22
|
+
{ ngx_string(":method"), ngx_string("GET") },
|
23
|
+
{ ngx_string(":method"), ngx_string("POST") },
|
24
|
+
{ ngx_string(":path"), ngx_string("/") },
|
25
|
+
{ ngx_string(":path"), ngx_string("/index.html") },
|
26
|
+
{ ngx_string(":scheme"), ngx_string("http") },
|
27
|
+
{ ngx_string(":scheme"), ngx_string("https") },
|
28
|
+
{ ngx_string(":status"), ngx_string("200") },
|
29
|
+
{ ngx_string(":status"), ngx_string("204") },
|
30
|
+
{ ngx_string(":status"), ngx_string("206") },
|
31
|
+
{ ngx_string(":status"), ngx_string("304") },
|
32
|
+
{ ngx_string(":status"), ngx_string("400") },
|
33
|
+
{ ngx_string(":status"), ngx_string("404") },
|
34
|
+
{ ngx_string(":status"), ngx_string("500") },
|
35
|
+
{ ngx_string("accept-charset"), ngx_string("") },
|
36
|
+
{ ngx_string("accept-encoding"), ngx_string("gzip, deflate") },
|
37
|
+
{ ngx_string("accept-language"), ngx_string("") },
|
38
|
+
{ ngx_string("accept-ranges"), ngx_string("") },
|
39
|
+
{ ngx_string("accept"), ngx_string("") },
|
40
|
+
{ ngx_string("access-control-allow-origin"), ngx_string("") },
|
41
|
+
{ ngx_string("age"), ngx_string("") },
|
42
|
+
{ ngx_string("allow"), ngx_string("") },
|
43
|
+
{ ngx_string("authorization"), ngx_string("") },
|
44
|
+
{ ngx_string("cache-control"), ngx_string("") },
|
45
|
+
{ ngx_string("content-disposition"), ngx_string("") },
|
46
|
+
{ ngx_string("content-encoding"), ngx_string("") },
|
47
|
+
{ ngx_string("content-language"), ngx_string("") },
|
48
|
+
{ ngx_string("content-length"), ngx_string("") },
|
49
|
+
{ ngx_string("content-location"), ngx_string("") },
|
50
|
+
{ ngx_string("content-range"), ngx_string("") },
|
51
|
+
{ ngx_string("content-type"), ngx_string("") },
|
52
|
+
{ ngx_string("cookie"), ngx_string("") },
|
53
|
+
{ ngx_string("date"), ngx_string("") },
|
54
|
+
{ ngx_string("etag"), ngx_string("") },
|
55
|
+
{ ngx_string("expect"), ngx_string("") },
|
56
|
+
{ ngx_string("expires"), ngx_string("") },
|
57
|
+
{ ngx_string("from"), ngx_string("") },
|
58
|
+
{ ngx_string("host"), ngx_string("") },
|
59
|
+
{ ngx_string("if-match"), ngx_string("") },
|
60
|
+
{ ngx_string("if-modified-since"), ngx_string("") },
|
61
|
+
{ ngx_string("if-none-match"), ngx_string("") },
|
62
|
+
{ ngx_string("if-range"), ngx_string("") },
|
63
|
+
{ ngx_string("if-unmodified-since"), ngx_string("") },
|
64
|
+
{ ngx_string("last-modified"), ngx_string("") },
|
65
|
+
{ ngx_string("link"), ngx_string("") },
|
66
|
+
{ ngx_string("location"), ngx_string("") },
|
67
|
+
{ ngx_string("max-forwards"), ngx_string("") },
|
68
|
+
{ ngx_string("proxy-authenticate"), ngx_string("") },
|
69
|
+
{ ngx_string("proxy-authorization"), ngx_string("") },
|
70
|
+
{ ngx_string("range"), ngx_string("") },
|
71
|
+
{ ngx_string("referer"), ngx_string("") },
|
72
|
+
{ ngx_string("refresh"), ngx_string("") },
|
73
|
+
{ ngx_string("retry-after"), ngx_string("") },
|
74
|
+
{ ngx_string("server"), ngx_string("") },
|
75
|
+
{ ngx_string("set-cookie"), ngx_string("") },
|
76
|
+
{ ngx_string("strict-transport-security"), ngx_string("") },
|
77
|
+
{ ngx_string("transfer-encoding"), ngx_string("") },
|
78
|
+
{ ngx_string("user-agent"), ngx_string("") },
|
79
|
+
{ ngx_string("vary"), ngx_string("") },
|
80
|
+
{ ngx_string("via"), ngx_string("") },
|
81
|
+
{ ngx_string("www-authenticate"), ngx_string("") },
|
82
|
+
};
|
83
|
+
|
84
|
+
#define NGX_HTTP_V2_STATIC_TABLE_ENTRIES \
|
85
|
+
(sizeof(ngx_http_v2_static_table) \
|
86
|
+
/ sizeof(ngx_http_v2_header_t))
|
87
|
+
|
88
|
+
|
89
|
+
ngx_int_t
|
90
|
+
ngx_http_v2_get_indexed_header(ngx_http_v2_connection_t *h2c, ngx_uint_t index,
|
91
|
+
ngx_uint_t name_only)
|
92
|
+
{
|
93
|
+
u_char *p;
|
94
|
+
size_t rest;
|
95
|
+
ngx_http_v2_header_t *entry;
|
96
|
+
|
97
|
+
if (index == 0) {
|
98
|
+
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
|
99
|
+
"client sent invalid hpack table index 0");
|
100
|
+
return NGX_ERROR;
|
101
|
+
}
|
102
|
+
|
103
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
|
104
|
+
"http2 get indexed %s: %ui",
|
105
|
+
name_only ? "header" : "header name", index);
|
106
|
+
|
107
|
+
index--;
|
108
|
+
|
109
|
+
if (index < NGX_HTTP_V2_STATIC_TABLE_ENTRIES) {
|
110
|
+
h2c->state.header = ngx_http_v2_static_table[index];
|
111
|
+
return NGX_OK;
|
112
|
+
}
|
113
|
+
|
114
|
+
index -= NGX_HTTP_V2_STATIC_TABLE_ENTRIES;
|
115
|
+
|
116
|
+
if (index < h2c->hpack.added - h2c->hpack.deleted) {
|
117
|
+
index = (h2c->hpack.added - index - 1) % h2c->hpack.allocated;
|
118
|
+
entry = h2c->hpack.entries[index];
|
119
|
+
|
120
|
+
p = ngx_pnalloc(h2c->state.pool, entry->name.len + 1);
|
121
|
+
if (p == NULL) {
|
122
|
+
return NGX_ERROR;
|
123
|
+
}
|
124
|
+
|
125
|
+
h2c->state.header.name.len = entry->name.len;
|
126
|
+
h2c->state.header.name.data = p;
|
127
|
+
|
128
|
+
rest = h2c->hpack.storage + NGX_HTTP_V2_TABLE_SIZE - entry->name.data;
|
129
|
+
|
130
|
+
if (entry->name.len > rest) {
|
131
|
+
p = ngx_cpymem(p, entry->name.data, rest);
|
132
|
+
p = ngx_cpymem(p, h2c->hpack.storage, entry->name.len - rest);
|
133
|
+
|
134
|
+
} else {
|
135
|
+
p = ngx_cpymem(p, entry->name.data, entry->name.len);
|
136
|
+
}
|
137
|
+
|
138
|
+
*p = '\0';
|
139
|
+
|
140
|
+
if (name_only) {
|
141
|
+
return NGX_OK;
|
142
|
+
}
|
143
|
+
|
144
|
+
p = ngx_pnalloc(h2c->state.pool, entry->value.len + 1);
|
145
|
+
if (p == NULL) {
|
146
|
+
return NGX_ERROR;
|
147
|
+
}
|
148
|
+
|
149
|
+
h2c->state.header.value.len = entry->value.len;
|
150
|
+
h2c->state.header.value.data = p;
|
151
|
+
|
152
|
+
rest = h2c->hpack.storage + NGX_HTTP_V2_TABLE_SIZE - entry->value.data;
|
153
|
+
|
154
|
+
if (entry->value.len > rest) {
|
155
|
+
p = ngx_cpymem(p, entry->value.data, rest);
|
156
|
+
p = ngx_cpymem(p, h2c->hpack.storage, entry->value.len - rest);
|
157
|
+
|
158
|
+
} else {
|
159
|
+
p = ngx_cpymem(p, entry->value.data, entry->value.len);
|
160
|
+
}
|
161
|
+
|
162
|
+
*p = '\0';
|
163
|
+
|
164
|
+
return NGX_OK;
|
165
|
+
}
|
166
|
+
|
167
|
+
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
|
168
|
+
"client sent out of bound hpack table index: %ui", index);
|
169
|
+
|
170
|
+
return NGX_ERROR;
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
ngx_int_t
|
175
|
+
ngx_http_v2_add_header(ngx_http_v2_connection_t *h2c,
|
176
|
+
ngx_http_v2_header_t *header)
|
177
|
+
{
|
178
|
+
size_t avail;
|
179
|
+
ngx_uint_t index;
|
180
|
+
ngx_http_v2_header_t *entry, **entries;
|
181
|
+
|
182
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
|
183
|
+
"http2 add header to hpack table: \"%V: %V\"",
|
184
|
+
&header->name, &header->value);
|
185
|
+
|
186
|
+
if (h2c->hpack.entries == NULL) {
|
187
|
+
h2c->hpack.allocated = 64;
|
188
|
+
h2c->hpack.size = NGX_HTTP_V2_TABLE_SIZE;
|
189
|
+
h2c->hpack.free = NGX_HTTP_V2_TABLE_SIZE;
|
190
|
+
|
191
|
+
h2c->hpack.entries = ngx_palloc(h2c->connection->pool,
|
192
|
+
sizeof(ngx_http_v2_header_t *)
|
193
|
+
* h2c->hpack.allocated);
|
194
|
+
if (h2c->hpack.entries == NULL) {
|
195
|
+
return NGX_ERROR;
|
196
|
+
}
|
197
|
+
|
198
|
+
h2c->hpack.storage = ngx_palloc(h2c->connection->pool,
|
199
|
+
h2c->hpack.free);
|
200
|
+
if (h2c->hpack.storage == NULL) {
|
201
|
+
return NGX_ERROR;
|
202
|
+
}
|
203
|
+
|
204
|
+
h2c->hpack.pos = h2c->hpack.storage;
|
205
|
+
}
|
206
|
+
|
207
|
+
if (ngx_http_v2_table_account(h2c, header->name.len + header->value.len)
|
208
|
+
!= NGX_OK)
|
209
|
+
{
|
210
|
+
return NGX_OK;
|
211
|
+
}
|
212
|
+
|
213
|
+
if (h2c->hpack.reused == h2c->hpack.deleted) {
|
214
|
+
entry = ngx_palloc(h2c->connection->pool, sizeof(ngx_http_v2_header_t));
|
215
|
+
if (entry == NULL) {
|
216
|
+
return NGX_ERROR;
|
217
|
+
}
|
218
|
+
|
219
|
+
} else {
|
220
|
+
entry = h2c->hpack.entries[h2c->hpack.reused++ % h2c->hpack.allocated];
|
221
|
+
}
|
222
|
+
|
223
|
+
avail = h2c->hpack.storage + NGX_HTTP_V2_TABLE_SIZE - h2c->hpack.pos;
|
224
|
+
|
225
|
+
entry->name.len = header->name.len;
|
226
|
+
entry->name.data = h2c->hpack.pos;
|
227
|
+
|
228
|
+
if (avail >= header->name.len) {
|
229
|
+
h2c->hpack.pos = ngx_cpymem(h2c->hpack.pos, header->name.data,
|
230
|
+
header->name.len);
|
231
|
+
} else {
|
232
|
+
ngx_memcpy(h2c->hpack.pos, header->name.data, avail);
|
233
|
+
h2c->hpack.pos = ngx_cpymem(h2c->hpack.storage,
|
234
|
+
header->name.data + avail,
|
235
|
+
header->name.len - avail);
|
236
|
+
avail = NGX_HTTP_V2_TABLE_SIZE;
|
237
|
+
}
|
238
|
+
|
239
|
+
avail -= header->name.len;
|
240
|
+
|
241
|
+
entry->value.len = header->value.len;
|
242
|
+
entry->value.data = h2c->hpack.pos;
|
243
|
+
|
244
|
+
if (avail >= header->value.len) {
|
245
|
+
h2c->hpack.pos = ngx_cpymem(h2c->hpack.pos, header->value.data,
|
246
|
+
header->value.len);
|
247
|
+
} else {
|
248
|
+
ngx_memcpy(h2c->hpack.pos, header->value.data, avail);
|
249
|
+
h2c->hpack.pos = ngx_cpymem(h2c->hpack.storage,
|
250
|
+
header->value.data + avail,
|
251
|
+
header->value.len - avail);
|
252
|
+
}
|
253
|
+
|
254
|
+
if (h2c->hpack.allocated == h2c->hpack.added - h2c->hpack.deleted) {
|
255
|
+
|
256
|
+
entries = ngx_palloc(h2c->connection->pool,
|
257
|
+
sizeof(ngx_http_v2_header_t *)
|
258
|
+
* (h2c->hpack.allocated + 64));
|
259
|
+
if (entries == NULL) {
|
260
|
+
return NGX_ERROR;
|
261
|
+
}
|
262
|
+
|
263
|
+
index = h2c->hpack.deleted % h2c->hpack.allocated;
|
264
|
+
|
265
|
+
ngx_memcpy(entries, &h2c->hpack.entries[index],
|
266
|
+
(h2c->hpack.allocated - index)
|
267
|
+
* sizeof(ngx_http_v2_header_t *));
|
268
|
+
|
269
|
+
ngx_memcpy(&entries[h2c->hpack.allocated - index], h2c->hpack.entries,
|
270
|
+
index * sizeof(ngx_http_v2_header_t *));
|
271
|
+
|
272
|
+
(void) ngx_pfree(h2c->connection->pool, h2c->hpack.entries);
|
273
|
+
|
274
|
+
h2c->hpack.entries = entries;
|
275
|
+
|
276
|
+
h2c->hpack.added = h2c->hpack.allocated;
|
277
|
+
h2c->hpack.deleted = 0;
|
278
|
+
h2c->hpack.reused = 0;
|
279
|
+
h2c->hpack.allocated += 64;
|
280
|
+
}
|
281
|
+
|
282
|
+
h2c->hpack.entries[h2c->hpack.added++ % h2c->hpack.allocated] = entry;
|
283
|
+
|
284
|
+
return NGX_OK;
|
285
|
+
}
|
286
|
+
|
287
|
+
|
288
|
+
static ngx_int_t
|
289
|
+
ngx_http_v2_table_account(ngx_http_v2_connection_t *h2c, size_t size)
|
290
|
+
{
|
291
|
+
ngx_http_v2_header_t *entry;
|
292
|
+
|
293
|
+
size += 32;
|
294
|
+
|
295
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
|
296
|
+
"http2 hpack table account: %uz free:%uz",
|
297
|
+
size, h2c->hpack.free);
|
298
|
+
|
299
|
+
if (size <= h2c->hpack.free) {
|
300
|
+
h2c->hpack.free -= size;
|
301
|
+
return NGX_OK;
|
302
|
+
}
|
303
|
+
|
304
|
+
if (size > h2c->hpack.size) {
|
305
|
+
h2c->hpack.deleted = h2c->hpack.added;
|
306
|
+
h2c->hpack.free = h2c->hpack.size;
|
307
|
+
return NGX_DECLINED;
|
308
|
+
}
|
309
|
+
|
310
|
+
do {
|
311
|
+
entry = h2c->hpack.entries[h2c->hpack.deleted++ % h2c->hpack.allocated];
|
312
|
+
h2c->hpack.free += 32 + entry->name.len + entry->value.len;
|
313
|
+
} while (size > h2c->hpack.free);
|
314
|
+
|
315
|
+
h2c->hpack.free -= size;
|
316
|
+
|
317
|
+
return NGX_OK;
|
318
|
+
}
|
319
|
+
|
320
|
+
|
321
|
+
ngx_int_t
|
322
|
+
ngx_http_v2_table_size(ngx_http_v2_connection_t *h2c, size_t size)
|
323
|
+
{
|
324
|
+
ssize_t needed;
|
325
|
+
ngx_http_v2_header_t *entry;
|
326
|
+
|
327
|
+
if (size > NGX_HTTP_V2_TABLE_SIZE) {
|
328
|
+
ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
|
329
|
+
"client sent invalid table size update: %uz", size);
|
330
|
+
|
331
|
+
return NGX_ERROR;
|
332
|
+
}
|
333
|
+
|
334
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
|
335
|
+
"http2 new hpack table size: %uz was:%uz",
|
336
|
+
size, h2c->hpack.size);
|
337
|
+
|
338
|
+
needed = h2c->hpack.size - size;
|
339
|
+
|
340
|
+
while (needed > (ssize_t) h2c->hpack.free) {
|
341
|
+
entry = h2c->hpack.entries[h2c->hpack.deleted++ % h2c->hpack.allocated];
|
342
|
+
h2c->hpack.free += 32 + entry->name.len + entry->value.len;
|
343
|
+
}
|
344
|
+
|
345
|
+
h2c->hpack.size = size;
|
346
|
+
h2c->hpack.free -= needed;
|
347
|
+
|
348
|
+
return NGX_OK;
|
349
|
+
}
|
@@ -36,13 +36,6 @@ static ngx_command_t ngx_mail_commands[] = {
|
|
36
36
|
0,
|
37
37
|
NULL },
|
38
38
|
|
39
|
-
{ ngx_string("imap"),
|
40
|
-
NGX_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
|
41
|
-
ngx_mail_block,
|
42
|
-
0,
|
43
|
-
0,
|
44
|
-
NULL },
|
45
|
-
|
46
39
|
ngx_null_command
|
47
40
|
};
|
48
41
|
|
@@ -83,10 +76,8 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
83
76
|
ngx_mail_core_srv_conf_t **cscfp;
|
84
77
|
ngx_mail_core_main_conf_t *cmcf;
|
85
78
|
|
86
|
-
if (
|
87
|
-
|
88
|
-
"the \"imap\" directive is deprecated, "
|
89
|
-
"use the \"mail\" directive instead");
|
79
|
+
if (*(ngx_mail_conf_ctx_t **) conf) {
|
80
|
+
return "is duplicate";
|
90
81
|
}
|
91
82
|
|
92
83
|
/* the main mail context */
|
@@ -100,14 +91,7 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
100
91
|
|
101
92
|
/* count the number of the mail modules and set up their indices */
|
102
93
|
|
103
|
-
ngx_mail_max_module =
|
104
|
-
for (m = 0; ngx_modules[m]; m++) {
|
105
|
-
if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
|
106
|
-
continue;
|
107
|
-
}
|
108
|
-
|
109
|
-
ngx_modules[m]->ctx_index = ngx_mail_max_module++;
|
110
|
-
}
|
94
|
+
ngx_mail_max_module = ngx_count_modules(cf->cycle, NGX_MAIL_MODULE);
|
111
95
|
|
112
96
|
|
113
97
|
/* the mail main_conf context, it is the same in the all mail contexts */
|
@@ -134,13 +118,13 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
134
118
|
* create the main_conf's and the null srv_conf's of the all mail modules
|
135
119
|
*/
|
136
120
|
|
137
|
-
for (m = 0;
|
138
|
-
if (
|
121
|
+
for (m = 0; cf->cycle->modules[m]; m++) {
|
122
|
+
if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
|
139
123
|
continue;
|
140
124
|
}
|
141
125
|
|
142
|
-
module =
|
143
|
-
mi =
|
126
|
+
module = cf->cycle->modules[m]->ctx;
|
127
|
+
mi = cf->cycle->modules[m]->ctx_index;
|
144
128
|
|
145
129
|
if (module->create_main_conf) {
|
146
130
|
ctx->main_conf[mi] = module->create_main_conf(cf);
|
@@ -178,13 +162,13 @@ ngx_mail_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
178
162
|
cmcf = ctx->main_conf[ngx_mail_core_module.ctx_index];
|
179
163
|
cscfp = cmcf->servers.elts;
|
180
164
|
|
181
|
-
for (m = 0;
|
182
|
-
if (
|
165
|
+
for (m = 0; cf->cycle->modules[m]; m++) {
|
166
|
+
if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
|
183
167
|
continue;
|
184
168
|
}
|
185
169
|
|
186
|
-
module =
|
187
|
-
mi =
|
170
|
+
module = cf->cycle->modules[m]->ctx;
|
171
|
+
mi = cf->cycle->modules[m]->ctx_index;
|
188
172
|
|
189
173
|
/* init mail{} main_conf's */
|
190
174
|
|
@@ -251,13 +235,13 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
|
|
251
235
|
struct sockaddr_in6 *sin6;
|
252
236
|
#endif
|
253
237
|
|
254
|
-
sa =
|
238
|
+
sa = &listen->u.sockaddr;
|
255
239
|
|
256
240
|
switch (sa->sa_family) {
|
257
241
|
|
258
242
|
#if (NGX_HAVE_INET6)
|
259
243
|
case AF_INET6:
|
260
|
-
sin6 =
|
244
|
+
sin6 = &listen->u.sockaddr_in6;
|
261
245
|
p = sin6->sin6_port;
|
262
246
|
break;
|
263
247
|
#endif
|
@@ -269,7 +253,7 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports,
|
|
269
253
|
#endif
|
270
254
|
|
271
255
|
default: /* AF_INET */
|
272
|
-
sin =
|
256
|
+
sin = &listen->u.sockaddr_in;
|
273
257
|
p = sin->sin_port;
|
274
258
|
break;
|
275
259
|
}
|
@@ -309,23 +293,7 @@ found:
|
|
309
293
|
return NGX_ERROR;
|
310
294
|
}
|
311
295
|
|
312
|
-
addr->
|
313
|
-
addr->socklen = listen->socklen;
|
314
|
-
addr->ctx = listen->ctx;
|
315
|
-
addr->bind = listen->bind;
|
316
|
-
addr->wildcard = listen->wildcard;
|
317
|
-
addr->so_keepalive = listen->so_keepalive;
|
318
|
-
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
|
319
|
-
addr->tcp_keepidle = listen->tcp_keepidle;
|
320
|
-
addr->tcp_keepintvl = listen->tcp_keepintvl;
|
321
|
-
addr->tcp_keepcnt = listen->tcp_keepcnt;
|
322
|
-
#endif
|
323
|
-
#if (NGX_MAIL_SSL)
|
324
|
-
addr->ssl = listen->ssl;
|
325
|
-
#endif
|
326
|
-
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
|
327
|
-
addr->ipv6only = listen->ipv6only;
|
328
|
-
#endif
|
296
|
+
addr->opt = *listen;
|
329
297
|
|
330
298
|
return NGX_OK;
|
331
299
|
}
|
@@ -334,11 +302,12 @@ found:
|
|
334
302
|
static char *
|
335
303
|
ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
|
336
304
|
{
|
337
|
-
ngx_uint_t
|
338
|
-
ngx_listening_t
|
339
|
-
ngx_mail_port_t
|
340
|
-
ngx_mail_conf_port_t
|
341
|
-
ngx_mail_conf_addr_t
|
305
|
+
ngx_uint_t i, p, last, bind_wildcard;
|
306
|
+
ngx_listening_t *ls;
|
307
|
+
ngx_mail_port_t *mport;
|
308
|
+
ngx_mail_conf_port_t *port;
|
309
|
+
ngx_mail_conf_addr_t *addr;
|
310
|
+
ngx_mail_core_srv_conf_t *cscf;
|
342
311
|
|
343
312
|
port = ports->elts;
|
344
313
|
for (p = 0; p < ports->nelts; p++) {
|
@@ -354,8 +323,8 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
|
|
354
323
|
* to the "*:port" only and ignore the other bindings
|
355
324
|
*/
|
356
325
|
|
357
|
-
if (addr[last - 1].wildcard) {
|
358
|
-
addr[last - 1].bind = 1;
|
326
|
+
if (addr[last - 1].opt.wildcard) {
|
327
|
+
addr[last - 1].opt.bind = 1;
|
359
328
|
bind_wildcard = 1;
|
360
329
|
|
361
330
|
} else {
|
@@ -366,12 +335,13 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
|
|
366
335
|
|
367
336
|
while (i < last) {
|
368
337
|
|
369
|
-
if (bind_wildcard && !addr[i].bind) {
|
338
|
+
if (bind_wildcard && !addr[i].opt.bind) {
|
370
339
|
i++;
|
371
340
|
continue;
|
372
341
|
}
|
373
342
|
|
374
|
-
ls = ngx_create_listening(cf, addr[i].sockaddr,
|
343
|
+
ls = ngx_create_listening(cf, &addr[i].opt.u.sockaddr,
|
344
|
+
addr[i].opt.socklen);
|
375
345
|
if (ls == NULL) {
|
376
346
|
return NGX_CONF_ERROR;
|
377
347
|
}
|
@@ -380,20 +350,23 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
|
|
380
350
|
ls->handler = ngx_mail_init_connection;
|
381
351
|
ls->pool_size = 256;
|
382
352
|
|
383
|
-
|
384
|
-
|
353
|
+
cscf = addr->opt.ctx->srv_conf[ngx_mail_core_module.ctx_index];
|
354
|
+
|
355
|
+
ls->logp = cscf->error_log;
|
385
356
|
ls->log.data = &ls->addr_text;
|
386
357
|
ls->log.handler = ngx_accept_log_error;
|
387
358
|
|
388
|
-
ls->
|
359
|
+
ls->backlog = addr[i].opt.backlog;
|
360
|
+
|
361
|
+
ls->keepalive = addr[i].opt.so_keepalive;
|
389
362
|
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
|
390
|
-
ls->keepidle = addr[i].tcp_keepidle;
|
391
|
-
ls->keepintvl = addr[i].tcp_keepintvl;
|
392
|
-
ls->keepcnt = addr[i].tcp_keepcnt;
|
363
|
+
ls->keepidle = addr[i].opt.tcp_keepidle;
|
364
|
+
ls->keepintvl = addr[i].opt.tcp_keepintvl;
|
365
|
+
ls->keepcnt = addr[i].opt.tcp_keepcnt;
|
393
366
|
#endif
|
394
367
|
|
395
368
|
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
|
396
|
-
ls->ipv6only = addr[i].ipv6only;
|
369
|
+
ls->ipv6only = addr[i].opt.ipv6only;
|
397
370
|
#endif
|
398
371
|
|
399
372
|
mport = ngx_palloc(cf->pool, sizeof(ngx_mail_port_t));
|
@@ -403,13 +376,7 @@ ngx_mail_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports)
|
|
403
376
|
|
404
377
|
ls->servers = mport;
|
405
378
|
|
406
|
-
|
407
|
-
mport->naddrs = last;
|
408
|
-
|
409
|
-
} else {
|
410
|
-
mport->naddrs = 1;
|
411
|
-
i = 0;
|
412
|
-
}
|
379
|
+
mport->naddrs = i + 1;
|
413
380
|
|
414
381
|
switch (ls->sockaddr->sa_family) {
|
415
382
|
#if (NGX_HAVE_INET6)
|
@@ -456,15 +423,15 @@ ngx_mail_add_addrs(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
|
456
423
|
|
457
424
|
for (i = 0; i < mport->naddrs; i++) {
|
458
425
|
|
459
|
-
sin =
|
426
|
+
sin = &addr[i].opt.u.sockaddr_in;
|
460
427
|
addrs[i].addr = sin->sin_addr.s_addr;
|
461
428
|
|
462
|
-
addrs[i].conf.ctx = addr[i].ctx;
|
429
|
+
addrs[i].conf.ctx = addr[i].opt.ctx;
|
463
430
|
#if (NGX_MAIL_SSL)
|
464
|
-
addrs[i].conf.ssl = addr[i].ssl;
|
431
|
+
addrs[i].conf.ssl = addr[i].opt.ssl;
|
465
432
|
#endif
|
466
433
|
|
467
|
-
len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf,
|
434
|
+
len = ngx_sock_ntop(&addr[i].opt.u.sockaddr, addr[i].opt.socklen, buf,
|
468
435
|
NGX_SOCKADDR_STRLEN, 1);
|
469
436
|
|
470
437
|
p = ngx_pnalloc(cf->pool, len);
|
@@ -505,15 +472,15 @@ ngx_mail_add_addrs6(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
|
505
472
|
|
506
473
|
for (i = 0; i < mport->naddrs; i++) {
|
507
474
|
|
508
|
-
sin6 =
|
475
|
+
sin6 = &addr[i].opt.u.sockaddr_in6;
|
509
476
|
addrs6[i].addr6 = sin6->sin6_addr;
|
510
477
|
|
511
|
-
addrs6[i].conf.ctx = addr[i].ctx;
|
478
|
+
addrs6[i].conf.ctx = addr[i].opt.ctx;
|
512
479
|
#if (NGX_MAIL_SSL)
|
513
|
-
addrs6[i].conf.ssl = addr[i].ssl;
|
480
|
+
addrs6[i].conf.ssl = addr[i].opt.ssl;
|
514
481
|
#endif
|
515
482
|
|
516
|
-
len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf,
|
483
|
+
len = ngx_sock_ntop(&addr[i].opt.u.sockaddr, addr[i].opt.socklen, buf,
|
517
484
|
NGX_SOCKADDR_STRLEN, 1);
|
518
485
|
|
519
486
|
p = ngx_pnalloc(cf->pool, len);
|
@@ -541,22 +508,22 @@ ngx_mail_cmp_conf_addrs(const void *one, const void *two)
|
|
541
508
|
first = (ngx_mail_conf_addr_t *) one;
|
542
509
|
second = (ngx_mail_conf_addr_t *) two;
|
543
510
|
|
544
|
-
if (first->wildcard) {
|
511
|
+
if (first->opt.wildcard) {
|
545
512
|
/* a wildcard must be the last resort, shift it to the end */
|
546
513
|
return 1;
|
547
514
|
}
|
548
515
|
|
549
|
-
if (second->wildcard) {
|
516
|
+
if (second->opt.wildcard) {
|
550
517
|
/* a wildcard must be the last resort, shift it to the end */
|
551
518
|
return -1;
|
552
519
|
}
|
553
520
|
|
554
|
-
if (first->bind && !second->bind) {
|
521
|
+
if (first->opt.bind && !second->opt.bind) {
|
555
522
|
/* shift explicit bind()ed addresses to the start */
|
556
523
|
return -1;
|
557
524
|
}
|
558
525
|
|
559
|
-
if (!first->bind && second->bind) {
|
526
|
+
if (!first->opt.bind && second->opt.bind) {
|
560
527
|
/* shift explicit bind()ed addresses to the start */
|
561
528
|
return 1;
|
562
529
|
}
|