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
@@ -34,6 +34,8 @@ ngx_write_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size,
34
34
  msg.msg_control = (caddr_t) &cmsg;
35
35
  msg.msg_controllen = sizeof(cmsg);
36
36
 
37
+ ngx_memzero(&cmsg, sizeof(cmsg));
38
+
37
39
  cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int));
38
40
  cmsg.cm.cmsg_level = SOL_SOCKET;
39
41
  cmsg.cm.cmsg_type = SCM_RIGHTS;
@@ -142,7 +144,7 @@ ngx_read_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size, ngx_log_t *log)
142
144
 
143
145
  if ((size_t) n < sizeof(ngx_channel_t)) {
144
146
  ngx_log_error(NGX_LOG_ALERT, log, 0,
145
- "recvmsg() returned not enough data: %uz", n);
147
+ "recvmsg() returned not enough data: %z", n);
146
148
  return NGX_ERROR;
147
149
  }
148
150
 
@@ -20,6 +20,7 @@
20
20
  #include <stddef.h> /* offsetof() */
21
21
  #include <stdio.h>
22
22
  #include <stdlib.h>
23
+ #include <ctype.h>
23
24
  #include <errno.h>
24
25
  #include <string.h>
25
26
  #include <signal.h>
@@ -59,7 +59,7 @@ sysctl_t sysctls[] = {
59
59
 
60
60
 
61
61
  void
62
- ngx_debug_init()
62
+ ngx_debug_init(void)
63
63
  {
64
64
  #if (NGX_DEBUG_MALLOC)
65
65
 
@@ -317,9 +317,9 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
317
317
 
318
318
  c->sent += sent;
319
319
 
320
- for (cl = in; cl; cl = cl->next) {
320
+ for ( /* void */ ; in; in = in->next) {
321
321
 
322
- if (ngx_buf_special(cl->buf)) {
322
+ if (ngx_buf_special(in->buf)) {
323
323
  continue;
324
324
  }
325
325
 
@@ -327,28 +327,28 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
327
327
  break;
328
328
  }
329
329
 
330
- size = ngx_buf_size(cl->buf);
330
+ size = ngx_buf_size(in->buf);
331
331
 
332
332
  if (sent >= size) {
333
333
  sent -= size;
334
334
 
335
- if (ngx_buf_in_memory(cl->buf)) {
336
- cl->buf->pos = cl->buf->last;
335
+ if (ngx_buf_in_memory(in->buf)) {
336
+ in->buf->pos = in->buf->last;
337
337
  }
338
338
 
339
- if (cl->buf->in_file) {
340
- cl->buf->file_pos = cl->buf->file_last;
339
+ if (in->buf->in_file) {
340
+ in->buf->file_pos = in->buf->file_last;
341
341
  }
342
342
 
343
343
  continue;
344
344
  }
345
345
 
346
- if (ngx_buf_in_memory(cl->buf)) {
347
- cl->buf->pos += (size_t) sent;
346
+ if (ngx_buf_in_memory(in->buf)) {
347
+ in->buf->pos += (size_t) sent;
348
348
  }
349
349
 
350
- if (cl->buf->in_file) {
351
- cl->buf->file_pos += sent;
350
+ if (in->buf->in_file) {
351
+ in->buf->file_pos += sent;
352
352
  }
353
353
 
354
354
  break;
@@ -360,13 +360,11 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
360
360
 
361
361
  if (!complete) {
362
362
  wev->ready = 0;
363
- return cl;
363
+ return in;
364
364
  }
365
365
 
366
- if (send >= limit || cl == NULL) {
367
- return cl;
366
+ if (send >= limit || in == NULL) {
367
+ return in;
368
368
  }
369
-
370
- in = cl;
371
369
  }
372
370
  }
@@ -34,6 +34,8 @@ typedef int ngx_err_t;
34
34
  #define NGX_ENOSPC ENOSPC
35
35
  #define NGX_EPIPE EPIPE
36
36
  #define NGX_EINPROGRESS EINPROGRESS
37
+ #define NGX_ENOPROTOOPT ENOPROTOOPT
38
+ #define NGX_EOPNOTSUPP EOPNOTSUPP
37
39
  #define NGX_EADDRINUSE EADDRINUSE
38
40
  #define NGX_ECONNABORTED ECONNABORTED
39
41
  #define NGX_ECONNRESET ECONNRESET
@@ -50,6 +52,7 @@ typedef int ngx_err_t;
50
52
  #define NGX_EILSEQ EILSEQ
51
53
  #define NGX_ENOMOREFILES 0
52
54
  #define NGX_ELOOP ELOOP
55
+ #define NGX_EBADF EBADF
53
56
 
54
57
  #if (NGX_HAVE_OPENAT)
55
58
  #define NGX_EMLINK EMLINK
@@ -53,7 +53,9 @@ typedef struct {
53
53
 
54
54
  #ifdef __CYGWIN__
55
55
 
56
+ #ifndef NGX_HAVE_CASELESS_FILESYSTEM
56
57
  #define NGX_HAVE_CASELESS_FILESYSTEM 1
58
+ #endif
57
59
 
58
60
  #define ngx_open_file(name, mode, create, access) \
59
61
  open((const char *) name, mode|create|O_BINARY, access)
@@ -72,8 +74,8 @@ typedef struct {
72
74
  #define NGX_FILE_RDWR O_RDWR
73
75
  #define NGX_FILE_CREATE_OR_OPEN O_CREAT
74
76
  #define NGX_FILE_OPEN 0
75
- #define NGX_FILE_TRUNCATE O_CREAT|O_TRUNC
76
- #define NGX_FILE_APPEND O_WRONLY|O_APPEND
77
+ #define NGX_FILE_TRUNCATE (O_CREAT|O_TRUNC)
78
+ #define NGX_FILE_APPEND (O_WRONLY|O_APPEND)
77
79
  #define NGX_FILE_NONBLOCK O_NONBLOCK
78
80
 
79
81
  #if (NGX_HAVE_OPENAT)
@@ -86,13 +88,16 @@ typedef struct {
86
88
  #endif
87
89
 
88
90
  #if defined(O_SEARCH)
89
- #define NGX_FILE_SEARCH O_SEARCH|NGX_FILE_DIRECTORY
91
+ #define NGX_FILE_SEARCH (O_SEARCH|NGX_FILE_DIRECTORY)
90
92
 
91
93
  #elif defined(O_EXEC)
92
- #define NGX_FILE_SEARCH O_EXEC|NGX_FILE_DIRECTORY
94
+ #define NGX_FILE_SEARCH (O_EXEC|NGX_FILE_DIRECTORY)
95
+
96
+ #elif (NGX_HAVE_O_PATH)
97
+ #define NGX_FILE_SEARCH (O_PATH|O_RDONLY|NGX_FILE_DIRECTORY)
93
98
 
94
99
  #else
95
- #define NGX_FILE_SEARCH O_RDONLY|NGX_FILE_DIRECTORY
100
+ #define NGX_FILE_SEARCH (O_RDONLY|NGX_FILE_DIRECTORY)
96
101
  #endif
97
102
 
98
103
  #endif /* NGX_HAVE_OPENAT */
@@ -189,17 +194,6 @@ ngx_int_t ngx_create_file_mapping(ngx_file_mapping_t *fm);
189
194
  void ngx_close_file_mapping(ngx_file_mapping_t *fm);
190
195
 
191
196
 
192
- #if (NGX_HAVE_CASELESS_FILESYSTEM)
193
-
194
- #define ngx_filename_cmp(s1, s2, n) strncasecmp((char *) s1, (char *) s2, n)
195
-
196
- #else
197
-
198
- #define ngx_filename_cmp ngx_memcmp
199
-
200
- #endif
201
-
202
-
203
197
  #define ngx_realpath(p, r) (u_char *) realpath((char *) p, (char *) r)
204
198
  #define ngx_realpath_n "realpath()"
205
199
  #define ngx_getcwd(buf, size) (getcwd((char *) buf, size) != NULL)
@@ -16,6 +16,7 @@
16
16
  #include <stddef.h> /* offsetof() */
17
17
  #include <stdio.h>
18
18
  #include <stdlib.h>
19
+ #include <ctype.h>
19
20
  #include <errno.h>
20
21
  #include <string.h>
21
22
  #include <signal.h>
@@ -94,6 +95,11 @@ typedef struct aiocb ngx_aiocb_t;
94
95
  #define NGX_LISTEN_BACKLOG -1
95
96
 
96
97
 
98
+ #ifdef __DragonFly__
99
+ #define NGX_KEEPALIVE_FACTOR 1000
100
+ #endif
101
+
102
+
97
103
  #if (__FreeBSD_version < 430000 || __FreeBSD_version < 500012)
98
104
 
99
105
  pid_t rfork_thread(int flags, void *stack, int (*func)(void *arg), void *arg);
@@ -72,7 +72,7 @@ sysctl_t sysctls[] = {
72
72
 
73
73
 
74
74
  void
75
- ngx_debug_init()
75
+ ngx_debug_init(void)
76
76
  {
77
77
  #if (NGX_DEBUG_MALLOC)
78
78
 
@@ -271,7 +271,7 @@ ngx_init_threads(int n, size_t size, ngx_cycle_t *cycle)
271
271
 
272
272
 
273
273
  ngx_tid_t
274
- ngx_thread_self()
274
+ ngx_thread_self(void)
275
275
  {
276
276
  ngx_int_t tid;
277
277
 
@@ -57,7 +57,7 @@ extern size_t ngx_thread_stack_size;
57
57
 
58
58
 
59
59
  static ngx_inline ngx_int_t
60
- ngx_gettid()
60
+ ngx_gettid(void)
61
61
  {
62
62
  char *sp;
63
63
 
@@ -83,7 +83,7 @@ ngx_gettid()
83
83
  }
84
84
 
85
85
 
86
- ngx_tid_t ngx_thread_self();
86
+ ngx_tid_t ngx_thread_self(void);
87
87
 
88
88
 
89
89
  typedef ngx_uint_t ngx_tls_key_t;
@@ -231,7 +231,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
231
231
  && c->tcp_nopush == NGX_TCP_NOPUSH_UNSET)
232
232
  {
233
233
  if (ngx_tcp_nopush(c->fd) == NGX_ERROR) {
234
- err = ngx_errno;
234
+ err = ngx_socket_errno;
235
235
 
236
236
  /*
237
237
  * there is a tiny chance to be interrupted, however,
@@ -368,9 +368,9 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
368
368
 
369
369
  c->sent += sent;
370
370
 
371
- for (cl = in; cl; cl = cl->next) {
371
+ for ( /* void */ ; in; in = in->next) {
372
372
 
373
- if (ngx_buf_special(cl->buf)) {
373
+ if (ngx_buf_special(in->buf)) {
374
374
  continue;
375
375
  }
376
376
 
@@ -378,28 +378,28 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
378
378
  break;
379
379
  }
380
380
 
381
- size = ngx_buf_size(cl->buf);
381
+ size = ngx_buf_size(in->buf);
382
382
 
383
383
  if (sent >= size) {
384
384
  sent -= size;
385
385
 
386
- if (ngx_buf_in_memory(cl->buf)) {
387
- cl->buf->pos = cl->buf->last;
386
+ if (ngx_buf_in_memory(in->buf)) {
387
+ in->buf->pos = in->buf->last;
388
388
  }
389
389
 
390
- if (cl->buf->in_file) {
391
- cl->buf->file_pos = cl->buf->file_last;
390
+ if (in->buf->in_file) {
391
+ in->buf->file_pos = in->buf->file_last;
392
392
  }
393
393
 
394
394
  continue;
395
395
  }
396
396
 
397
- if (ngx_buf_in_memory(cl->buf)) {
398
- cl->buf->pos += (size_t) sent;
397
+ if (ngx_buf_in_memory(in->buf)) {
398
+ in->buf->pos += (size_t) sent;
399
399
  }
400
400
 
401
- if (cl->buf->in_file) {
402
- cl->buf->file_pos += sent;
401
+ if (in->buf->in_file) {
402
+ in->buf->file_pos += sent;
403
403
  }
404
404
 
405
405
  break;
@@ -407,7 +407,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
407
407
 
408
408
  #if (NGX_HAVE_AIO_SENDFILE)
409
409
  if (c->busy_sendfile) {
410
- return cl;
410
+ return in;
411
411
  }
412
412
  #endif
413
413
 
@@ -421,7 +421,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
421
421
  */
422
422
 
423
423
  wev->ready = 0;
424
- return cl;
424
+ return in;
425
425
  }
426
426
 
427
427
  if (eintr) {
@@ -430,13 +430,11 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
430
430
 
431
431
  if (!complete) {
432
432
  wev->ready = 0;
433
- return cl;
433
+ return in;
434
434
  }
435
435
 
436
- if (send >= limit || cl == NULL) {
437
- return cl;
436
+ if (send >= limit || in == NULL) {
437
+ return in;
438
438
  }
439
-
440
- in = cl;
441
439
  }
442
440
  }
@@ -22,6 +22,7 @@
22
22
  #include <stddef.h> /* offsetof() */
23
23
  #include <stdio.h>
24
24
  #include <stdlib.h>
25
+ #include <ctype.h>
25
26
  #include <errno.h>
26
27
  #include <string.h>
27
28
  #include <signal.h>
@@ -51,7 +52,6 @@
51
52
  #include <malloc.h> /* memalign() */
52
53
  #include <limits.h> /* IOV_MAX */
53
54
  #include <sys/ioctl.h>
54
- #include <sys/sysctl.h>
55
55
  #include <crypt.h>
56
56
  #include <sys/utsname.h> /* uname() */
57
57
 
@@ -77,8 +77,14 @@ extern ssize_t sendfile(int s, int fd, int32_t *offset, size_t size);
77
77
  #endif
78
78
 
79
79
 
80
- #if (NGX_HAVE_POLL || NGX_HAVE_RTSIG)
80
+ #if (NGX_HAVE_POLL)
81
+ #include <poll.h>
82
+ #endif
83
+
84
+
85
+ #if (NGX_HAVE_RTSIG)
81
86
  #include <poll.h>
87
+ #include <sys/sysctl.h>
82
88
  #endif
83
89
 
84
90
 
@@ -24,7 +24,7 @@
24
24
  * so we limit it to 2G-1 bytes.
25
25
  */
26
26
 
27
- #define NGX_SENDFILE_LIMIT 2147483647L
27
+ #define NGX_SENDFILE_MAXSIZE 2147483647L
28
28
 
29
29
 
30
30
  #if (IOV_MAX > 64)
@@ -63,8 +63,8 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
63
63
 
64
64
  /* the maximum limit size is 2G-1 - the page size */
65
65
 
66
- if (limit == 0 || limit > (off_t) (NGX_SENDFILE_LIMIT - ngx_pagesize)) {
67
- limit = NGX_SENDFILE_LIMIT - ngx_pagesize;
66
+ if (limit == 0 || limit > (off_t) (NGX_SENDFILE_MAXSIZE - ngx_pagesize)) {
67
+ limit = NGX_SENDFILE_MAXSIZE - ngx_pagesize;
68
68
  }
69
69
 
70
70
 
@@ -163,7 +163,7 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
163
163
  if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
164
164
  (const void *) &tcp_nodelay, sizeof(int)) == -1)
165
165
  {
166
- err = ngx_errno;
166
+ err = ngx_socket_errno;
167
167
 
168
168
  /*
169
169
  * there is a tiny chance to be interrupted, however,
@@ -181,7 +181,7 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
181
181
  } else {
182
182
  c->tcp_nodelay = NGX_TCP_NODELAY_UNSET;
183
183
 
184
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
184
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
185
185
  "no tcp_nodelay");
186
186
  }
187
187
  }
@@ -189,7 +189,7 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
189
189
  if (c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) {
190
190
 
191
191
  if (ngx_tcp_nopush(c->fd) == NGX_ERROR) {
192
- err = ngx_errno;
192
+ err = ngx_socket_errno;
193
193
 
194
194
  /*
195
195
  * there is a tiny chance to be interrupted, however,
@@ -325,9 +325,9 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
325
325
 
326
326
  c->sent += sent;
327
327
 
328
- for (cl = in; cl; cl = cl->next) {
328
+ for ( /* void */ ; in; in = in->next) {
329
329
 
330
- if (ngx_buf_special(cl->buf)) {
330
+ if (ngx_buf_special(in->buf)) {
331
331
  continue;
332
332
  }
333
333
 
@@ -335,28 +335,28 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
335
335
  break;
336
336
  }
337
337
 
338
- size = ngx_buf_size(cl->buf);
338
+ size = ngx_buf_size(in->buf);
339
339
 
340
340
  if (sent >= size) {
341
341
  sent -= size;
342
342
 
343
- if (ngx_buf_in_memory(cl->buf)) {
344
- cl->buf->pos = cl->buf->last;
343
+ if (ngx_buf_in_memory(in->buf)) {
344
+ in->buf->pos = in->buf->last;
345
345
  }
346
346
 
347
- if (cl->buf->in_file) {
348
- cl->buf->file_pos = cl->buf->file_last;
347
+ if (in->buf->in_file) {
348
+ in->buf->file_pos = in->buf->file_last;
349
349
  }
350
350
 
351
351
  continue;
352
352
  }
353
353
 
354
- if (ngx_buf_in_memory(cl->buf)) {
355
- cl->buf->pos += (size_t) sent;
354
+ if (ngx_buf_in_memory(in->buf)) {
355
+ in->buf->pos += (size_t) sent;
356
356
  }
357
357
 
358
- if (cl->buf->in_file) {
359
- cl->buf->file_pos += sent;
358
+ if (in->buf->in_file) {
359
+ in->buf->file_pos += sent;
360
360
  }
361
361
 
362
362
  break;
@@ -368,13 +368,11 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
368
368
 
369
369
  if (!complete) {
370
370
  wev->ready = 0;
371
- return cl;
371
+ return in;
372
372
  }
373
373
 
374
- if (send >= limit || cl == NULL) {
375
- return cl;
374
+ if (send >= limit || in == NULL) {
375
+ return in;
376
376
  }
377
-
378
- in = cl;
379
377
  }
380
378
  }