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
@@ -144,7 +144,7 @@ static ngx_command_t ngx_http_image_filter_commands[] = {
144
144
  offsetof(ngx_http_image_filter_conf_t, transparency),
145
145
  NULL },
146
146
 
147
- { ngx_string("image_filter_interlace"),
147
+ { ngx_string("image_filter_interlace"),
148
148
  NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
149
149
  ngx_conf_set_flag_slot,
150
150
  NGX_HTTP_LOC_CONF_OFFSET,
@@ -737,7 +737,7 @@ ngx_http_image_size(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
737
737
  }
738
738
 
739
739
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
740
- "image size: %d x %d", width, height);
740
+ "image size: %d x %d", (int) width, (int) height);
741
741
 
742
742
  ctx->width = width;
743
743
  ctx->height = height;
@@ -232,7 +232,7 @@ ngx_http_limit_conn_handler(ngx_http_request_t *r)
232
232
  }
233
233
 
234
234
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
235
- "limit conn: %08XD %d", node->key, lc->conn);
235
+ "limit conn: %08Xi %d", node->key, lc->conn);
236
236
 
237
237
  ngx_shmtx_unlock(&shpool->mutex);
238
238
 
@@ -351,7 +351,7 @@ ngx_http_limit_conn_cleanup(void *data)
351
351
  ngx_shmtx_lock(&shpool->mutex);
352
352
 
353
353
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lccln->shm_zone->shm.log, 0,
354
- "limit conn cleanup: %08XD %d", node->key, lc->conn);
354
+ "limit conn cleanup: %08Xi %d", node->key, lc->conn);
355
355
 
356
356
  lc->conn--;
357
357
 
@@ -919,13 +919,6 @@ ngx_http_limit_req(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
919
919
  return NGX_CONF_ERROR;
920
920
  }
921
921
 
922
- if (shm_zone->data == NULL) {
923
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
924
- "unknown limit_req_zone \"%V\"",
925
- &shm_zone->shm.name);
926
- return NGX_CONF_ERROR;
927
- }
928
-
929
922
  limits = lrcf->limits.elts;
930
923
 
931
924
  if (limits == NULL) {
@@ -141,7 +141,7 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
141
141
  *v = *value;
142
142
 
143
143
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
144
- "http map: \"%v\" \"%v\"", &val, v);
144
+ "http map: \"%V\" \"%v\"", &val, v);
145
145
 
146
146
  return NGX_OK;
147
147
  }
@@ -375,7 +375,7 @@ ngx_http_map_cmp_dns_wildcards(const void *one, const void *two)
375
375
  static char *
376
376
  ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
377
377
  {
378
- ngx_int_t rc, index;
378
+ ngx_int_t rv, index;
379
379
  ngx_str_t *value, name;
380
380
  ngx_uint_t i, key;
381
381
  ngx_http_map_conf_ctx_t *ctx;
@@ -546,19 +546,19 @@ found:
546
546
  value[0].data++;
547
547
  }
548
548
 
