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.
Files changed (238) hide show
  1. checksums.yaml +4 -4
  2. data/bin/nginxtra +1 -1
  3. data/bin/nginxtra_rails +1 -1
  4. data/lib/nginxtra/version.rb +1 -1
  5. data/vendor/nginx/CHANGES +363 -25
  6. data/vendor/nginx/CHANGES.ru +365 -21
  7. data/vendor/nginx/LICENSE +2 -2
  8. data/vendor/nginx/auto/cc/conf +32 -0
  9. data/vendor/nginx/auto/cc/gcc +1 -1
  10. data/vendor/nginx/auto/cc/icc +2 -2
  11. data/vendor/nginx/auto/cc/msvc +29 -8
  12. data/vendor/nginx/auto/cc/name +2 -25
  13. data/vendor/nginx/auto/cc/sunc +3 -0
  14. data/vendor/nginx/auto/endianness +7 -2
  15. data/vendor/nginx/auto/install +60 -26
  16. data/vendor/nginx/auto/lib/conf +4 -4
  17. data/vendor/nginx/auto/lib/geoip/conf +6 -1
  18. data/vendor/nginx/auto/lib/libgd/conf +6 -1
  19. data/vendor/nginx/auto/lib/libxslt/conf +11 -2
  20. data/vendor/nginx/auto/lib/make +1 -1
  21. data/vendor/nginx/auto/lib/md5/conf +2 -2
  22. data/vendor/nginx/auto/lib/md5/make +2 -2
  23. data/vendor/nginx/auto/lib/openssl/conf +52 -3
  24. data/vendor/nginx/auto/lib/openssl/make +1 -1
  25. data/vendor/nginx/auto/lib/pcre/conf +2 -2
  26. data/vendor/nginx/auto/lib/pcre/make +2 -2
  27. data/vendor/nginx/auto/lib/perl/conf +6 -3
  28. data/vendor/nginx/auto/lib/perl/make +4 -1
  29. data/vendor/nginx/auto/lib/sha1/conf +2 -2
  30. data/vendor/nginx/auto/lib/sha1/make +2 -2
  31. data/vendor/nginx/auto/lib/zlib/conf +2 -2
  32. data/vendor/nginx/auto/lib/zlib/make +2 -2
  33. data/vendor/nginx/auto/make +281 -16
  34. data/vendor/nginx/auto/module +122 -0
  35. data/vendor/nginx/auto/modules +909 -178
  36. data/vendor/nginx/auto/options +81 -19
  37. data/vendor/nginx/auto/os/conf +9 -0
  38. data/vendor/nginx/auto/os/darwin +3 -0
  39. data/vendor/nginx/auto/os/freebsd +0 -20
  40. data/vendor/nginx/auto/os/linux +0 -12
  41. data/vendor/nginx/auto/os/win32 +5 -1
  42. data/vendor/nginx/auto/sources +11 -311
  43. data/vendor/nginx/auto/summary +1 -0
  44. data/vendor/nginx/auto/types/sizeof +5 -3
  45. data/vendor/nginx/auto/types/typedef +9 -4
  46. data/vendor/nginx/auto/types/uintptr_t +7 -2
  47. data/vendor/nginx/auto/unix +72 -12
  48. data/vendor/nginx/conf/fastcgi.conf +1 -0
  49. data/vendor/nginx/conf/fastcgi_params +1 -0
  50. data/vendor/nginx/conf/scgi_params +1 -0
  51. data/vendor/nginx/conf/uwsgi_params +1 -0
  52. data/vendor/nginx/configure +1 -1
  53. data/vendor/nginx/contrib/vim/syntax/nginx.vim +2 -2
  54. data/vendor/nginx/man/nginx.8 +6 -2
  55. data/vendor/nginx/src/core/nginx.c +281 -114
  56. data/vendor/nginx/src/core/nginx.h +2 -2
  57. data/vendor/nginx/src/core/ngx_conf_file.c +54 -13
  58. data/vendor/nginx/src/core/ngx_conf_file.h +8 -52
  59. data/vendor/nginx/src/core/ngx_config.h +0 -5
  60. data/vendor/nginx/src/core/ngx_connection.c +270 -37
  61. data/vendor/nginx/src/core/ngx_connection.h +35 -12
  62. data/vendor/nginx/src/core/ngx_core.h +4 -0
  63. data/vendor/nginx/src/core/ngx_crypt.c +2 -2
  64. data/vendor/nginx/src/core/ngx_cycle.c +72 -25
  65. data/vendor/nginx/src/core/ngx_cycle.h +28 -39
  66. data/vendor/nginx/src/core/ngx_file.c +14 -5
  67. data/vendor/nginx/src/core/ngx_file.h +2 -0
  68. data/vendor/nginx/src/core/ngx_hash.c +13 -1
  69. data/vendor/nginx/src/core/ngx_inet.c +20 -18
  70. data/vendor/nginx/src/core/ngx_log.c +12 -12
  71. data/vendor/nginx/src/core/ngx_log.h +13 -6
  72. data/vendor/nginx/src/core/ngx_module.c +360 -0
  73. data/vendor/nginx/src/core/ngx_module.h +307 -0
  74. data/vendor/nginx/src/core/ngx_open_file_cache.c +2 -2
  75. data/vendor/nginx/src/core/ngx_output_chain.c +8 -4
  76. data/vendor/nginx/src/core/ngx_palloc.c +42 -44
  77. data/vendor/nginx/src/{http/ngx_http_parse_time.c → core/ngx_parse_time.c} +2 -3
  78. data/vendor/nginx/src/core/ngx_parse_time.h +22 -0
  79. data/vendor/nginx/src/core/ngx_proxy_protocol.c +50 -1
  80. data/vendor/nginx/src/core/ngx_proxy_protocol.h +3 -1
  81. data/vendor/nginx/src/core/ngx_regex.c +1 -38
  82. data/vendor/nginx/src/core/ngx_resolver.c +1814 -320
  83. data/vendor/nginx/src/core/ngx_resolver.h +67 -10
  84. data/vendor/nginx/src/core/ngx_rwlock.c +120 -0
  85. data/vendor/nginx/src/core/ngx_rwlock.h +21 -0
  86. data/vendor/nginx/src/core/ngx_slab.c +6 -5
  87. data/vendor/nginx/src/core/ngx_string.c +1 -1
  88. data/vendor/nginx/src/core/ngx_syslog.c +11 -3
  89. data/vendor/nginx/src/core/ngx_syslog.h +2 -1
  90. data/vendor/nginx/src/core/ngx_thread_pool.c +4 -0
  91. data/vendor/nginx/src/core/ngx_times.c +2 -2
  92. data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +3 -1
  93. data/vendor/nginx/src/event/modules/ngx_epoll_module.c +5 -2
  94. data/vendor/nginx/src/event/modules/ngx_eventport_module.c +5 -5
  95. data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +15 -8
  96. data/vendor/nginx/src/event/modules/ngx_poll_module.c +0 -10
  97. data/vendor/nginx/src/event/modules/ngx_select_module.c +0 -10
  98. data/vendor/nginx/src/event/ngx_event.c +60 -103
  99. data/vendor/nginx/src/event/ngx_event.h +22 -26
  100. data/vendor/nginx/src/event/ngx_event_accept.c +414 -88
  101. data/vendor/nginx/src/event/ngx_event_connect.c +27 -18
  102. data/vendor/nginx/src/event/ngx_event_connect.h +1 -0
  103. data/vendor/nginx/src/event/ngx_event_openssl.c +65 -25
  104. data/vendor/nginx/src/event/ngx_event_openssl.h +17 -0
  105. data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +73 -7
  106. data/vendor/nginx/src/event/ngx_event_pipe.c +85 -27
  107. data/vendor/nginx/src/event/ngx_event_pipe.h +10 -0
  108. data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
  109. data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +2 -2
  110. data/vendor/nginx/src/http/modules/ngx_http_chunked_filter_module.c +2 -2
  111. data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +6 -6
  112. data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +17 -11
  113. data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +2 -2
  114. data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +9 -9
  115. data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +2 -2
  116. data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +2 -2
  117. data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +0 -7
  118. data/vendor/nginx/src/http/modules/ngx_http_map_module.c +6 -6
  119. data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +2 -1
  120. data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +13 -13
  121. data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +2 -2
  122. data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +26 -21
  123. data/vendor/nginx/src/http/modules/ngx_http_random_index_module.c +1 -1
  124. data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +26 -8
  125. data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +73 -3
  126. data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +1 -1
  127. data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +6 -6
  128. data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +5 -3
  129. data/vendor/nginx/src/http/modules/ngx_http_slice_filter_module.c +526 -0
  130. data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +7 -7
  131. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +19 -16
  132. data/vendor/nginx/src/http/modules/ngx_http_static_module.c +1 -1
  133. data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +1 -1
  134. data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +373 -173
  135. data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +72 -46
  136. data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +18 -30
  137. data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +50 -39
  138. data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +38 -129
  139. data/vendor/nginx/src/http/modules/ngx_http_upstream_zone_module.c +246 -0
  140. data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +6 -5
  141. data/vendor/nginx/src/http/modules/perl/nginx.xs +9 -9
  142. data/vendor/nginx/src/http/ngx_http.c +46 -43
  143. data/vendor/nginx/src/http/ngx_http.h +4 -9
  144. data/vendor/nginx/src/http/ngx_http_cache.h +4 -0
  145. data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +13 -5
  146. data/vendor/nginx/src/http/ngx_http_core_module.c +92 -91
  147. data/vendor/nginx/src/http/ngx_http_core_module.h +12 -8
  148. data/vendor/nginx/src/http/ngx_http_file_cache.c +61 -10
  149. data/vendor/nginx/src/http/ngx_http_request.c +37 -50
  150. data/vendor/nginx/src/http/ngx_http_request.h +10 -15
  151. data/vendor/nginx/src/http/ngx_http_request_body.c +64 -88
  152. data/vendor/nginx/src/http/ngx_http_script.c +3 -3
  153. data/vendor/nginx/src/http/ngx_http_special_response.c +1 -4
  154. data/vendor/nginx/src/http/ngx_http_upstream.c +245 -109
  155. data/vendor/nginx/src/http/ngx_http_upstream.h +11 -5
  156. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +212 -65
  157. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +66 -5
  158. data/vendor/nginx/src/http/ngx_http_variables.c +28 -15
  159. data/vendor/nginx/src/http/ngx_http_write_filter_module.c +1 -1
  160. data/vendor/nginx/src/http/v2/ngx_http_v2.c +4349 -0
  161. data/vendor/nginx/src/http/v2/ngx_http_v2.h +337 -0
  162. data/vendor/nginx/src/http/v2/ngx_http_v2_filter_module.c +1391 -0
  163. data/vendor/nginx/src/http/v2/ngx_http_v2_huff_decode.c +2714 -0
  164. data/vendor/nginx/src/http/v2/ngx_http_v2_huff_encode.c +254 -0
  165. data/vendor/nginx/src/http/v2/ngx_http_v2_module.c +469 -0
  166. data/vendor/nginx/src/http/{ngx_http_spdy_module.h → v2/ngx_http_v2_module.h} +10 -9
  167. data/vendor/nginx/src/http/v2/ngx_http_v2_table.c +349 -0
  168. data/vendor/nginx/src/mail/ngx_mail.c +49 -82
  169. data/vendor/nginx/src/mail/ngx_mail.h +16 -23
  170. data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +1 -1
  171. data/vendor/nginx/src/mail/ngx_mail_core_module.c +60 -34
  172. data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -12
  173. data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +1 -14
  174. data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +1 -1
  175. data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +5 -5
  176. data/vendor/nginx/src/os/unix/ngx_atomic.h +10 -10
  177. data/vendor/nginx/src/os/unix/ngx_channel.h +4 -4
  178. data/vendor/nginx/src/os/unix/ngx_darwin_config.h +2 -0
  179. data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -0
  180. data/vendor/nginx/src/os/unix/ngx_dlopen.c +28 -0
  181. data/vendor/nginx/src/os/unix/ngx_dlopen.h +31 -0
  182. data/vendor/nginx/src/os/unix/ngx_errno.h +1 -0
  183. data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +1 -1
  184. data/vendor/nginx/src/os/unix/ngx_files.c +313 -80
  185. data/vendor/nginx/src/os/unix/ngx_files.h +5 -2
  186. data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +3 -1
  187. data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -0
  188. data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +13 -0
  189. data/vendor/nginx/src/os/unix/ngx_linux.h +0 -2
  190. data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +1 -1
  191. data/vendor/nginx/src/os/unix/ngx_linux_config.h +2 -6
  192. data/vendor/nginx/src/os/unix/ngx_linux_init.c +1 -33
  193. data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +55 -12
  194. data/vendor/nginx/src/os/unix/ngx_os.h +3 -9
  195. data/vendor/nginx/src/os/unix/ngx_posix_config.h +14 -1
  196. data/vendor/nginx/src/os/unix/ngx_posix_init.c +2 -1
  197. data/vendor/nginx/src/os/unix/ngx_process.c +1 -1
  198. data/vendor/nginx/src/os/unix/ngx_process_cycle.c +25 -51
  199. data/vendor/nginx/src/os/unix/ngx_process_cycle.h +1 -0
  200. data/vendor/nginx/src/os/unix/ngx_readv_chain.c +24 -28
  201. data/vendor/nginx/src/os/unix/ngx_recv.c +30 -79
  202. data/vendor/nginx/src/os/unix/ngx_send.c +1 -1
  203. data/vendor/nginx/src/os/unix/ngx_setaffinity.c +14 -30
  204. data/vendor/nginx/src/os/unix/ngx_setaffinity.h +15 -1
  205. data/vendor/nginx/src/os/unix/ngx_solaris_config.h +2 -0
  206. data/vendor/nginx/src/os/unix/ngx_solaris_init.c +1 -0
  207. data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +23 -0
  208. data/vendor/nginx/src/os/unix/ngx_sunpro_amd64.il +3 -3
  209. data/vendor/nginx/src/os/unix/ngx_sunpro_x86.il +3 -3
  210. data/vendor/nginx/src/os/unix/ngx_udp_recv.c +5 -48
  211. data/vendor/nginx/src/os/unix/ngx_udp_send.c +56 -0
  212. data/vendor/nginx/src/stream/ngx_stream.c +564 -0
  213. data/vendor/nginx/src/stream/ngx_stream.h +212 -0
  214. data/vendor/nginx/src/stream/ngx_stream_access_module.c +451 -0
  215. data/vendor/nginx/src/stream/ngx_stream_core_module.c +562 -0
  216. data/vendor/nginx/src/stream/ngx_stream_handler.c +344 -0
  217. data/vendor/nginx/src/stream/ngx_stream_limit_conn_module.c +632 -0
  218. data/vendor/nginx/src/stream/ngx_stream_proxy_module.c +1674 -0
  219. data/vendor/nginx/src/stream/ngx_stream_ssl_module.c +460 -0
  220. data/vendor/nginx/src/stream/ngx_stream_ssl_module.h +49 -0
  221. data/vendor/nginx/src/stream/ngx_stream_upstream.c +464 -0
  222. data/vendor/nginx/src/stream/ngx_stream_upstream.h +107 -0
  223. data/vendor/nginx/src/stream/ngx_stream_upstream_hash_module.c +656 -0
  224. data/vendor/nginx/src/stream/ngx_stream_upstream_least_conn_module.c +307 -0
  225. data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.c +702 -0
  226. data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.h +139 -0
  227. data/vendor/nginx/src/stream/ngx_stream_upstream_zone_module.c +242 -0
  228. metadata +39 -15
  229. data/vendor/nginx/src/event/modules/ngx_aio_module.c +0 -171
  230. data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +0 -735
  231. data/vendor/nginx/src/http/ngx_http_spdy.c +0 -3701
  232. data/vendor/nginx/src/http/ngx_http_spdy.h +0 -261
  233. data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +0 -1222
  234. data/vendor/nginx/src/http/ngx_http_spdy_module.c +0 -408
  235. data/vendor/nginx/src/os/unix/ngx_aio_read.c +0 -109
  236. data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +0 -78
  237. data/vendor/nginx/src/os/unix/ngx_aio_write.c +0 -109
  238. data/vendor/nginx/src/os/unix/ngx_aio_write_chain.c +0 -100
