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
@@ -21,6 +21,7 @@
21
21
  #if (NGX_HAVE_INET6)
22
22
  #define NGX_RESOLVE_AAAA 28
23
23
  #endif
24
+ #define NGX_RESOLVE_SRV 33
24
25
  #define NGX_RESOLVE_DNAME 39
25
26
 
26
27
  #define NGX_RESOLVE_FORMERR 1
@@ -36,13 +37,20 @@
36
37
  #define NGX_RESOLVER_MAX_RECURSION 50
37
38
 
38
39
 
40
+ typedef struct ngx_resolver_s ngx_resolver_t;
41
+
42
+
39
43
  typedef struct {
40
- ngx_connection_t *connection;
44
+ ngx_connection_t *udp;
45
+ ngx_connection_t *tcp;
41
46
  struct sockaddr *sockaddr;
42
47
  socklen_t socklen;
43
48
  ngx_str_t server;
44
49
  ngx_log_t log;
45
- } ngx_udp_connection_t;
50
+ ngx_buf_t *read_buf;
51
+ ngx_buf_t *write_buf;
52
+ ngx_resolver_t *resolver;
53
+ } ngx_resolver_connection_t;
46
54
 
47
55
 
48
56
  typedef struct ngx_resolver_ctx_s ngx_resolver_ctx_t;
@@ -50,6 +58,36 @@ typedef struct ngx_resolver_ctx_s ngx_resolver_ctx_t;
50
58
  typedef void (*ngx_resolver_handler_pt)(ngx_resolver_ctx_t *ctx);
51
59
 
52
60
 