549
- rc = ngx_hash_add_key(&ctx->keys, &value[0], var,
549
+ rv = ngx_hash_add_key(&ctx->keys, &value[0], var,
550
550
  (ctx->hostnames) ? NGX_HASH_WILDCARD_KEY : 0);
551
551
 
552
- if (rc == NGX_OK) {
552
+ if (rv == NGX_OK) {
553
553
  return NGX_CONF_OK;
554
554
  }
555
555
 
556
- if (rc == NGX_DECLINED) {
556
+ if (rv == NGX_DECLINED) {
557
557
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
558
558
  "invalid hostname or wildcard \"%V\"", &value[0]);
559
559
  }
560
560
 
561
- if (rc == NGX_BUSY) {
561
+ if (rv == NGX_BUSY) {
562
562
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
563
563
  "conflicting parameter \"%V\"", &value[0]);
564
564
  }
@@ -523,7 +523,7 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
523
523
  cl->buf->tag = u->output.tag;
524
524
 
525
525
  ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0,
526
- "memcached filter bytes:%z size:%z length:%z rest:%z",
526
+ "memcached filter bytes:%z size:%z length:%O rest:%z",
527
527
  bytes, b->last - b->pos, u->length, ctx->rest);
528
528
 
529
529
  if (bytes <= (ssize_t) (u->length - NGX_HTTP_MEMCACHED_END)) {
@@ -618,6 +618,7 @@ ngx_http_memcached_create_loc_conf(ngx_conf_t *cf)
618
618
  conf->upstream.intercept_404 = 1;
619
619
  conf->upstream.pass_request_headers = 0;
620
620
  conf->upstream.pass_request_body = 0;
621
+ conf->upstream.force_ranges = 1;
621
622
 
622
623
  conf->index = NGX_CONF_UNSET;
623
624
  conf->gzip_flag = NGX_CONF_UNSET_UINT;
@@ -913,7 +913,7 @@ ngx_http_mp4_read_atom(ngx_http_mp4_file_t *mp4,
913
913
 
914
914
  ngx_log_debug4(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,
915
915
  "mp4 atom: %*s @%O:%uL",
916
- 4, atom_name, mp4->offset, atom_size);
916
+ (size_t) 4, atom_name, mp4->offset, atom_size);
917
917
 
918
918
  if (atom_size > (uint64_t) (NGX_MAX_OFF_T_VALUE - mp4->offset)
919
919
  || mp4->offset + (off_t) atom_size > end)
@@ -1433,10 +1433,10 @@ typedef struct {
1433
1433
  u_char layer[2];
1434
1434
  u_char group[2];
1435
1435
  u_char volume[2];
1436
- u_char reverved3[2];
1436
+ u_char reserved3[2];
1437
1437
  u_char matrix[36];
1438
1438
  u_char width[4];
1439
- u_char heigth[4];
1439
+ u_char height[4];
1440
1440
  } ngx_mp4_tkhd_atom_t;
1441
1441
 
1442
1442
  typedef struct {
@@ -1453,10 +1453,10 @@ typedef struct {
1453
1453
  u_char layer[2];
1454
1454
  u_char group[2];
1455
1455
  u_char volume[2];
1456
- u_char reverved3[2];
1456
+ u_char reserved3[2];
1457
1457
  u_char matrix[36];
1458
1458
  u_char width[4];
1459
- u_char heigth[4];
1459
+ u_char height[4];
1460
1460
  } ngx_mp4_tkhd64_atom_t;
1461
1461
 
1462
1462
 
@@ -1958,7 +1958,7 @@ ngx_http_mp4_read_stsd_atom(ngx_http_mp4_file_t *mp4, uint64_t atom_data_size)
1958
1958
  ngx_log_debug3(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0,
1959
1959
  "stsd entries:%uD, media:%*s",
1960
1960
  ngx_mp4_get_32value(stsd_atom->entries),
1961
- 4, stsd_atom->media_name);
1961
+ (size_t) 4, stsd_atom->media_name);
1962
1962
 
1963
1963
  trak = ngx_mp4_last_trak(mp4);
1964
1964
 
@@ -2555,14 +2555,14 @@ ngx_http_mp4_crop_ctts_data(ngx_http_mp4_file_t *mp4,
2555
2555
  "sample:%uD, count:%uD, offset:%uD",
2556
2556
  start_sample, count, ngx_mp4_get_32value(entry->offset));
2557
2557
 
2558
- if (start_sample <= count) {
2559
- rest = start_sample - 1;
2560
- goto found;
2561
- }
2558
+ if (start_sample <= count) {
2559
+ rest = start_sample - 1;
2560
+ goto found;
2561
+ }
2562
2562
 
2563
- start_sample -= count;
2564
- entries--;
2565
- entry++;
2563
+ start_sample -= count;
2564
+ entries--;
2565
+ entry++;
2566
2566
  }
2567
2567
 
2568
2568
  if (start) {
@@ -118,7 +118,7 @@ ngx_http_test_if_unmodified(ngx_http_request_t *r)
118
118
  return 0;
119
119
  }
120
120
 
121
- iums = ngx_http_parse_time(r->headers_in.if_unmodified_since->value.data,
121
+ iums = ngx_parse_http_time(r->headers_in.if_unmodified_since->value.data,
122
122
  r->headers_in.if_unmodified_since->value.len);
123
123
 
124
124
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -148,7 +148,7 @@ ngx_http_test_if_modified(ngx_http_request_t *r)
148
148
  return 1;
149
149
  }
150
150
 
151
- ims = ngx_http_parse_time(r->headers_in.if_modified_since->value.data,
151
+ ims = ngx_parse_http_time(r->headers_in.if_modified_since->value.data,
152
152
  r->headers_in.if_modified_since->value.len);
153
153
 
154
154
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -213,6 +213,7 @@ static ngx_conf_bitmask_t ngx_http_proxy_next_upstream_masks[] = {
213
213
  { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR },
214
214
  { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
215
215
  { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
216
+ { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
216
217
  { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
217
218
  { ngx_string("http_502"), NGX_HTTP_UPSTREAM_FT_HTTP_502 },
218
219
  { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
@@ -533,6 +534,13 @@ static ngx_command_t ngx_http_proxy_commands[] = {
533
534
  offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_revalidate),
534
535
  NULL },
535
536
 
537
+ { ngx_string("proxy_cache_convert_head"),
538
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
539
+ ngx_conf_set_flag_slot,
540
+ NGX_HTTP_LOC_CONF_OFFSET,
541
+ offsetof(ngx_http_proxy_loc_conf_t, upstream.cache_convert_head),
542
+ NULL },
543
+
536
544
  #endif
537
545
 
538
546
  { ngx_string("proxy_temp_path"),
@@ -1008,10 +1016,11 @@ ngx_http_proxy_eval(ngx_http_request_t *r, ngx_http_proxy_ctx_t *ctx,
1008
1016
 
1009
1017
  } else {
1010
1018
  u->resolved->host = url.host;
1011
- u->resolved->port = (in_port_t) (url.no_port ? port : url.port);
1012
- u->resolved->no_port = url.no_port;
1013
1019
  }
1014
1020
 
1021
+ u->resolved->port = (in_port_t) (url.no_port ? port : url.port);
1022
+ u->resolved->no_port = url.no_port;
1023
+
1015
1024
  return NGX_OK;
1016
1025
  }
1017
1026
 
@@ -1149,25 +1158,24 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
1149
1158
  if (u->method.len) {
1150
1159
  /* HEAD was changed to GET to cache response */
1151
1160
  method = u->method;
1152
- method.len++;
1153
1161
 
1154
1162
  } else if (plcf->method.len) {
1155
1163
  method = plcf->method;
1156
1164
 
1157
1165
  } else {
1158
1166
  method = r->method_name;
1159
- method.len++;
1160
1167
  }
1161
1168
 
1162
1169
  ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
1163
1170
 
1164
- if (method.len == 5
1165
- && ngx_strncasecmp(method.data, (u_char *) "HEAD ", 5) == 0)
1171
+ if (method.len == 4
1172
+ && ngx_strncasecmp(method.data, (u_char *) "HEAD", 4) == 0)
1166
1173
  {
1167
1174
  ctx->head = 1;
1168
1175
  }
1169
1176
 
1170
- len = method.len + sizeof(ngx_http_proxy_version) - 1 + sizeof(CRLF) - 1;
1177
+ len = method.len + 1 + sizeof(ngx_http_proxy_version) - 1
1178
+ + sizeof(CRLF) - 1;
1171
1179
 
1172
1180
  escape = 0;
1173
1181
  loc_len = 0;
@@ -1286,6 +1294,7 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
1286
1294
  /* the request line */
1287
1295
 
1288
1296
  b->last = ngx_copy(b->last, method.data, method.len);
1297
+ *b->last++ = ' ';
1289
1298
 
1290
1299
  u->uri.data = b->last;
1291
1300
 
@@ -1550,7 +1559,7 @@ ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in)
1550
1559
 
1551
1560
  for ( ;; ) {
1552
1561
  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1553
- "proxy output chunk: %d", ngx_buf_size(cl->buf));
1562
+ "proxy output chunk: %O", ngx_buf_size(cl->buf));
1554
1563
 
1555
1564
  size += ngx_buf_size(cl->buf);
1556
1565
 
@@ -1908,7 +1917,7 @@ ngx_http_proxy_input_filter_init(void *data)
1908
1917
  }
1909
1918
 
1910
1919
  ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1911
- "http proxy filter init s:%d h:%d c:%d l:%O",
1920
+ "http proxy filter init s:%ui h:%d c:%d l:%O",
1912
1921
  u->headers_in.status_n, ctx->head, u->headers_in.chunked,
1913
1922
  u->headers_in.content_length_n);
1914
1923
 
@@ -2116,7 +2125,7 @@ ngx_http_proxy_chunked_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
2116
2125
  }
2117
2126
 
2118
2127
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2119
- "http proxy chunked state %d, length %d",
2128
+ "http proxy chunked state %ui, length %O",
2120
2129
  ctx->chunked.state, p->length);
2121
2130
 
2122
2131
  if (b) {
@@ -2290,7 +2299,7 @@ ngx_http_proxy_non_buffered_chunked_filter(void *data, ssize_t bytes)
2290
2299
 
2291
2300
  for (cl = u->out_bufs; cl; cl = cl->next) {
2292
2301
  ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2293
- "http proxy in memory %p-%p %uz",
2302
+ "http proxy in memory %p-%p %O",
2294
2303
  cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf));
2295
2304
 
2296
2305
  if (buf->last == cl->buf->pos) {
@@ -2845,6 +2854,7 @@ ngx_http_proxy_create_loc_conf(ngx_conf_t *cf)
2845
2854
  conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
2846
2855
  conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC;
2847
2856
  conf->upstream.cache_revalidate = NGX_CONF_UNSET;
2857
+ conf->upstream.cache_convert_head = NGX_CONF_UNSET;
2848
2858
  #endif
2849
2859
 
2850
2860
  conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
@@ -3143,17 +3153,13 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
3143
3153
  ngx_conf_merge_value(conf->upstream.cache_revalidate,
3144
3154
  prev->upstream.cache_revalidate, 0);
3145
3155
 
3156
+ ngx_conf_merge_value(conf->upstream.cache_convert_head,
3157
+ prev->upstream.cache_convert_head, 1);
3158
+
3146
3159
  #endif
3147
3160
 
3148
3161
  ngx_conf_merge_str_value(conf->method, prev->method, "");
3149
3162
 
3150
- if (conf->method.len
3151
- && conf->method.data[conf->method.len - 1] != ' ')
3152
- {
3153
- conf->method.data[conf->method.len] = ' ';
3154
- conf->method.len++;
3155
- }
3156
-
3157
3163
  ngx_conf_merge_value(conf->upstream.pass_request_headers,
3158
3164
  prev->upstream.pass_request_headers, 1);
3159
3165
  ngx_conf_merge_value(conf->upstream.pass_request_body,
@@ -3168,9 +3174,8 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
3168
3174
  prev->upstream.ssl_session_reuse, 1);
3169
3175
 
3170
3176
  ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
3171
- (NGX_CONF_BITMASK_SET|NGX_SSL_SSLv3
3172
- |NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
3173
- |NGX_SSL_TLSv1_2));
3177
+ (NGX_CONF_BITMASK_SET|NGX_SSL_TLSv1
3178
+ |NGX_SSL_TLSv1_1|NGX_SSL_TLSv1_2));
3174
3179
 