@@ -27,7 +27,18 @@ typedef struct {
27
27
 
28
28
 
29
29
  typedef struct {
30
- u_char sockaddr[NGX_SOCKADDRLEN];
30
+ union {
31
+ struct sockaddr sockaddr;
32
+ struct sockaddr_in sockaddr_in;
33
+ #if (NGX_HAVE_INET6)
34
+ struct sockaddr_in6 sockaddr_in6;
35
+ #endif
36
+ #if (NGX_HAVE_UNIX_DOMAIN)
37
+ struct sockaddr_un sockaddr_un;
38
+ #endif
39
+ u_char sockaddr_data[NGX_SOCKADDRLEN];
40
+ } u;
41
+
31
42
  socklen_t socklen;
32
43
 
33
44
  /* server ctx */
@@ -47,6 +58,7 @@ typedef struct {
47
58
  int tcp_keepintvl;
48
59
  int tcp_keepcnt;
49
60
  #endif
61
+ int backlog;
50
62
  } ngx_mail_listen_t;
51
63
 
52
64
 
@@ -89,25 +101,7 @@ typedef struct {
89
101
 
90
102
 
91
103
  typedef struct {
92
- struct sockaddr *sockaddr;
93
- socklen_t socklen;
94
-
95
- ngx_mail_conf_ctx_t *ctx;
96
-
97
- unsigned bind:1;
98
- unsigned wildcard:1;
99
- #if (NGX_MAIL_SSL)
100
- unsigned ssl:1;
101
- #endif
102
- #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
103
- unsigned ipv6only:1;
104
- #endif
105
- unsigned so_keepalive:2;
106
- #if (NGX_HAVE_KEEPALIVE_TUNABLE)
107
- int tcp_keepidle;
108
- int tcp_keepintvl;
109
- int tcp_keepcnt;
110
- #endif
104
+ ngx_mail_listen_t opt;
111
105
  } ngx_mail_conf_addr_t;
112
106
 
113
107
 
@@ -131,14 +125,13 @@ typedef struct {
131
125
  ngx_msec_t timeout;
132
126
  ngx_msec_t resolver_timeout;
133
127
 
134
- ngx_flag_t so_keepalive;
135
-
136
128
  ngx_str_t server_name;
137
129
 
138
130
  u_char *file_name;
139
131
  ngx_int_t line;
140
132
 
141
133
  ngx_resolver_t *resolver;
134
+ ngx_log_t *error_log;
142
135
 
143
136
  /* server ctx */
144
137
  ngx_mail_conf_ctx_t *ctx;
@@ -349,7 +342,7 @@ typedef struct {
349
342
 
350
343
  void *(*create_srv_conf)(ngx_conf_t *cf);
351
344
  char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev,
352
- void *conf);
345
+ void *conf);
353
346
  } ngx_mail_module_t;
354
347
 
355
348
 
@@ -431,7 +431,7 @@ ngx_mail_auth_http_ignore_status_line(ngx_mail_session_t *s,
431
431
  }
432
432
 
433
433
  ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
434
- "auth http server &V sent invalid response",
434
+ "auth http server %V sent invalid response",
435
435
  ctx->peer.name);
436
436
  ngx_close_connection(ctx->peer.connection);
437
437
  ngx_destroy_pool(ctx->pool);
@@ -21,16 +21,12 @@ static char *ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd,
21
21
  void *conf);