61
+ typedef struct {
62
+ struct sockaddr *sockaddr;
63
+ socklen_t socklen;
64
+ ngx_str_t name;
65
+ u_short priority;
66
+ u_short weight;
67
+ } ngx_resolver_addr_t;
68
+
69
+
70
+ typedef struct {
71
+ ngx_str_t name;
72
+ u_short priority;
73
+ u_short weight;
74
+ u_short port;
75
+ } ngx_resolver_srv_t;
76
+
77
+
78
+ typedef struct {
79
+ ngx_str_t name;
80
+ u_short priority;
81
+ u_short weight;
82
+ u_short port;
83
+
84
+ ngx_resolver_ctx_t *ctx;
85
+
86
+ ngx_uint_t naddrs;
87
+ ngx_addr_t *addrs;
88
+ } ngx_resolver_srv_name_t;
89
+
90
+
53
91
  typedef struct {
54
92
  ngx_rbtree_node_t node;
55
93
  ngx_queue_t queue;
@@ -74,10 +112,12 @@ typedef struct {
74
112
  in_addr_t addr;
75
113
  in_addr_t *addrs;
76
114
  u_char *cname;
115
+ ngx_resolver_srv_t *srvs;
77
116
  } u;
78
117
 
79
118
  u_char code;
80
119
  u_short naddrs;
120
+ u_short nsrvs;
81
121
  u_short cnlen;
82
122
 
83
123
  #if (NGX_HAVE_INET6)
@@ -93,11 +133,18 @@ typedef struct {
93
133
  time_t valid;
94
134
  uint32_t ttl;
95
135
 
136
+ unsigned tcp:1;
137
+ #if (NGX_HAVE_INET6)
138
+ unsigned tcp6:1;
139
+ #endif
140
+
141
+ ngx_uint_t last_connection;
142
+
96
143
  ngx_resolver_ctx_t *waiting;
97
144
  } ngx_resolver_node_t;
98
145
 
99
146
 
100
- typedef struct {
147
+ struct ngx_resolver_s {
101
148
  /* has to be pointer because of "incomplete type" */
102
149
  ngx_event_t *event;
103
150
  void *dummy;
@@ -107,19 +154,24 @@ typedef struct {
107
154
  ngx_int_t ident;
108
155
 
109
156
  /* simple round robin DNS peers balancer */
110
- ngx_array_t udp_connections;
157
+ ngx_array_t connections;
111
158
  ngx_uint_t last_connection;
112
159
 
113
160
  ngx_rbtree_t name_rbtree;
114
161
  ngx_rbtree_node_t name_sentinel;
115
162
 
163
+ ngx_rbtree_t srv_rbtree;
164
+ ngx_rbtree_node_t srv_sentinel;
165
+
116
166
  ngx_rbtree_t addr_rbtree;
117
167
  ngx_rbtree_node_t addr_sentinel;
118
168
 
119
169
  ngx_queue_t name_resend_queue;
170
+ ngx_queue_t srv_resend_queue;
120
171
  ngx_queue_t addr_resend_queue;
121
172
 
122
173
  ngx_queue_t name_expire_queue;
174
+ ngx_queue_t srv_expire_queue;
123
175
  ngx_queue_t addr_expire_queue;
124
176
 
125
177
  #if (NGX_HAVE_INET6)
@@ -131,29 +183,36 @@ typedef struct {
131
183
  #endif
132
184
 
133
185
  time_t resend_timeout;
186
+ time_t tcp_timeout;
134
187
  time_t expire;
135
188
  time_t valid;
136
189
 
137
190
  ngx_uint_t log_level;
138
- } ngx_resolver_t;
191
+ };
139
192
 
140
193
 
141
194
  struct ngx_resolver_ctx_s {
142
195
  ngx_resolver_ctx_t *next;
143
196
  ngx_resolver_t *resolver;
144
- ngx_udp_connection_t *udp_connection;
197
+ ngx_resolver_node_t *node;
145
198
 
146
199
  /* event ident must be after 3 pointers as in ngx_connection_t */
147
200
  ngx_int_t ident;
148
201
 
149
202
  ngx_int_t state;
150
203
  ngx_str_t name;
204
+ ngx_str_t service;
151
205
 
206
+ time_t valid;
152
207
  ngx_uint_t naddrs;
153
- ngx_addr_t *addrs;
154
- ngx_addr_t addr;
208
+ ngx_resolver_addr_t *addrs;
209
+ ngx_resolver_addr_t addr;
155
210
  struct sockaddr_in sin;
156
211
 
212
+ ngx_uint_t count;
213
+ ngx_uint_t nsrvs;
214
+ ngx_resolver_srv_name_t *srvs;
215
+
157
216
  ngx_resolver_handler_pt handler;
158
217
  void *data;
159
218
  ngx_msec_t timeout;
@@ -161,8 +220,6 @@ struct ngx_resolver_ctx_s {
161
220
  ngx_uint_t quick; /* unsigned quick:1; */
162
221
  ngx_uint_t recursion;
163
222
  ngx_event_t *event;
164
-
165
- ngx_resolver_node_t *node;
166
223
  };
167
224
 
168
225
 
@@ -0,0 +1,120 @@
1
+
2
+ /*
3
+ * Copyright (C) Ruslan Ermilov
4
+ * Copyright (C) Nginx, Inc.
5
+ */
6
+
7
+
8
+ #include <ngx_config.h>
9
+ #include <ngx_core.h>
10
+
11
+
12
+ #if (NGX_HAVE_ATOMIC_OPS)
13
+
14
+
15
+ #define NGX_RWLOCK_SPIN 2048
16
+ #define NGX_RWLOCK_WLOCK ((ngx_atomic_uint_t) -1)
17
+
18
+
19
+ void
20
+ ngx_rwlock_wlock(ngx_atomic_t *lock)
21
+ {
22
+ ngx_uint_t i, n;
23
+
24
+ for ( ;; ) {
25
+
26
+ if (*lock == 0 && ngx_atomic_cmp_set(lock, 0, NGX_RWLOCK_WLOCK)) {
27
+ return;
28
+ }
29
+
30
+ if (ngx_ncpu > 1) {
31
+
32
+ for (n = 1; n < NGX_RWLOCK_SPIN; n <<= 1) {
33
+
34
+ for (i = 0; i < n; i++) {
35
+ ngx_cpu_pause();
36
+ }
37
+
38
+ if (*lock == 0
39
+ && ngx_atomic_cmp_set(lock, 0, NGX_RWLOCK_WLOCK))
40
+ {
41
+ return;
42
+ }
43
+ }
44
+ }
45
+
46
+ ngx_sched_yield();
47
+ }
48
+ }
49
+
50
+
51
+ void
52
+ ngx_rwlock_rlock(ngx_atomic_t *lock)
53
+ {
54
+ ngx_uint_t i, n;
55
+ ngx_atomic_uint_t readers;
56
+
57
+ for ( ;; ) {
58
+ readers = *lock;
59
+
60
+ if (readers != NGX_RWLOCK_WLOCK
61
+ && ngx_atomic_cmp_set(lock, readers, readers + 1))
62
+ {
63
+ return;
64
+ }
65
+
66
+ if (ngx_ncpu > 1) {
67
+
68
+ for (n = 1; n < NGX_RWLOCK_SPIN; n <<= 1) {
69
+
70
+ for (i = 0; i < n; i++) {
71
+ ngx_cpu_pause();
72
+ }
73
+
74
+ readers = *lock;
75
+
76
+ if (readers != NGX_RWLOCK_WLOCK
77
+ && ngx_atomic_cmp_set(lock, readers, readers + 1))
78
+ {
79
+ return;
80
+ }
81
+ }
82
+ }
83
+
84
+ ngx_sched_yield();
85
+ }
86
+ }
87
+
88
+
89
+ void
90
+ ngx_rwlock_unlock(ngx_atomic_t *lock)
91
+ {
92
+ ngx_atomic_uint_t readers;
93
+
94
+ readers = *lock;
95
+
96
+ if (readers == NGX_RWLOCK_WLOCK) {
97
+ *lock = 0;
98
+ return;
99
+ }
100
+
101
+ for ( ;; ) {
102
+
103
+ if (ngx_atomic_cmp_set(lock, readers, readers - 1)) {
104
+ return;
105
+ }
106
+
107
+ readers = *lock;
108
+ }
109
+ }
110
+
111
+
112
+ #else
113
+
114
+ #if (NGX_HTTP_UPSTREAM_ZONE || NGX_STREAM_UPSTREAM_ZONE)
115
+
116
+ #error ngx_atomic_cmp_set() is not defined!
117
+
118
+ #endif
119
+
120
+ #endif
@@ -0,0 +1,21 @@
1
+
2
+ /*
3
+ * Copyright (C) Ruslan Ermilov
4
+ * Copyright (C) Nginx, Inc.
5
+ */
6
+
7
+
8
+ #ifndef _NGX_RWLOCK_H_INCLUDED_
9
+ #define _NGX_RWLOCK_H_INCLUDED_
10
+
11
+
12
+ #include <ngx_config.h>
13
+ #include <ngx_core.h>
14
+
15
+
16
+ void ngx_rwlock_wlock(ngx_atomic_t *lock);
17
+ void ngx_rwlock_rlock(ngx_atomic_t *lock);
18
+ void ngx_rwlock_unlock(ngx_atomic_t *lock);
19
+
20
+
21
+ #endif /* _NGX_RWLOCK_H_INCLUDED_ */
@@ -222,11 +222,11 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)
222
222
 
223
223
  if (bitmap[n] == NGX_SLAB_BUSY) {
224
224
  for (n = n + 1; n < map; n++) {
225
- if (bitmap[n] != NGX_SLAB_BUSY) {
226
- p = (uintptr_t) bitmap + i;
225
+ if (bitmap[n] != NGX_SLAB_BUSY) {
226
+ p = (uintptr_t) bitmap + i;
227
227
 
228
- goto done;
229
- }
228
+ goto done;
229
+ }
230
230
  }
231
231
 
232
232
  prev = (ngx_slab_page_t *)
@@ -392,7 +392,8 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)
392
392
 
393
393
  done:
394
394
 
395
- ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0, "slab alloc: %p", p);
395
+ ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0,
396
+ "slab alloc: %p", (void *) p);
396
397
 
397
398
  return (void *) p;
398
399
  }