3175
3180
  ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
3176
3181
  "DEFAULT");
@@ -230,7 +230,7 @@ ngx_http_random_index_handler(ngx_http_request_t *r)
230
230
 
231
231
  if (ngx_close_dir(&dir) == NGX_ERROR) {
232
232
  ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
233
- ngx_close_dir_n " \"%s\" failed", &path);
233
+ ngx_close_dir_n " \"%V\" failed", &path);
234
234
  }
235
235
 
236
236
  n = names.nelts;
@@ -154,7 +154,7 @@ ngx_http_range_header_filter(ngx_http_request_t *r)
154
154
 
155
155
  if (r->http_version < NGX_HTTP_VERSION_10
156
156
  || r->headers_out.status != NGX_HTTP_OK
157
- || r != r->main
157
+ || (r != r->main && !r->subrequest_ranges)
158
158
  || r->headers_out.content_length_n == -1
159
159
  || !r->allow_ranges)
160
160
  {
@@ -204,10 +204,10 @@ ngx_http_range_header_filter(ngx_http_request_t *r)
204
204
  goto next_filter;
205
205
  }
206
206
 
207
- if_range_time = ngx_http_parse_time(if_range->data, if_range->len);
207
+ if_range_time = ngx_parse_http_time(if_range->data, if_range->len);
208
208
 
