nginxtra 1.4.7.9 → 1.6.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) 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 +286 -19
  6. data/vendor/nginx/CHANGES.ru +296 -22
  7. data/vendor/nginx/auto/cc/clang +4 -3
  8. data/vendor/nginx/auto/cc/conf +23 -0
  9. data/vendor/nginx/auto/cc/msvc +1 -0
  10. data/vendor/nginx/auto/cc/name +1 -1
  11. data/vendor/nginx/auto/cc/owc +4 -4
  12. data/vendor/nginx/auto/cc/sunc +1 -1
  13. data/vendor/nginx/auto/endianness +2 -2
  14. data/vendor/nginx/auto/feature +1 -1
  15. data/vendor/nginx/auto/include +1 -1
  16. data/vendor/nginx/auto/lib/libatomic/make +3 -1
  17. data/vendor/nginx/auto/lib/openssl/conf +4 -0
  18. data/vendor/nginx/auto/lib/openssl/make +1 -1
  19. data/vendor/nginx/auto/lib/pcre/conf +5 -0
  20. data/vendor/nginx/auto/lib/pcre/make +11 -11
  21. data/vendor/nginx/auto/lib/pcre/makefile.bcc +4 -3
  22. data/vendor/nginx/auto/lib/pcre/makefile.msvc +2 -1
  23. data/vendor/nginx/auto/lib/pcre/makefile.owc +2 -1
  24. data/vendor/nginx/auto/lib/perl/make +1 -0
  25. data/vendor/nginx/auto/lib/test +1 -1
  26. data/vendor/nginx/auto/lib/zlib/make +22 -1
  27. data/vendor/nginx/auto/modules +8 -0
  28. data/vendor/nginx/auto/options +3 -0
  29. data/vendor/nginx/auto/os/darwin +1 -1
  30. data/vendor/nginx/auto/os/linux +32 -0
  31. data/vendor/nginx/auto/os/win32 +12 -1
  32. data/vendor/nginx/auto/sources +8 -2
  33. data/vendor/nginx/auto/types/sizeof +1 -1
  34. data/vendor/nginx/auto/types/typedef +1 -1
  35. data/vendor/nginx/auto/types/uintptr_t +1 -1
  36. data/vendor/nginx/auto/unix +13 -1
  37. data/vendor/nginx/conf/mime.types +11 -2
  38. data/vendor/nginx/conf/nginx.conf +3 -4
  39. data/vendor/nginx/contrib/README +6 -0
  40. data/vendor/nginx/contrib/vim/ftdetect/nginx.vim +4 -0
  41. data/vendor/nginx/contrib/vim/indent/nginx.vim +11 -0
  42. data/vendor/nginx/contrib/vim/syntax/nginx.vim +703 -0
  43. data/vendor/nginx/src/core/nginx.c +2 -7
  44. data/vendor/nginx/src/core/nginx.h +2 -2
  45. data/vendor/nginx/src/core/ngx_conf_file.c +8 -88
  46. data/vendor/nginx/src/core/ngx_conf_file.h +3 -3
  47. data/vendor/nginx/src/core/ngx_config.h +2 -2
  48. data/vendor/nginx/src/core/ngx_connection.c +100 -29
  49. data/vendor/nginx/src/core/ngx_connection.h +11 -0
  50. data/vendor/nginx/src/core/ngx_core.h +1 -0
  51. data/vendor/nginx/src/core/ngx_cycle.c +23 -99
  52. data/vendor/nginx/src/core/ngx_cycle.h +2 -0
  53. data/vendor/nginx/src/core/ngx_file.c +100 -8
  54. data/vendor/nginx/src/core/ngx_file.h +3 -0
  55. data/vendor/nginx/src/core/ngx_hash.c +6 -9
  56. data/vendor/nginx/src/core/ngx_inet.c +93 -5
  57. data/vendor/nginx/src/core/ngx_inet.h +4 -2
  58. data/vendor/nginx/src/core/ngx_list.c +1 -9
  59. data/vendor/nginx/src/core/ngx_log.c +132 -30
  60. data/vendor/nginx/src/core/ngx_log.h +5 -2
  61. data/vendor/nginx/src/core/ngx_open_file_cache.c +67 -1
  62. data/vendor/nginx/src/core/ngx_palloc.c +5 -2
  63. data/vendor/nginx/src/core/ngx_proxy_protocol.c +91 -0
  64. data/vendor/nginx/src/core/ngx_proxy_protocol.h +23 -0
  65. data/vendor/nginx/src/core/ngx_resolver.c +1080 -285
  66. data/vendor/nginx/src/core/ngx_resolver.h +33 -3
  67. data/vendor/nginx/src/core/ngx_slab.c +7 -2
  68. data/vendor/nginx/src/core/ngx_slab.h +2 -0
  69. data/vendor/nginx/src/core/ngx_string.c +78 -13
  70. data/vendor/nginx/src/core/ngx_string.h +2 -0
  71. data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +2 -2
  72. data/vendor/nginx/src/event/modules/ngx_epoll_module.c +13 -5
  73. data/vendor/nginx/src/event/modules/ngx_select_module.c +1 -1
  74. data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +2 -2
  75. data/vendor/nginx/src/event/ngx_event.c +0 -1
  76. data/vendor/nginx/src/event/ngx_event.h +7 -6
  77. data/vendor/nginx/src/event/ngx_event_accept.c +6 -4
  78. data/vendor/nginx/src/event/ngx_event_connect.c +2 -2
  79. data/vendor/nginx/src/event/ngx_event_openssl.c +304 -13
  80. data/vendor/nginx/src/event/ngx_event_openssl.h +20 -1
  81. data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +35 -23
  82. data/vendor/nginx/src/event/ngx_event_pipe.c +15 -30
  83. data/vendor/nginx/src/http/modules/ngx_http_access_module.c +115 -35
  84. data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
  85. data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +444 -0
  86. data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +2 -1
  87. data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +1 -1
  88. data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +1 -3
  89. data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +251 -36
  90. data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -5
  91. data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +5 -3
  92. data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +1 -1
  93. data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +4 -0
  94. data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +8 -2
  95. data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +5 -1
  96. data/vendor/nginx/src/http/modules/ngx_http_map_module.c +3 -3
  97. data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +21 -10
  98. data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +669 -197
  99. data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +93 -60
  100. data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +13 -6
  101. data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +20 -1
  102. data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +132 -74
  103. data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +18 -12
  104. data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +22 -20
  105. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +121 -3
  106. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +5 -0
  107. data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +3 -0
  108. data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +123 -91
  109. data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +29 -19
  110. data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +2 -5
  111. data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +215 -19
  112. data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +32 -6
  113. data/vendor/nginx/src/http/modules/perl/nginx.xs +4 -7
  114. data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -2
  115. data/vendor/nginx/src/http/ngx_http.c +17 -7
  116. data/vendor/nginx/src/http/ngx_http_cache.h +4 -2
  117. data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +4 -2
  118. data/vendor/nginx/src/http/ngx_http_core_module.c +63 -50
  119. data/vendor/nginx/src/http/ngx_http_core_module.h +5 -0
  120. data/vendor/nginx/src/http/ngx_http_file_cache.c +115 -3
  121. data/vendor/nginx/src/http/ngx_http_header_filter_module.c +9 -6
  122. data/vendor/nginx/src/http/ngx_http_parse.c +88 -10
  123. data/vendor/nginx/src/http/ngx_http_postpone_filter_module.c +2 -4
  124. data/vendor/nginx/src/http/ngx_http_request.c +116 -8
  125. data/vendor/nginx/src/http/ngx_http_request.h +5 -1
  126. data/vendor/nginx/src/http/ngx_http_request_body.c +7 -7
  127. data/vendor/nginx/src/http/ngx_http_script.c +6 -5
  128. data/vendor/nginx/src/http/ngx_http_spdy.c +889 -271
  129. data/vendor/nginx/src/http/ngx_http_spdy.h +51 -28
  130. data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +382 -167
  131. data/vendor/nginx/src/http/ngx_http_spdy_module.c +65 -8
  132. data/vendor/nginx/src/http/ngx_http_spdy_module.h +5 -0
  133. data/vendor/nginx/src/http/ngx_http_special_response.c +1 -1
  134. data/vendor/nginx/src/http/ngx_http_upstream.c +290 -114
  135. data/vendor/nginx/src/http/ngx_http_upstream.h +9 -5
  136. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +32 -24
  137. data/vendor/nginx/src/http/ngx_http_variables.c +40 -6
  138. data/vendor/nginx/src/http/ngx_http_write_filter_module.c +12 -5
  139. data/vendor/nginx/src/mail/ngx_mail.c +4 -2
  140. data/vendor/nginx/src/mail/ngx_mail.h +2 -0
  141. data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +0 -1
  142. data/vendor/nginx/src/mail/ngx_mail_core_module.c +2 -1
  143. data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -4
  144. data/vendor/nginx/src/mail/ngx_mail_parse.c +32 -2
  145. data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +54 -7
  146. data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +50 -78
  147. data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +48 -11
  148. data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +3 -0
  149. data/vendor/nginx/src/os/unix/ngx_channel.c +3 -1
  150. data/vendor/nginx/src/os/unix/ngx_darwin_config.h +1 -0
  151. data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -1
  152. data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +14 -16
  153. data/vendor/nginx/src/os/unix/ngx_errno.h +3 -0
  154. data/vendor/nginx/src/os/unix/ngx_files.h +10 -16
  155. data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +6 -0
  156. data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -1
  157. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +1 -1
  158. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +2 -2
  159. data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +17 -19
  160. data/vendor/nginx/src/os/unix/ngx_linux_config.h +8 -2
  161. data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +20 -22
  162. data/vendor/nginx/src/os/unix/ngx_posix_config.h +1 -0
  163. data/vendor/nginx/src/os/unix/ngx_process.c +5 -0
  164. data/vendor/nginx/src/os/unix/ngx_process_cycle.c +15 -3
  165. data/vendor/nginx/src/os/unix/ngx_readv_chain.c +2 -1
  166. data/vendor/nginx/src/os/unix/ngx_recv.c +4 -1
  167. data/vendor/nginx/src/os/unix/ngx_solaris_config.h +1 -0
  168. data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +14 -16
  169. metadata +8 -2