@@ -410,7 +410,7 @@ ngx_vslprintf(u_char *buf, u_char *last, const char *fmt, va_list args)
410
410
  hex = 2;
411
411
  sign = 0;
412
412
  zero = '0';
413
- width = NGX_PTR_SIZE * 2;
413
+ width = 2 * sizeof(void *);
414
414
  break;
415
415
 
416
416
  case 'c':
@@ -10,9 +10,9 @@
10
10
 
11
11
 
12
12
  #define NGX_SYSLOG_MAX_STR \
13
- NGX_MAX_ERROR_STR + sizeof("<255>Jan 01 00:00:00 ") - 1 \
14
- + (NGX_MAXHOSTNAMELEN - 1) + 1 /* space */ \
15
- + 32 /* tag */ + 2 /* colon, space */
13
+ NGX_MAX_ERROR_STR + sizeof("<255>Jan 01 00:00:00 ") - 1 \
14
+ + (NGX_MAXHOSTNAMELEN - 1) + 1 /* space */ \
15
+ + 32 /* tag */ + 2 /* colon, space */
16
16
 
17
17
 
18
18
  static char *ngx_syslog_parse_args(ngx_conf_t *cf, ngx_syslog_peer_t *peer);
@@ -194,6 +194,9 @@ ngx_syslog_parse_args(ngx_conf_t *cf, ngx_syslog_peer_t *peer)
194
194
  peer->tag.data = p + 4;