22
22
  static char *ngx_mail_core_protocol(ngx_conf_t *cf, ngx_command_t *cmd,
23
23
  void *conf);
24
+ static char *ngx_mail_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd,
25
+ void *conf);
24
26
  static char *ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd,
25
27
  void *conf);
26
28
 
27
29
 
28
- static ngx_conf_deprecated_t ngx_conf_deprecated_so_keepalive = {
29
- ngx_conf_deprecated, "so_keepalive",
30
- "so_keepalive\" parameter of the \"listen"
31
- };
32
-
33
-
34
30
  static ngx_command_t ngx_mail_core_commands[] = {
35
31
 
36
32
  { ngx_string("server"),
@@ -54,13 +50,6 @@ static ngx_command_t ngx_mail_core_commands[] = {
54
50
  0,
55
51
  NULL },
56
52
 
57
- { ngx_string("so_keepalive"),
58
- NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_FLAG,
59
- ngx_conf_set_flag_slot,
60
- NGX_MAIL_SRV_CONF_OFFSET,
61
- offsetof(ngx_mail_core_srv_conf_t, so_keepalive),
62
- &ngx_conf_deprecated_so_keepalive },
63
-
64
53
  { ngx_string("timeout"),
65
54
  NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_TAKE1,
66
55
  ngx_conf_set_msec_slot,
@@ -75,6 +64,13 @@ static ngx_command_t ngx_mail_core_commands[] = {
75
64
  offsetof(ngx_mail_core_srv_conf_t, server_name),
76
65
  NULL },
77
66
 
67
+ { ngx_string("error_log"),
68
+ NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE,
69
+ ngx_mail_core_error_log,
70
+ NGX_MAIL_SRV_CONF_OFFSET,
71
+ 0,
72
+ NULL },
73
+
78
74
  { ngx_string("resolver"),
79
75
  NGX_MAIL_MAIN_CONF|NGX_MAIL_SRV_CONF|NGX_CONF_1MORE,
80
76
  ngx_mail_core_resolver,
@@ -161,11 +157,11 @@ ngx_mail_core_create_srv_conf(ngx_conf_t *cf)
161
157
  * set by ngx_pcalloc():
162
158
  *
163
159
  * cscf->protocol = NULL;
160
+ * cscf->error_log = NULL;
164
161
  */
165
162
 
166
163
  cscf->timeout = NGX_CONF_UNSET_MSEC;
167
164
  cscf->resolver_timeout = NGX_CONF_UNSET_MSEC;
168
- cscf->so_keepalive = NGX_CONF_UNSET;
169
165
 
170
166
  cscf->resolver = NGX_CONF_UNSET_PTR;
171
167
 
@@ -186,8 +182,6 @@ ngx_mail_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
186
182
  ngx_conf_merge_msec_value(conf->resolver_timeout, prev->resolver_timeout,
187
183
  30000);
188
184
 
189
- ngx_conf_merge_value(conf->so_keepalive, prev->so_keepalive, 0);
190
-
191
185
 
192
186
  ngx_conf_merge_str_value(conf->server_name, prev->server_name, "");
193
187
 
@@ -202,6 +196,14 @@ ngx_mail_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
202
196
  return NGX_CONF_ERROR;
203
197
  }
204
198
 
199
+ if (conf->error_log == NULL) {
200
+ if (prev->error_log) {
201
+ conf->error_log = prev->error_log;
202
+ } else {
203
+ conf->error_log = &cf->cycle->new_log;
204
+ }
205
+ }
206
+
205
207
  ngx_conf_merge_ptr_value(conf->resolver, prev->resolver, NULL);
206
208
 
207
209
  return NGX_CONF_OK;
@@ -235,12 +237,12 @@ ngx_mail_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
235
237
  return NGX_CONF_ERROR;
236
238
  }
237
239
 
238
- for (m = 0; ngx_modules[m]; m++) {
239
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
240
+ for (m = 0; cf->cycle->modules[m]; m++) {
241
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
240
242
  continue;
241
243
  }
242
244
 
243
- module = ngx_modules[m]->ctx;
245
+ module = cf->cycle->modules[m]->ctx;
244
246
 
245
247
  if (module->create_srv_conf) {
246
248
  mconf = module->create_srv_conf(cf);
@@ -248,7 +250,7 @@ ngx_mail_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
248
250
  return NGX_CONF_ERROR;
249
251
  }
250
252
 
251
- ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
253
+ ctx->srv_conf[cf->cycle->modules[m]->ctx_index] = mconf;
252
254
  }
253
255
  }
254
256
 
@@ -323,7 +325,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
323
325
 
324
326
  for (i = 0; i < cmcf->listen.nelts; i++) {
325
327
 
326
- sa = (struct sockaddr *) ls[i].sockaddr;
328
+ sa = &ls[i].u.sockaddr;
327
329
 
328
330
  if (sa->sa_family != u.family) {
329
331
  continue;
@@ -335,7 +337,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
335
337
  case AF_INET6:
336
338
  off = offsetof(struct sockaddr_in6, sin6_addr);
337
339
  len = 16;
338
- sin6 = (struct sockaddr_in6 *) sa;
340
+ sin6 = &ls[i].u.sockaddr_in6;
339
341
  port = ntohs(sin6->sin6_port);
340
342
  break;
341
343
  #endif
@@ -351,12 +353,14 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
351
353
  default: /* AF_INET */
352
354
  off = offsetof(struct sockaddr_in, sin_addr);
353
355
  len = 4;
354
- sin = (struct sockaddr_in *) sa;
356
+ sin = &ls[i].u.sockaddr_in;
355
357
  port = ntohs(sin->sin_port);
356
358
  break;
357
359
  }
358
360
 
359
- if (ngx_memcmp(ls[i].sockaddr + off, u.sockaddr + off, len) != 0) {
361
+ if (ngx_memcmp(ls[i].u.sockaddr_data + off, u.sockaddr + off, len)
362
+ != 0)
363
+ {
360
364
  continue;
361
365
  }
362
366
 
@@ -376,9 +380,10 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
376
380
 
377
381
  ngx_memzero(ls, sizeof(ngx_mail_listen_t));
378
382
 
379
- ngx_memcpy(ls->sockaddr, u.sockaddr, u.socklen);
383
+ ngx_memcpy(&ls->u.sockaddr, u.sockaddr, u.socklen);
380
384
 
381
385
  ls->socklen = u.socklen;
386
+ ls->backlog = NGX_LISTEN_BACKLOG;
382
387
  ls->wildcard = u.wildcard;
383
388
  ls->ctx = cf->ctx;
384
389
 
@@ -387,12 +392,12 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
387
392
  #endif
388
393
 
389
394
  if (cscf->protocol == NULL) {
390
- for (m = 0; ngx_modules[m]; m++) {
391
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
395
+ for (m = 0; cf->cycle->modules[m]; m++) {
396
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
392
397
  continue;
393
398
  }
394
399
 
395
- module = ngx_modules[m]->ctx;
400
+ module = cf->cycle->modules[m]->ctx;
396
401
 
397
402
  if (module->protocol == NULL) {
398
403
  continue;
@@ -414,12 +419,24 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
414
419
  continue;
415
420
  }
416
421
 
422
+ if (ngx_strncmp(value[i].data, "backlog=", 8) == 0) {
423
+ ls->backlog = ngx_atoi(value[i].data + 8, value[i].len - 8);
424
+ ls->bind = 1;
425
+
426
+ if (ls->backlog == NGX_ERROR || ls->backlog == 0) {
427
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
428
+ "invalid backlog \"%V\"", &value[i]);
429
+ return NGX_CONF_ERROR;
430
+ }
431
+
432
+ continue;
433
+ }
434
+
417
435
  if (ngx_strncmp(value[i].data, "ipv6only=o", 10) == 0) {
418
436
  #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
419
- struct sockaddr *sa;
420
- u_char buf[NGX_SOCKADDR_STRLEN];
437
+ u_char buf[NGX_SOCKADDR_STRLEN];
421
438
 
422
- sa = (struct sockaddr *) ls->sockaddr;
439
+ sa = &ls->u.sockaddr;
423
440
 
424
441
  if (sa->sa_family == AF_INET6) {
425
442
 
@@ -578,12 +595,12 @@ ngx_mail_core_protocol(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
578
595
 
579
596
  value = cf->args->elts;
580
597
 
581
- for (m = 0; ngx_modules[m]; m++) {
582
- if (ngx_modules[m]->type != NGX_MAIL_MODULE) {
598
+ for (m = 0; cf->cycle->modules[m]; m++) {
599
+ if (cf->cycle->modules[m]->type != NGX_MAIL_MODULE) {
583
600
  continue;
584
601
  }
585
602
 
586
- module = ngx_modules[m]->ctx;
603
+ module = cf->cycle->modules[m]->ctx;
587
604
 
588
605
  if (module->protocol
589
606
  && ngx_strcmp(module->protocol->name.data, value[1].data) == 0)
@@ -600,6 +617,15 @@ ngx_mail_core_protocol(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
600
617
  }
601
618
 
602
619
 
620
+ static char *
621
+ ngx_mail_core_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
622
+ {
623
+ ngx_mail_core_srv_conf_t *cscf = conf;
624
+
625
+ return ngx_log_set_log(cf, &cscf->error_log);
626
+ }
627
+
628
+
603
629
  static char *
604
630
  ngx_mail_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
605
631
  {
@@ -24,19 +24,20 @@ static ngx_int_t ngx_mail_verify_cert(ngx_mail_session_t *s,
24
24
  void
25
25
  ngx_mail_init_connection(ngx_connection_t *c)
26
26
  {
27
- size_t len;
28
- ngx_uint_t i;
29
- ngx_mail_port_t *port;
30
- struct sockaddr *sa;
31
- struct sockaddr_in *sin;
32
- ngx_mail_log_ctx_t *ctx;
33
- ngx_mail_in_addr_t *addr;
34
- ngx_mail_session_t *s;
35
- ngx_mail_addr_conf_t *addr_conf;
36
- u_char text[NGX_SOCKADDR_STRLEN];
27
+ size_t len;
28
+ ngx_uint_t i;
29
+ ngx_mail_port_t *port;
30
+ struct sockaddr *sa;
31
+ struct sockaddr_in *sin;
32
+ ngx_mail_log_ctx_t *ctx;
33
+ ngx_mail_in_addr_t *addr;
34
+ ngx_mail_session_t *s;
35
+ ngx_mail_addr_conf_t *addr_conf;
36
+ ngx_mail_core_srv_conf_t *cscf;
37
+ u_char text[NGX_SOCKADDR_STRLEN];
37
38
  #if (NGX_HAVE_INET6)
38
- struct sockaddr_in6 *sin6;
39
- ngx_mail_in6_addr_t *addr6;
39
+ struct sockaddr_in6 *sin6;
40
+ ngx_mail_in6_addr_t *addr6;
40
41
  #endif
41
42
 
42
43
 
@@ -133,6 +134,10 @@ ngx_mail_init_connection(ngx_connection_t *c)
133
134
  c->data = s;
134
135
  s->connection = c;
135
136
 
137
+ cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
138
+
139
+ ngx_set_connection_log(c, cscf->error_log);
140
+
136
141
  len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1);
137
142
 
138
143
  ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA client %*s connected to %V",
@@ -111,7 +111,6 @@ static u_char smtp_auth_ok[] = "235 2.0.0 OK" CRLF;
111
111
  void
112
112
  ngx_mail_proxy_init(ngx_mail_session_t *s, ngx_addr_t *peer)
113
113
  {
114
- int keepalive;
115
114
  ngx_int_t rc;
116
115
  ngx_mail_proxy_ctx_t *p;
117
116
  ngx_mail_proxy_conf_t *pcf;
@@ -121,18 +120,6 @@ ngx_mail_proxy_init(ngx_mail_session_t *s, ngx_addr_t *peer)
121
120
 
122
121
  cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
123
122
 
124
- if (cscf->so_keepalive) {
125
- keepalive = 1;
126
-
127
- if (setsockopt(s->connection->fd, SOL_SOCKET, SO_KEEPALIVE,
128
- (const void *) &keepalive, sizeof(int))
129
- == -1)
130
- {
131
- ngx_log_error(NGX_LOG_ALERT, s->connection->log, ngx_socket_errno,
132
- "setsockopt(SO_KEEPALIVE) failed");
133
- }
134
- }
135
-
136
123
  p = ngx_pcalloc(s->connection->pool, sizeof(ngx_mail_proxy_ctx_t));
137
124
  if (p == NULL) {
138
125
  ngx_mail_session_internal_server_error(s);
@@ -948,7 +935,7 @@ ngx_mail_proxy_handler(ngx_event_t *ev)
948
935
  do_write = ev->write ? 1 : 0;
949
936
 
950
937
  ngx_log_debug3(NGX_LOG_DEBUG_MAIL, ev->log, 0,
951
- "mail proxy handler: %d, #%d > #%d",
938
+ "mail proxy handler: %ui, #%d > #%d",
952
939
  do_write, src->fd, dst->fd);
953
940
 
954
941
  for ( ;; ) {
@@ -42,7 +42,7 @@ static u_char smtp_username[] = "334 VXNlcm5hbWU6" CRLF;
42
42
  static u_char smtp_password[] = "334 UGFzc3dvcmQ6" CRLF;
43
43
  static u_char smtp_invalid_command[] = "500 5.5.1 Invalid command" CRLF;
44
44
  static u_char smtp_invalid_pipelining[] =
45
- "503 5.5.0 Improper use of SMTP command pipelining" CRLF;
45
+ "503 5.5.0 Improper use of SMTP command pipelining" CRLF;
46
46
  static u_char smtp_invalid_argument[] = "501 5.5.4 Invalid argument" CRLF;
47
47
  static u_char smtp_auth_required[] = "530 5.7.1 Authentication required" CRLF;
48
48
  static u_char smtp_bad_sequence[] = "503 5.5.1 Bad sequence of commands" CRLF;
@@ -284,7 +284,7 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
284
284
  prev->prefer_server_ciphers, 0);
285
285
 
286
286
  ngx_conf_merge_bitmask_value(conf->protocols, prev->protocols,
287
- (NGX_CONF_BITMASK_SET|NGX_SSL_SSLv3|NGX_SSL_TLSv1
287
+ (NGX_CONF_BITMASK_SET|NGX_SSL_TLSv1
288
288
  |NGX_SSL_TLSv1_1|NGX_SSL_TLSv1_2));
289
289
 
290
290
  ngx_conf_merge_uint_value(conf->verify, prev->verify, 0);
@@ -312,13 +312,13 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
312
312
  conf->ssl.log = cf->log;
313
313
 
314
314
  if (conf->enable) {
315
- mode = "ssl";
315
+ mode = "ssl";
316
316
 
317
317
  } else if (conf->starttls != NGX_MAIL_STARTTLS_OFF) {
318
- mode = "starttls";
318
+ mode = "starttls";
319
319
 
320
320
  } else {
321
- mode = "";
321
+ mode = "";
322
322
  }
323
323
 
324
324
  if (conf->file == NULL) {
@@ -421,7 +421,7 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child)
421
421
  SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
422
422
  }
423
423
 
424
- #ifndef LIBRESSL_VERSION_NUMBER
424
+ #if (OPENSSL_VERSION_NUMBER < 0x10100001L && !defined LIBRESSL_VERSION_NUMBER)
425
425
  SSL_CTX_set_tmp_rsa_callback(conf->ssl.ctx, ngx_ssl_rsa512_key_callback);
426
426
  #endif
427
427
 
@@ -276,26 +276,26 @@ typedef volatile ngx_atomic_uint_t ngx_atomic_t;
276
276
 
277
277
  static ngx_inline ngx_atomic_uint_t
278
278
  ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old,
279
- ngx_atomic_uint_t set)
279
+ ngx_atomic_uint_t set)
280
280
  {
281
- if (*lock == old) {
282
- *lock = set;
283
- return 1;
284
- }
281
+ if (*lock == old) {
282
+ *lock = set;
283
+ return 1;
284
+ }
285
285
 
286
- return 0;
286
+ return 0;
287
287
  }
288
288
 
289
289
 
290
290
  static ngx_inline ngx_atomic_int_t
291
291
  ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add)
292
292
  {
293
- ngx_atomic_int_t old;
293
+ ngx_atomic_int_t old;
294
294
 
295
- old = *value;
296
- *value += add;
295
+ old = *value;
296
+ *value += add;
297
297
 
298
- return old;
298
+ return old;
299
299
  }
300
300
 
301
301
  #define ngx_memory_barrier()