209
209
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
210
- "http ir:%d lm:%d",
210
+ "http ir:%T lm:%T",
211
211
  if_range_time, r->headers_out.last_modified_time);
212
212
 
213
213
  if (if_range_time != r->headers_out.last_modified_time) {
@@ -222,6 +222,8 @@ parse:
222
222
  return NGX_ERROR;
223
223
  }
224
224
 
225
+ ctx->offset = r->headers_out.content_offset;
226
+
225
227
  if (ngx_array_init(&ctx->ranges, r->pool, 1, sizeof(ngx_http_range_t))
226
228
  != NGX_OK)
227
229
  {
@@ -273,10 +275,21 @@ static ngx_int_t
273
275
  ngx_http_range_parse(ngx_http_request_t *r, ngx_http_range_filter_ctx_t *ctx,
274
276
  ngx_uint_t ranges)
275
277
  {
276
- u_char *p;
277
- off_t start, end, size, content_length, cutoff, cutlim;
278
- ngx_uint_t suffix;
279
- ngx_http_range_t *range;
278
+ u_char *p;
279
+ off_t start, end, size, content_length, cutoff,
280
+ cutlim;
281
+ ngx_uint_t suffix;
282
+ ngx_http_range_t *range;
283
+ ngx_http_range_filter_ctx_t *mctx;
284
+
285
+ if (r != r->main) {
286
+ mctx = ngx_http_get_module_ctx(r->main,
287
+ ngx_http_range_body_filter_module);
288
+ if (mctx) {
289
+ ctx->ranges = mctx->ranges;
290
+ return NGX_OK;
291
+ }
292
+ }
280
293
 
281
294
  p = r->headers_in.range->value.data + 6;
282
295
  size = 0;
@@ -395,6 +408,10 @@ ngx_http_range_singlepart_header(ngx_http_request_t *r,
395
408
  ngx_table_elt_t *content_range;
396
409
  ngx_http_range_t *range;
397
410
 
411
+ if (r != r->main) {
412
+ return ngx_http_next_header_filter(r);
413
+ }
414
+
398
415
  content_range = ngx_list_push(&r->headers_out.headers);
399
416
  if (content_range == NULL) {
400
417
  return NGX_ERROR;
@@ -422,6 +439,7 @@ ngx_http_range_singlepart_header(ngx_http_request_t *r,
422
439
  - content_range->value.data;
423
440
 
424
441
  r->headers_out.content_length_n = range->end - range->start;
442
+ r->headers_out.content_offset = range->start;
425
443
 
426
444
  if (r->headers_out.content_length) {
427
445
  r->headers_out.content_length->hash = 0;
@@ -647,7 +665,7 @@ ngx_http_range_test_overlapped(ngx_http_request_t *r,
647
665
  range = ctx->ranges.elts;
648
666
  for (i = 0; i < ctx->ranges.nelts; i++) {
649
667
  if (start > range[i].start || last < range[i].end) {
650
- goto overlapped;
668
+ goto overlapped;
651
669
  }
652
670
  }
653
671
  }
@@ -43,9 +43,14 @@ static char *ngx_http_realip(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
43
43
  static void *ngx_http_realip_create_loc_conf(ngx_conf_t *cf);
44
44
  static char *ngx_http_realip_merge_loc_conf(ngx_conf_t *cf,
45
45
  void *parent, void *child);
46
+ static ngx_int_t ngx_http_realip_add_variables(ngx_conf_t *cf);
46
47
  static ngx_int_t ngx_http_realip_init(ngx_conf_t *cf);
47
48
 
48
49
 
50
+ static ngx_int_t ngx_http_realip_remote_addr_variable(ngx_http_request_t *r,
51
+ ngx_http_variable_value_t *v, uintptr_t data);
52
+
53
+
49
54
  static ngx_command_t ngx_http_realip_commands[] = {
50
55
 
51
56
  { ngx_string("set_real_ip_from"),
@@ -75,7 +80,7 @@ static ngx_command_t ngx_http_realip_commands[] = {
75
80
 
76
81
 
77
82
  static ngx_http_module_t ngx_http_realip_module_ctx = {
78
- NULL, /* preconfiguration */
83
+ ngx_http_realip_add_variables, /* preconfiguration */
79
84
  ngx_http_realip_init, /* postconfiguration */
80
85
 
81
86
  NULL, /* create main configuration */
@@ -105,6 +110,15 @@ ngx_module_t ngx_http_realip_module = {
105
110
  };
106
111
 
107
112
 
113
+ static ngx_http_variable_t ngx_http_realip_vars[] = {
114
+
115
+ { ngx_string("realip_remote_addr"), NULL,
116
+ ngx_http_realip_remote_addr_variable, 0, 0, 0 },
117
+
118
+ { ngx_null_string, NULL, NULL, 0, 0, 0 }
119
+ };
120
+
121
+
108
122
  static ngx_int_t
109
123
  ngx_http_realip_handler(ngx_http_request_t *r)
110
124
  {
@@ -314,8 +328,8 @@ ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
314
328
  #if (NGX_HAVE_UNIX_DOMAIN)
315
329
 
316
330
  if (ngx_strcmp(value[1].data, "unix:") == 0) {
317
- cidr->family = AF_UNIX;
318
- return NGX_CONF_OK;
331
+ cidr->family = AF_UNIX;
332
+ return NGX_CONF_OK;
319
333
  }
320
334
 
321
335
  #endif
@@ -416,6 +430,25 @@ ngx_http_realip_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
416
430
  }
417
431
 
418
432
 
433
+ static ngx_int_t
434
+ ngx_http_realip_add_variables(ngx_conf_t *cf)
435
+ {
436
+ ngx_http_variable_t *var, *v;
437
+
438
+ for (v = ngx_http_realip_vars; v->name.len; v++) {
439
+ var = ngx_http_add_variable(cf, &v->name, v->flags);
440
+ if (var == NULL) {
441
+ return NGX_ERROR;
442
+ }
443
+
444
+ var->get_handler = v->get_handler;
445
+ var->data = v->data;
446
+ }
447
+
448
+ return NGX_OK;
449
+ }
450
+
451
+
419
452
  static ngx_int_t
420
453
  ngx_http_realip_init(ngx_conf_t *cf)
421
454
  {
@@ -440,3 +473,40 @@ ngx_http_realip_init(ngx_conf_t *cf)
440
473
 
441
474
  return NGX_OK;
442
475
  }
476
+
477
+
478
+ static ngx_int_t
479
+ ngx_http_realip_remote_addr_variable(ngx_http_request_t *r,
480
+ ngx_http_variable_value_t *v, uintptr_t data)
481
+ {
482
+ ngx_str_t *addr_text;
483
+ ngx_pool_cleanup_t *cln;
484
+ ngx_http_realip_ctx_t *ctx;
485
+
486
+ ctx = ngx_http_get_module_ctx(r, ngx_http_realip_module);
487
+
488
+ if (ctx == NULL && (r->internal || r->filter_finalize)) {
489
+
490
+ /*
491
+ * if module context was reset, the original address
492
+ * can still be found in the cleanup handler
493
+ */
494
+
495
+ for (cln = r->pool->cleanup; cln; cln = cln->next) {
496
+ if (cln->handler == ngx_http_realip_cleanup) {
497
+ ctx = cln->data;
498
+ break;
499
+ }
500
+ }
501
+ }
502
+
503
+ addr_text = ctx ? &ctx->addr_text : &r->connection->addr_text;
504
+
505
+ v->len = addr_text->len;
506
+ v->valid = 1;
507
+ v->no_cacheable = 0;
508
+ v->not_found = 0;
509
+ v->data = addr_text->data;
510
+
511
+ return NGX_OK;
512
+ }