195
195
  peer->tag.len = len - 4;
196
196
 
197
+ } else if (len == 10 && ngx_strncmp(p, "nohostname", 10) == 0) {
198
+ peer->nohostname = 1;
199
+
197
200
  } else {
198
201
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
199
202
  "unknown syslog parameter \"%s\"", p);
@@ -220,6 +223,11 @@ ngx_syslog_add_header(ngx_syslog_peer_t *peer, u_char *buf)
220
223
 
221
224
  pri = peer->facility * 8 + peer->severity;
222
225
 
226
+ if (peer->nohostname) {
227
+ return ngx_sprintf(buf, "<%ui>%V %V: ", pri, &ngx_cached_syslog_time,
228
+ &peer->tag);
229
+ }
230
+
223
231
  return ngx_sprintf(buf, "<%ui>%V %V %V: ", pri, &ngx_cached_syslog_time,
224
232
  &ngx_cycle->hostname, &peer->tag);
225
233
  }
@@ -16,7 +16,8 @@ typedef struct {
16
16
 
17
17
  ngx_addr_t server;
18
18
  ngx_connection_t conn;
19
- ngx_uint_t busy; /* unsigned busy:1; */
19
+ unsigned busy:1;
20
+ unsigned nohostname:1;
20
21
  } ngx_syslog_peer_t;
21
22
 
22
23
 
@@ -345,6 +345,8 @@ ngx_thread_pool_cycle(void *data)
345
345
  *ngx_thread_pool_done.last = task;
346
346
  ngx_thread_pool_done.last = &task->next;
347
347
 
348
+ ngx_memory_barrier();
349
+
348
350
  ngx_unlock(&ngx_thread_pool_done_lock);
349
351
 
350
352
  (void) ngx_notify(ngx_thread_pool_handler);
@@ -366,6 +368,8 @@ ngx_thread_pool_handler(ngx_event_t *ev)
366
368
  ngx_thread_pool_done.first = NULL;
367
369
  ngx_thread_pool_done.last = &ngx_thread_pool_done.first;
368
370
 
371
+ ngx_memory_barrier();
372
+
369
373
  ngx_unlock(&ngx_thread_pool_done_lock);
370
374
 
371
375
  while (task) {
@@ -154,7 +154,7 @@ ngx_time_update(void)
154
154
 
155
155
  p2 = &cached_http_log_time[slot][0];
156
156
 
157
- (void) ngx_sprintf(p2, "%02d/%s/%d:%02d:%02d:%02d %c%02d%02d",
157
+ (void) ngx_sprintf(p2, "%02d/%s/%d:%02d:%02d:%02d %c%02i%02i",
158
158
  tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1],
159
159
  tm.ngx_tm_year, tm.ngx_tm_hour,
160
160
  tm.ngx_tm_min, tm.ngx_tm_sec,
@@ -163,7 +163,7 @@ ngx_time_update(void)
163
163
 
164
164
  p3 = &cached_http_log_iso8601[slot][0];
165
165
 
166
- (void) ngx_sprintf(p3, "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d",
166
+ (void) ngx_sprintf(p3, "%4d-%02d-%02dT%02d:%02d:%02d%c%02i:%02i",
167
167
  tm.ngx_tm_year, tm.ngx_tm_mon,
168
168
  tm.ngx_tm_mday, tm.ngx_tm_hour,
169
169
  tm.ngx_tm_min, tm.ngx_tm_sec,
@@ -14,7 +14,9 @@
14
14
 
15
15
  /* Solaris declarations */
16
16
 
17
+ #ifndef POLLREMOVE
17
18
  #define POLLREMOVE 0x0800
19
+ #endif
18
20
  #define DP_POLL 0xD001
19
21
  #define DP_ISPOLLED 0xD002
20
22
 
@@ -436,7 +438,7 @@ ngx_devpoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer,
436
438
 
437
439
  default:
438
440
  ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
439
- "unexpected event %04Xd for closed and removed socket %d, ",
441
+ "unexpected event %04Xd for closed and removed socket %d, "
440
442
  "ioctl(DP_ISPOLLED) returned rc:%d, fd:%d, event %04Xd",
441
443
  revents, fd, rc, pfd.fd, pfd.revents);
442
444