@@ -80,6 +80,10 @@ struct ngx_listening_s {
80
80
  int setfib;
81
81
  #endif
82
82
 
83
+ #if (NGX_HAVE_TCP_FASTOPEN)
84
+ int fastopen;
85
+ #endif
86
+
83
87
  };
84
88
 
85
89
 
@@ -108,6 +112,7 @@ typedef enum {
108
112
 
109
113
  #define NGX_LOWLEVEL_BUFFERED 0x0f
110
114
  #define NGX_SSL_BUFFERED 0x01
115
+ #define NGX_SPDY_BUFFERED 0x02
111
116
 
112
117
 
113
118
  struct ngx_connection_s {
@@ -134,11 +139,14 @@ struct ngx_connection_s {
134
139
  socklen_t socklen;
135
140
  ngx_str_t addr_text;
136
141
 
142
+ ngx_str_t proxy_protocol_addr;
143
+
137
144
  #if (NGX_SSL)
138
145
  ngx_ssl_connection_t *ssl;
139
146
  #endif
140
147
 
141
148
  struct sockaddr *local_sockaddr;
149
+ socklen_t local_socklen;
142
150
 
143
151
  ngx_buf_t *buffer;
144
152
 
@@ -166,12 +174,15 @@ struct ngx_connection_s {
166
174
  unsigned tcp_nodelay:2; /* ngx_connection_tcp_nodelay_e */
167
175
  unsigned tcp_nopush:2; /* ngx_connection_tcp_nopush_e */
168
176
 
177
+ unsigned need_last_buf:1;
178
+
169
179
  #if (NGX_HAVE_IOCP)
170
180
  unsigned accept_context_updated:1;
171
181
  #endif
172
182
 
173
183
  #if (NGX_HAVE_AIO_SENDFILE)
174
184
  unsigned aio_sendfile:1;
185
+ unsigned busy_count:2;
175
186
  ngx_buf_t *busy_sendfile;
176
187
  #endif
177
188
 
@@ -77,6 +77,7 @@ typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
77
77
  #include <ngx_open_file_cache.h>
78
78
  #include <ngx_os.h>
79
79
  #include <ngx_connection.h>
80
+ #include <ngx_proxy_protocol.h>
80
81
 
81
82
 
82
83
  #define LF (u_char) 10
@@ -11,7 +11,6 @@
11
11
 
12
12
 
13
13
  static void ngx_destroy_cycle_pools(ngx_conf_t *conf);
14
- static ngx_int_t ngx_cmp_sockaddr(struct sockaddr *sa1, struct sockaddr *sa2);
15
14
  static ngx_int_t ngx_init_zone_pool(ngx_cycle_t *cycle,
16
15
  ngx_shm_zone_t *shm_zone);
17
16
  static ngx_int_t ngx_test_lockfile(u_char *file, ngx_log_t *log);
@@ -36,8 +35,6 @@ ngx_tls_key_t ngx_core_tls_key;
36
35
  static ngx_connection_t dumb;
37
36
  /* STUB */
38
37
 
39
- static ngx_str_t error_log = ngx_string(NGX_ERROR_LOG_PATH);
40
-
41
38
 
42
39
  ngx_cycle_t *
43
40
  ngx_init_cycle(ngx_cycle_t *old_cycle)
@@ -84,7 +81,6 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
84
81
 
85
82
  cycle->pool = pool;
86
83
  cycle->log = log;
87
- cycle->new_log.log_level = NGX_LOG_ERR;
88
84
  cycle->old_cycle = old_cycle;
89
85
 
90
86
  cycle->conf_prefix.len = old_cycle->conf_prefix.len;
@@ -339,11 +335,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
339
335
  }
340
336
 
341
337
 
342
- if (cycle->new_log.file == NULL) {
343
- cycle->new_log.file = ngx_conf_open_file(cycle, &error_log);
344
- if (cycle->new_log.file == NULL) {
345
- goto failed;
346
- }
338
+ if (ngx_log_open_default(cycle) != NGX_OK) {
339
+ goto failed;
347
340
  }
348
341
 
349
342
  /* open the new files */
@@ -500,13 +493,15 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
500
493
  continue;
501
494
  }
502
495
 
503
- if (ngx_cmp_sockaddr(nls[n].sockaddr, ls[i].sockaddr) == NGX_OK)
496
+ if (ngx_cmp_sockaddr(nls[n].sockaddr, nls[n].socklen,
497
+ ls[i].sockaddr, ls[i].socklen, 1)
498
+ == NGX_OK)
504
499
  {
505
500
  nls[n].fd = ls[i].fd;
506
501
  nls[n].previous = &ls[i];
507
502
  ls[i].remain = 1;
508
503
 
509
- if (ls[n].backlog != nls[i].backlog) {
504
+ if (ls[i].backlog != nls[n].backlog) {
510
505
  nls[n].listen = 1;
511
506
  }
512
507
 
@@ -537,7 +532,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
537
532
 
538
533
  #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
539
534
 
540
- if (ls[n].deferred_accept && !nls[n].deferred_accept) {
535
+ if (ls[i].deferred_accept && !nls[n].deferred_accept) {
541
536
  nls[n].delete_deferred = 1;
542
537
 
543
538
  } else if (ls[i].deferred_accept != nls[n].deferred_accept)
@@ -549,8 +544,18 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
549
544
  }
550
545
  }
551
546
 
552
- if (nls[n].fd == -1) {
547
+ if (nls[n].fd == (ngx_socket_t) -1) {
553
548
  nls[n].open = 1;
549
+ #if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
550
+ if (nls[n].accept_filter) {
551
+ nls[n].add_deferred = 1;
552
+ }
553
+ #endif
554
+ #if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
555
+ if (nls[n].deferred_accept) {
556
+ nls[n].add_deferred = 1;
557
+ }
558
+ #endif
554
559
  }
555
560
  }
556
561
 
@@ -582,12 +587,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
582
587
 
583
588
  /* commit the new cycle configuration */
584
589
 
585
- if (!ngx_use_stderr && cycle->log->file->fd != ngx_stderr) {
586
-
587
- if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
588
- ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
589
- ngx_set_stderr_n " failed");
590
- }
590
+ if (!ngx_use_stderr) {
591
+ (void) ngx_log_redirect_stderr(cycle);
591
592
  }
592
593
 
593
594
  pool->log = cycle->log;
@@ -659,7 +660,7 @@ old_shm_zone_done:
659
660
  ls = old_cycle->listening.elts;
660
661
  for (i = 0; i < old_cycle->listening.nelts; i++) {
661
662
 
662
- if (ls[i].remain || ls[i].fd == -1) {
663
+ if (ls[i].remain || ls[i].fd == (ngx_socket_t) -1) {
663
664
  continue;
664
665
  }
665
666
 
@@ -823,7 +824,7 @@ failed:
823
824
 
824
825
  ls = cycle->listening.elts;
825
826
  for (i = 0; i < cycle->listening.nelts; i++) {
826
- if (ls[i].fd == -1 || !ls[i].open) {
827
+ if (ls[i].fd == (ngx_socket_t) -1 || !ls[i].open) {
827
828
  continue;
828
829
  }
829
830
 
@@ -848,74 +849,6 @@ ngx_destroy_cycle_pools(ngx_conf_t *conf)
848
849
  }
849
850
 
850
851
 
851
- static ngx_int_t
852
- ngx_cmp_sockaddr(struct sockaddr *sa1, struct sockaddr *sa2)
853
- {
854
- struct sockaddr_in *sin1, *sin2;
855
- #if (NGX_HAVE_INET6)
856
- struct sockaddr_in6 *sin61, *sin62;
857
- #endif
858
- #if (NGX_HAVE_UNIX_DOMAIN)
859
- struct sockaddr_un *saun1, *saun2;
860
- #endif
861
-
862
- if (sa1->sa_family != sa2->sa_family) {
863
- return NGX_DECLINED;
864
- }
865
-
866
- switch (sa1->sa_family) {
867
-
868
- #if (NGX_HAVE_INET6)
869
- case AF_INET6:
870
- sin61 = (struct sockaddr_in6 *) sa1;
871
- sin62 = (struct sockaddr_in6 *) sa2;
872
-
873
- if (sin61->sin6_port != sin62->sin6_port) {
874
- return NGX_DECLINED;
875
- }
876
-
877
- if (ngx_memcmp(&sin61->sin6_addr, &sin62->sin6_addr, 16) != 0) {
878
- return NGX_DECLINED;
879
- }
880
-
881
- break;
882
- #endif
883
-
884
- #if (NGX_HAVE_UNIX_DOMAIN)
885
- case AF_UNIX:
886
- saun1 = (struct sockaddr_un *) sa1;
887
- saun2 = (struct sockaddr_un *) sa2;
888
-
889
- if (ngx_memcmp(&saun1->sun_path, &saun2->sun_path,
890
- sizeof(saun1->sun_path))
891
- != 0)
892
- {
893
- return NGX_DECLINED;
894
- }
895
-
896
- break;
897
- #endif
898
-
899
- default: /* AF_INET */
900
-
901
- sin1 = (struct sockaddr_in *) sa1;
902
- sin2 = (struct sockaddr_in *) sa2;
903
-
904
- if (sin1->sin_port != sin2->sin_port) {
905
- return NGX_DECLINED;
906
- }
907
-
908
- if (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) {
909
- return NGX_DECLINED;
910
- }
911
-
912
- break;
913
- }
914
-
915
- return NGX_OK;
916
- }
917
-
918
-
919
852
  static ngx_int_t
920
853
  ngx_init_zone_pool(ngx_cycle_t *cycle, ngx_shm_zone_t *zn)
921
854
  {
@@ -1228,16 +1161,7 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
1228
1161
  file[i].fd = fd;
1229
1162
  }
1230
1163
 
1231
- #if !(NGX_WIN32)
1232
-
1233
- if (cycle->log->file->fd != STDERR_FILENO) {
1234
- if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {
1235
- ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1236
- "dup2(STDERR) failed");
1237
- }
1238
- }
1239
-
1240
- #endif
1164
+ (void) ngx_log_redirect_stderr(cycle);
1241
1165
  }
1242
1166
 
1243
1167
 
@@ -41,6 +41,8 @@ struct ngx_cycle_s {
41
41
  ngx_log_t *log;
42
42
  ngx_log_t new_log;
43
43
 
44
+ ngx_uint_t log_use_stderr; /* unsigned log_use_stderr:1; */
45
+
44
46
  ngx_connection_t **files;
45
47
  ngx_connection_t *free_connections;
46
48
  ngx_uint_t free_connection_n;
@@ -9,11 +9,102 @@
9
9
  #include <ngx_core.h>
10
10
 
11
11
 
12
+ static ngx_int_t ngx_test_full_name(ngx_str_t *name);
13
+
14
+
12
15
  static ngx_atomic_t temp_number = 0;
13
16
  ngx_atomic_t *ngx_temp_number = &temp_number;
14
17
  ngx_atomic_int_t ngx_random_number = 123456;
15
18
 
16
19
 
20
+ ngx_int_t
21
+ ngx_get_full_name(ngx_pool_t *pool, ngx_str_t *prefix, ngx_str_t *name)
22
+ {
23
+ size_t len;
24
+ u_char *p, *n;
25
+ ngx_int_t rc;
26
+
27
+ rc = ngx_test_full_name(name);
28
+
29
+ if (rc == NGX_OK) {
30
+ return rc;
31
+ }
32
+
33
+ len = prefix->len;
34
+
35
+ #if (NGX_WIN32)
36
+
37
+ if (rc == 2) {
38
+ len = rc;
39
+ }
40
+
41
+ #endif
42
+
43
+ n = ngx_pnalloc(pool, len + name->len + 1);
44
+ if (n == NULL) {
45
+ return NGX_ERROR;
46
+ }
47
+
48
+ p = ngx_cpymem(n, prefix->data, len);
49
+ ngx_cpystrn(p, name->data, name->len + 1);
50
+
51
+ name->len += len;
52
+ name->data = n;
53
+
54
+ return NGX_OK;
55
+ }
56
+
57
+
58
+ static ngx_int_t
59
+ ngx_test_full_name(ngx_str_t *name)
60
+ {
61
+ #if (NGX_WIN32)
62
+ u_char c0, c1;
63
+
64
+ c0 = name->data[0];
65
+
66
+ if (name->len < 2) {
67
+ if (c0 == '/') {
68
+ return 2;
69
+ }
70
+
71
+ return NGX_DECLINED;
72
+ }
73
+
74
+ c1 = name->data[1];
75
+
76
+ if (c1 == ':') {
77
+ c0 |= 0x20;
78
+
79
+ if ((c0 >= 'a' && c0 <= 'z')) {
80
+ return NGX_OK;
81
+ }
82
+
83
+ return NGX_DECLINED;
84
+ }
85
+
86
+ if (c1 == '/') {
87
+ return NGX_OK;
88
+ }
89
+
90
+ if (c0 == '/') {
91
+ return 2;
92
+ }
93
+
94
+ return NGX_DECLINED;
95
+
96
+ #else
97
+
98
+ if (name->data[0] == '/') {
99
+ return NGX_OK;
100
+ }
101
+
102
+ return NGX_DECLINED;
103
+
104
+ #endif
105
+ }
106
+
107
+
17
108
  ssize_t
18
109
  ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain)
19
110
  {
@@ -268,9 +359,6 @@ ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
268
359
  return NULL;
269
360
  }
270
361
 
271
- path->len = 0;
272
- path->manager = NULL;
273
- path->loader = NULL;
274
362
  path->conf_file = cf->conf_file->file.name.data;
275
363
  path->line = cf->conf_file->line;
276
364
 
@@ -311,7 +399,7 @@ ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, ngx_path_t *prev,
311
399
  return NGX_CONF_OK;
312
400
  }
313
401
 
314
- *path = ngx_palloc(cf->pool, sizeof(ngx_path_t));
402
+ *path = ngx_pcalloc(cf->pool, sizeof(ngx_path_t));
315
403
  if (*path == NULL) {
316
404
  return NGX_CONF_ERROR;
317
405
  }
@@ -330,10 +418,6 @@ ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, ngx_path_t *prev,
330
418
  + init->level[1] + (init->level[1] ? 1 : 0)
331
419
  + init->level[2] + (init->level[2] ? 1 : 0);
332
420
 
333
- (*path)->manager = NULL;
334
- (*path)->loader = NULL;
335
- (*path)->conf_file = NULL;
336
-
337
421
  if (ngx_add_path(cf, path) != NGX_OK) {
338
422
  return NGX_CONF_ERROR;
339
423
  }
@@ -417,6 +501,14 @@ ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot)
417
501
  if (p[i]->name.len == path->name.len
418
502
  && ngx_strcmp(p[i]->name.data, path->name.data) == 0)
419
503
  {
504
+ if (p[i]->data != path->data) {
505
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
506
+ "the same path name \"%V\" "
507
+ "used in %s:%ui and",
508
+ &p[i]->name, p[i]->conf_file, p[i]->line);
509
+ return NGX_ERROR;
510
+ }
511
+
420
512
  for (n = 0; n < 3; n++) {
421
513
  if (p[i]->level[n] != path->level[n]) {
422
514
  if (path->conf_file == NULL) {
@@ -122,6 +122,9 @@ struct ngx_tree_ctx_s {
122
122
  };
123
123
 
124
124
 
125
+ ngx_int_t ngx_get_full_name(ngx_pool_t *pool, ngx_str_t *prefix,
126
+ ngx_str_t *name);
127
+
125
128
  ssize_t ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain);
126
129
  ngx_int_t ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path,
127
130
  ngx_pool_t *pool, ngx_uint_t persistent, ngx_uint_t clean,
@@ -282,7 +282,7 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
282
282
  start = hinit->max_size - 1000;
283
283
  }
284
284
 
285
- for (size = start; size < hinit->max_size; size++) {
285
+ for (size = start; size <= hinit->max_size; size++) {
286
286
 
287
287
  ngx_memzero(test, size * sizeof(u_short));
288
288
 
@@ -312,15 +312,12 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
312
312
  continue;
313
313
  }
314
314
 
315
- ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
316
- "could not build the %s, you should increase "
317
- "either %s_max_size: %i or %s_bucket_size: %i",
315
+ ngx_log_error(NGX_LOG_WARN, hinit->pool->log, 0,
316
+ "could not build optimal %s, you should increase "
317
+ "either %s_max_size: %i or %s_bucket_size: %i; "
318
+ "ignoring %s_bucket_size",
318
319
  hinit->name, hinit->name, hinit->max_size,
319
- hinit->name, hinit->bucket_size);
320
-
321
- ngx_free(test);
322
-
323
- return NGX_ERROR;
320
+ hinit->name, hinit->bucket_size, hinit->name);
324
321
 
325
322
  found:
326
323