nginxtra 1.0.15.0 → 1.2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/nginxtra +1 -1
- data/lib/nginxtra/action.rb +10 -0
- data/lib/nginxtra/actions/compile.rb +16 -2
- data/lib/nginxtra/actions/start.rb +18 -2
- data/lib/nginxtra/actions/status.rb +1 -10
- data/lib/nginxtra/actions/stop.rb +18 -0
- data/lib/nginxtra/cli.rb +12 -3
- data/lib/nginxtra/config.rb +10 -0
- data/src/nginx/CHANGES +311 -90
- data/src/nginx/CHANGES.ru +315 -88
- data/src/nginx/auto/lib/pcre/conf +22 -5
- data/src/nginx/auto/lib/pcre/make +1 -1
- data/src/nginx/auto/modules +14 -3
- data/src/nginx/auto/options +17 -3
- data/src/nginx/auto/os/freebsd +8 -0
- data/src/nginx/auto/os/linux +5 -4
- data/src/nginx/auto/os/solaris +2 -1
- data/src/nginx/auto/sources +10 -2
- data/src/nginx/auto/summary +2 -0
- data/src/nginx/auto/types/sizeof +2 -1
- data/src/nginx/auto/types/typedef +1 -1
- data/src/nginx/auto/types/uintptr_t +7 -4
- data/src/nginx/auto/unix +82 -21
- data/src/nginx/conf/fastcgi.conf +1 -0
- data/src/nginx/conf/fastcgi_params +1 -0
- data/src/nginx/conf/scgi_params +1 -0
- data/src/nginx/conf/uwsgi_params +1 -0
- data/src/nginx/man/nginx.8 +49 -49
- data/src/nginx/src/core/nginx.c +10 -12
- data/src/nginx/src/core/nginx.h +2 -2
- data/src/nginx/src/core/ngx_buf.c +9 -7
- data/src/nginx/src/core/ngx_buf.h +2 -2
- data/src/nginx/src/core/ngx_conf_file.c +4 -11
- data/src/nginx/src/core/ngx_conf_file.h +1 -1
- data/src/nginx/src/core/ngx_connection.c +52 -1
- data/src/nginx/src/core/ngx_connection.h +6 -0
- data/src/nginx/src/core/ngx_core.h +5 -0
- data/src/nginx/src/core/ngx_cycle.c +1 -1
- data/src/nginx/src/core/ngx_cycle.h +2 -2
- data/src/nginx/src/core/ngx_file.c +1 -1
- data/src/nginx/src/core/ngx_inet.c +11 -8
- data/src/nginx/src/core/ngx_murmurhash.h +1 -1
- data/src/nginx/src/core/ngx_open_file_cache.c +343 -38
- data/src/nginx/src/core/ngx_open_file_cache.h +10 -0
- data/src/nginx/src/core/ngx_output_chain.c +2 -1
- data/src/nginx/src/core/ngx_parse.h +0 -3
- data/src/nginx/src/core/ngx_rbtree.c +1 -2
- data/src/nginx/src/core/ngx_regex.c +263 -5
- data/src/nginx/src/core/ngx_regex.h +6 -2
- data/src/nginx/src/core/ngx_resolver.c +88 -21
- data/src/nginx/src/core/ngx_resolver.h +7 -8
- data/src/nginx/src/core/ngx_shmtx.c +69 -44
- data/src/nginx/src/core/ngx_shmtx.h +12 -1
- data/src/nginx/src/core/ngx_slab.c +3 -3
- data/src/nginx/src/core/ngx_slab.h +1 -1
- data/src/nginx/src/core/ngx_string.c +19 -16
- data/src/nginx/src/core/ngx_times.c +2 -2
- data/src/nginx/src/event/modules/ngx_epoll_module.c +2 -2
- data/src/nginx/src/event/modules/ngx_eventport_module.c +1 -1
- data/src/nginx/src/event/modules/ngx_kqueue_module.c +1 -1
- data/src/nginx/src/event/ngx_event.c +25 -17
- data/src/nginx/src/event/ngx_event_openssl.c +3 -1
- data/src/nginx/src/event/ngx_event_pipe.c +108 -85
- data/src/nginx/src/event/ngx_event_pipe.h +1 -2
- data/src/nginx/src/event/ngx_event_timer.c +2 -3
- data/src/nginx/src/http/modules/ngx_http_access_module.c +9 -4
- data/src/nginx/src/http/modules/ngx_http_browser_module.c +5 -3
- data/src/nginx/src/http/modules/ngx_http_chunked_filter_module.c +1 -1
- data/src/nginx/src/http/modules/ngx_http_degradation_module.c +1 -1
- data/src/nginx/src/http/modules/ngx_http_fastcgi_module.c +144 -22
- data/src/nginx/src/http/modules/ngx_http_flv_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_geo_module.c +3 -3
- data/src/nginx/src/http/modules/ngx_http_gzip_filter_module.c +20 -6
- data/src/nginx/src/http/modules/ngx_http_gzip_static_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_headers_filter_module.c +23 -27
- data/src/nginx/src/http/modules/ngx_http_image_filter_module.c +1 -3
- data/src/nginx/src/http/modules/ngx_http_index_module.c +24 -0
- data/src/nginx/src/http/modules/ngx_http_limit_conn_module.c +747 -0
- data/src/nginx/src/http/modules/ngx_http_limit_req_module.c +289 -133
- data/src/nginx/src/http/modules/ngx_http_log_module.c +34 -6
- data/src/nginx/src/http/modules/ngx_http_memcached_module.c +19 -3
- data/src/nginx/src/http/modules/ngx_http_mp4_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_proxy_module.c +1446 -239
- data/src/nginx/src/http/modules/ngx_http_realip_module.c +4 -10
- data/src/nginx/src/http/modules/ngx_http_scgi_module.c +90 -21
- data/src/nginx/src/http/modules/ngx_http_split_clients_module.c +8 -11
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.c +16 -6
- data/src/nginx/src/http/modules/ngx_http_static_module.c +8 -0
- data/src/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +2 -2
- data/src/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +570 -0
- data/src/nginx/src/http/modules/ngx_http_userid_filter_module.c +1 -5
- data/src/nginx/src/http/modules/ngx_http_uwsgi_module.c +77 -26
- data/src/nginx/src/http/modules/ngx_http_xslt_filter_module.c +171 -37
- data/src/nginx/src/http/modules/perl/nginx.pm +2 -1
- data/src/nginx/src/http/modules/perl/nginx.xs +4 -0
- data/src/nginx/src/http/ngx_http.c +8 -1
- data/src/nginx/src/http/ngx_http.h +1 -0
- data/src/nginx/src/http/ngx_http_busy_lock.c +2 -2
- data/src/nginx/src/http/ngx_http_cache.h +12 -1
- data/src/nginx/src/http/ngx_http_copy_filter_module.c +4 -3
- data/src/nginx/src/http/ngx_http_core_module.c +303 -37
- data/src/nginx/src/http/ngx_http_core_module.h +15 -0
- data/src/nginx/src/http/ngx_http_file_cache.c +226 -52
- data/src/nginx/src/http/ngx_http_parse.c +69 -3
- data/src/nginx/src/http/ngx_http_postpone_filter_module.c +4 -4
- data/src/nginx/src/http/ngx_http_request.c +61 -27
- data/src/nginx/src/http/ngx_http_request.h +3 -3
- data/src/nginx/src/http/ngx_http_request_body.c +1 -1
- data/src/nginx/src/http/ngx_http_script.c +6 -0
- data/src/nginx/src/http/ngx_http_upstream.c +200 -47
- data/src/nginx/src/http/ngx_http_upstream.h +20 -1
- data/src/nginx/src/http/ngx_http_upstream_round_robin.c +22 -6
- data/src/nginx/src/http/ngx_http_upstream_round_robin.h +1 -0
- data/src/nginx/src/http/ngx_http_variables.c +123 -4
- data/src/nginx/src/mail/ngx_mail.c +13 -0
- data/src/nginx/src/mail/ngx_mail.h +12 -0
- data/src/nginx/src/mail/ngx_mail_core_module.c +100 -15
- data/src/nginx/src/os/unix/ngx_daemon.c +2 -1
- data/src/nginx/src/os/unix/ngx_darwin.h +3 -0
- data/src/nginx/src/os/unix/ngx_darwin_config.h +1 -0
- data/src/nginx/src/os/unix/ngx_darwin_init.c +30 -0
- data/src/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +11 -5
- data/src/nginx/src/os/unix/ngx_errno.h +5 -0
- data/src/nginx/src/os/unix/ngx_files.h +50 -1
- data/src/nginx/src/os/unix/ngx_freebsd.h +2 -1
- data/src/nginx/src/os/unix/ngx_freebsd_config.h +2 -0
- data/src/nginx/src/os/unix/ngx_freebsd_init.c +4 -3
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +2 -2
- data/src/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +12 -6
- data/src/nginx/src/os/unix/ngx_gcc_atomic_sparc64.h +1 -1
- data/src/nginx/src/os/unix/ngx_linux_config.h +1 -0
- data/src/nginx/src/os/unix/ngx_linux_sendfile_chain.c +6 -4
- data/src/nginx/src/os/unix/ngx_os.h +0 -1
- data/src/nginx/src/os/unix/ngx_posix_config.h +3 -0
- data/src/nginx/src/os/unix/ngx_process.c +50 -11
- data/src/nginx/src/os/unix/ngx_process.h +1 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.c +6 -15
- data/src/nginx/src/os/unix/ngx_readv_chain.c +8 -0
- data/src/nginx/src/os/unix/ngx_setaffinity.c +69 -0
- data/src/nginx/src/os/unix/ngx_setaffinity.h +23 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.c +1 -1
- data/src/nginx/src/os/unix/ngx_solaris_config.h +2 -0
- data/src/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +11 -3
- data/src/nginx/src/os/unix/ngx_writev_chain.c +7 -3
- metadata +7 -4
- data/src/nginx/src/http/modules/ngx_http_limit_zone_module.c +0 -553
@@ -9,6 +9,7 @@
|
|
9
9
|
#define _NGX_DARWIN_H_INCLUDED_
|
10
10
|
|
11
11
|
|
12
|
+
void ngx_debug_init(void);
|
12
13
|
ngx_chain_t *ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in,
|
13
14
|
off_t limit);
|
14
15
|
|
@@ -16,5 +17,7 @@ extern int ngx_darwin_kern_osreldate;
|
|
16
17
|
extern int ngx_darwin_hw_ncpu;
|
17
18
|
extern u_long ngx_darwin_net_inet_tcp_sendspace;
|
18
19
|
|
20
|
+
extern ngx_uint_t ngx_debug_malloc;
|
21
|
+
|
19
22
|
|
20
23
|
#endif /* _NGX_DARWIN_H_INCLUDED_ */
|
@@ -15,6 +15,8 @@ int ngx_darwin_hw_ncpu;
|
|
15
15
|
int ngx_darwin_kern_ipc_somaxconn;
|
16
16
|
u_long ngx_darwin_net_inet_tcp_sendspace;
|
17
17
|
|
18
|
+
ngx_uint_t ngx_debug_malloc;
|
19
|
+
|
18
20
|
|
19
21
|
static ngx_os_io_t ngx_darwin_io = {
|
20
22
|
ngx_unix_recv,
|
@@ -56,6 +58,34 @@ sysctl_t sysctls[] = {
|
|
56
58
|
};
|
57
59
|
|
58
60
|
|
61
|
+
void
|
62
|
+
ngx_debug_init()
|
63
|
+
{
|
64
|
+
#if (NGX_DEBUG_MALLOC)
|
65
|
+
|
66
|
+
/*
|
67
|
+
* MacOSX 10.6, 10.7: MallocScribble fills freed memory with 0x55
|
68
|
+
* and fills allocated memory with 0xAA.
|
69
|
+
* MacOSX 10.4, 10.5: MallocScribble fills freed memory with 0x55,
|
70
|
+
* MallocPreScribble fills allocated memory with 0xAA.
|
71
|
+
* MacOSX 10.3: MallocScribble fills freed memory with 0x55,
|
72
|
+
* and no way to fill allocated memory.
|
73
|
+
*/
|
74
|
+
|
75
|
+
setenv("MallocScribble", "1", 0);
|
76
|
+
|
77
|
+
ngx_debug_malloc = 1;
|
78
|
+
|
79
|
+
#else
|
80
|
+
|
81
|
+
if (getenv("MallocScribble")) {
|
82
|
+
ngx_debug_malloc = 1;
|
83
|
+
}
|
84
|
+
|
85
|
+
#endif
|
86
|
+
}
|
87
|
+
|
88
|
+
|
59
89
|
ngx_int_t
|
60
90
|
ngx_os_specific_init(ngx_log_t *log)
|
61
91
|
{
|
@@ -103,10 +103,8 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
103
103
|
prev = NULL;
|
104
104
|
iov = NULL;
|
105
105
|
|
106
|
-
for (cl = in;
|
107
|
-
|
108
|
-
cl = cl->next)
|
109
|
-
{
|
106
|
+
for (cl = in; cl && send < limit; cl = cl->next) {
|
107
|
+
|
110
108
|
if (ngx_buf_special(cl->buf)) {
|
111
109
|
continue;
|
112
110
|
}
|
@@ -125,6 +123,10 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
125
123
|
iov->iov_len += (size_t) size;
|
126
124
|
|
127
125
|
} else {
|
126
|
+
if (header.nelts >= IOV_MAX) {
|
127
|
+
break;
|
128
|
+
}
|
129
|
+
|
128
130
|
iov = ngx_array_push(&header);
|
129
131
|
if (iov == NULL) {
|
130
132
|
return NGX_CHAIN_ERROR;
|
@@ -178,7 +180,7 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
178
180
|
prev = NULL;
|
179
181
|
iov = NULL;
|
180
182
|
|
181
|
-
while (cl &&
|
183
|
+
while (cl && send < limit) {
|
182
184
|
|
183
185
|
if (ngx_buf_special(cl->buf)) {
|
184
186
|
cl = cl->next;
|
@@ -199,6 +201,10 @@ ngx_darwin_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
199
201
|
iov->iov_len += (size_t) size;
|
200
202
|
|
201
203
|
} else {
|
204
|
+
if (trailer.nelts >= IOV_MAX) {
|
205
|
+
break;
|
206
|
+
}
|
207
|
+
|
202
208
|
iov = ngx_array_push(&trailer);
|
203
209
|
if (iov == NULL) {
|
204
210
|
return NGX_CHAIN_ERROR;
|
@@ -76,6 +76,27 @@ typedef struct {
|
|
76
76
|
#define NGX_FILE_APPEND O_WRONLY|O_APPEND
|
77
77
|
#define NGX_FILE_NONBLOCK O_NONBLOCK
|
78
78
|
|
79
|
+
#if (NGX_HAVE_OPENAT)
|
80
|
+
#define NGX_FILE_NOFOLLOW O_NOFOLLOW
|
81
|
+
|
82
|
+
#if defined(O_DIRECTORY)
|
83
|
+
#define NGX_FILE_DIRECTORY O_DIRECTORY
|
84
|
+
#else
|
85
|
+
#define NGX_FILE_DIRECTORY 0
|
86
|
+
#endif
|
87
|
+
|
88
|
+
#if defined(O_SEARCH)
|
89
|
+
#define NGX_FILE_SEARCH O_SEARCH|NGX_FILE_DIRECTORY
|
90
|
+
|
91
|
+
#elif defined(O_EXEC)
|
92
|
+
#define NGX_FILE_SEARCH O_EXEC|NGX_FILE_DIRECTORY
|
93
|
+
|
94
|
+
#else
|
95
|
+
#define NGX_FILE_SEARCH O_RDONLY|NGX_FILE_DIRECTORY
|
96
|
+
#endif
|
97
|
+
|
98
|
+
#endif /* NGX_HAVE_OPENAT */
|
99
|
+
|
79
100
|
#define NGX_FILE_DEFAULT_ACCESS 0644
|
80
101
|
#define NGX_FILE_OWNER_ACCESS 0600
|
81
102
|
|
@@ -179,14 +200,25 @@ void ngx_close_file_mapping(ngx_file_mapping_t *fm);
|
|
179
200
|
#endif
|
180
201
|
|
181
202
|
|
182
|
-
#define ngx_realpath(p, r) realpath((char *) p, (char *) r)
|
203
|
+
#define ngx_realpath(p, r) (u_char *) realpath((char *) p, (char *) r)
|
183
204
|
#define ngx_realpath_n "realpath()"
|
184
205
|
#define ngx_getcwd(buf, size) (getcwd((char *) buf, size) != NULL)
|
185
206
|
#define ngx_getcwd_n "getcwd()"
|
186
207
|
#define ngx_path_separator(c) ((c) == '/')
|
187
208
|
|
209
|
+
|
210
|
+
#if defined(PATH_MAX)
|
211
|
+
|
212
|
+
#define NGX_HAVE_MAX_PATH 1
|
188
213
|
#define NGX_MAX_PATH PATH_MAX
|
189
214
|
|
215
|
+
#else
|
216
|
+
|
217
|
+
#define NGX_MAX_PATH 4096
|
218
|
+
|
219
|
+
#endif
|
220
|
+
|
221
|
+
|
190
222
|
#define NGX_DIR_MASK_LEN 0
|
191
223
|
|
192
224
|
|
@@ -325,6 +357,23 @@ ngx_int_t ngx_directio_off(ngx_fd_t fd);
|
|
325
357
|
size_t ngx_fs_bsize(u_char *name);
|
326
358
|
|
327
359
|
|
360
|
+
#if (NGX_HAVE_OPENAT)
|
361
|
+
|
362
|
+
#define ngx_openat_file(fd, name, mode, create, access) \
|
363
|
+
openat(fd, (const char *) name, mode|create, access)
|
364
|
+
|
365
|
+
#define ngx_openat_file_n "openat()"
|
366
|
+
|
367
|
+
#define ngx_file_at_info(fd, name, sb, flag) \
|
368
|
+
fstatat(fd, (const char *) name, sb, flag)
|
369
|
+
|
370
|
+
#define ngx_file_at_info_n "fstatat()"
|
371
|
+
|
372
|
+
#define NGX_AT_FDCWD (ngx_fd_t) AT_FDCWD
|
373
|
+
|
374
|
+
#endif
|
375
|
+
|
376
|
+
|
328
377
|
#define ngx_stderr STDERR_FILENO
|
329
378
|
#define ngx_set_stderr(fd) dup2(fd, STDERR_FILENO)
|
330
379
|
#define ngx_set_stderr_n "dup2(STDERR_FILENO)"
|
@@ -9,6 +9,7 @@
|
|
9
9
|
#define _NGX_FREEBSD_H_INCLUDED_
|
10
10
|
|
11
11
|
|
12
|
+
void ngx_debug_init(void);
|
12
13
|
ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in,
|
13
14
|
off_t limit);
|
14
15
|
|
@@ -18,7 +19,7 @@ extern u_long ngx_freebsd_net_inet_tcp_sendspace;
|
|
18
19
|
|
19
20
|
extern ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
20
21
|
extern ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
21
|
-
extern ngx_uint_t
|
22
|
+
extern ngx_uint_t ngx_debug_malloc;
|
22
23
|
|
23
24
|
|
24
25
|
#endif /* _NGX_FREEBSD_H_INCLUDED_ */
|
@@ -23,6 +23,7 @@
|
|
23
23
|
#include <grp.h>
|
24
24
|
#include <dirent.h>
|
25
25
|
#include <glob.h>
|
26
|
+
#include <time.h>
|
26
27
|
#include <sys/param.h> /* ALIGN() */
|
27
28
|
#include <sys/mount.h> /* statfs() */
|
28
29
|
|
@@ -110,6 +111,7 @@ pid_t rfork_thread(int flags, void *stack, int (*func)(void *arg), void *arg);
|
|
110
111
|
|
111
112
|
|
112
113
|
#define NGX_HAVE_OS_SPECIFIC_INIT 1
|
114
|
+
#define NGX_HAVE_DEBUG_MALLOC 1
|
113
115
|
|
114
116
|
|
115
117
|
extern char **environ;
|
@@ -23,7 +23,8 @@ int ngx_freebsd_machdep_hlt_logical_cpus;
|
|
23
23
|
|
24
24
|
ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
25
25
|
ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
26
|
-
|
26
|
+
|
27
|
+
ngx_uint_t ngx_debug_malloc;
|
27
28
|
|
28
29
|
|
29
30
|
static ngx_os_io_t ngx_freebsd_io = {
|
@@ -81,7 +82,7 @@ ngx_debug_init()
|
|
81
82
|
malloc_options = "J";
|
82
83
|
#endif
|
83
84
|
|
84
|
-
|
85
|
+
ngx_debug_malloc = 1;
|
85
86
|
|
86
87
|
#else
|
87
88
|
char *mo;
|
@@ -89,7 +90,7 @@ ngx_debug_init()
|
|
89
90
|
mo = getenv("MALLOC_OPTIONS");
|
90
91
|
|
91
92
|
if (mo && ngx_strchr(mo, 'J')) {
|
92
|
-
|
93
|
+
ngx_debug_malloc = 1;
|
93
94
|
}
|
94
95
|
#endif
|
95
96
|
}
|
@@ -11,14 +11,14 @@
|
|
11
11
|
/*
|
12
12
|
* The threads implementation uses the rfork(RFPROC|RFTHREAD|RFMEM) syscall
|
13
13
|
* to create threads. All threads use the stacks of the same size mmap()ed
|
14
|
-
* below the main stack. Thus the current thread id is
|
14
|
+
* below the main stack. Thus the current thread id is determined via
|
15
15
|
* the stack pointer value.
|
16
16
|
*
|
17
17
|
* The mutex implementation uses the ngx_atomic_cmp_set() operation
|
18
18
|
* to acquire a mutex and the SysV semaphore to wait on a mutex and to wake up
|
19
19
|
* the waiting threads. The light mutex does not use semaphore, so after
|
20
20
|
* spinning in the lock the thread calls sched_yield(). However the light
|
21
|
-
*
|
21
|
+
* mutexes are intended to be used with the "trylock" operation only.
|
22
22
|
* The SysV semop() is a cheap syscall, particularly if it has little sembuf's
|
23
23
|
* and does not use SEM_UNDO.
|
24
24
|
*
|
@@ -18,7 +18,7 @@
|
|
18
18
|
* as the 11 full 1460-bytes packets, then one incomplete 324-bytes packet,
|
19
19
|
* and then again the 11 full 1460-bytes packets.
|
20
20
|
*
|
21
|
-
*
|
21
|
+
* Therefore we use the TCP_NOPUSH option (similar to Linux's TCP_CORK)
|
22
22
|
* to postpone the sending - it not only sends a header and the first part of
|
23
23
|
* the file in one packet, but also sends the file pages in the full packets.
|
24
24
|
*
|
@@ -107,10 +107,8 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
107
107
|
prev = NULL;
|
108
108
|
iov = NULL;
|
109
109
|
|
110
|
-
for (cl = in;
|
111
|
-
|
112
|
-
cl = cl->next)
|
113
|
-
{
|
110
|
+
for (cl = in; cl && send < limit; cl = cl->next) {
|
111
|
+
|
114
112
|
if (ngx_buf_special(cl->buf)) {
|
115
113
|
continue;
|
116
114
|
}
|
@@ -129,6 +127,10 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
129
127
|
iov->iov_len += (size_t) size;
|
130
128
|
|
131
129
|
} else {
|
130
|
+
if (header.nelts >= IOV_MAX){
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
|
132
134
|
iov = ngx_array_push(&header);
|
133
135
|
if (iov == NULL) {
|
134
136
|
return NGX_CHAIN_ERROR;
|
@@ -183,7 +185,7 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
183
185
|
prev = NULL;
|
184
186
|
iov = NULL;
|
185
187
|
|
186
|
-
while (cl &&
|
188
|
+
while (cl && send < limit) {
|
187
189
|
|
188
190
|
if (ngx_buf_special(cl->buf)) {
|
189
191
|
cl = cl->next;
|
@@ -204,6 +206,10 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
204
206
|
iov->iov_len += (size_t) size;
|
205
207
|
|
206
208
|
} else {
|
209
|
+
if (trailer.nelts >= IOV_MAX){
|
210
|
+
break;
|
211
|
+
}
|
212
|
+
|
207
213
|
iov = ngx_array_push(&trailer);
|
208
214
|
if (iov == NULL) {
|
209
215
|
return NGX_CHAIN_ERROR;
|
@@ -89,10 +89,8 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
89
89
|
|
90
90
|
/* create the iovec and coalesce the neighbouring bufs */
|
91
91
|
|
92
|
-
for (cl = in;
|
93
|
-
|
94
|
-
cl = cl->next)
|
95
|
-
{
|
92
|
+
for (cl = in; cl && send < limit; cl = cl->next) {
|
93
|
+
|
96
94
|
if (ngx_buf_special(cl->buf)) {
|
97
95
|
continue;
|
98
96
|
}
|
@@ -132,6 +130,10 @@ ngx_linux_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit)
|
|
132
130
|
iov->iov_len += (size_t) size;
|
133
131
|
|
134
132
|
} else {
|
133
|
+
if (header.nelts >= IOV_MAX) {
|
134
|
+
break;
|
135
|
+
}
|
136
|
+
|
135
137
|
iov = ngx_array_push(&header);
|
136
138
|
if (iov == NULL) {
|
137
139
|
return NGX_CHAIN_ERROR;
|
@@ -45,6 +45,7 @@
|
|
45
45
|
#include <grp.h>
|
46
46
|
#include <dirent.h>
|
47
47
|
#include <glob.h>
|
48
|
+
#include <time.h>
|
48
49
|
#if (NGX_HAVE_SYS_PARAM_H)
|
49
50
|
#include <sys/param.h> /* statfs() */
|
50
51
|
#endif
|
@@ -126,6 +127,8 @@ typedef struct aiocb ngx_aiocb_t;
|
|
126
127
|
|
127
128
|
#define NGX_LISTEN_BACKLOG 511
|
128
129
|
|
130
|
+
#define ngx_debug_init()
|
131
|
+
|
129
132
|
|
130
133
|
#if (__FreeBSD__) && (__FreeBSD_version < 400017)
|
131
134
|
|
@@ -23,6 +23,7 @@ typedef struct {
|
|
23
23
|
static void ngx_execute_proc(ngx_cycle_t *cycle, void *data);
|
24
24
|
static void ngx_signal_handler(int signo);
|
25
25
|
static void ngx_process_get_status(void);
|
26
|
+
static void ngx_unlock_mutexes(ngx_pid_t pid);
|
26
27
|
|
27
28
|
|
28
29
|
int ngx_argc;
|
@@ -498,17 +499,6 @@ ngx_process_get_status(void)
|
|
498
499
|
}
|
499
500
|
|
500
501
|
|
501
|
-
if (ngx_accept_mutex_ptr) {
|
502
|
-
|
503
|
-
/*
|
504
|
-
* unlock the accept mutex if the abnormally exited process
|
505
|
-
* held it
|
506
|
-
*/
|
507
|
-
|
508
|
-
ngx_atomic_cmp_set(ngx_accept_mutex_ptr, pid, 0);
|
509
|
-
}
|
510
|
-
|
511
|
-
|
512
502
|
one = 1;
|
513
503
|
process = "unknown process";
|
514
504
|
|
@@ -546,6 +536,55 @@ ngx_process_get_status(void)
|
|
546
536
|
process, pid, WEXITSTATUS(status));
|
547
537
|
ngx_processes[i].respawn = 0;
|
548
538
|
}
|
539
|
+
|
540
|
+
ngx_unlock_mutexes(pid);
|
541
|
+
}
|
542
|
+
}
|
543
|
+
|
544
|
+
|
545
|
+
static void
|
546
|
+
ngx_unlock_mutexes(ngx_pid_t pid)
|
547
|
+
{
|
548
|
+
ngx_uint_t i;
|
549
|
+
ngx_shm_zone_t *shm_zone;
|
550
|
+
ngx_list_part_t *part;
|
551
|
+
ngx_slab_pool_t *sp;
|
552
|
+
|
553
|
+
/*
|
554
|
+
* unlock the accept mutex if the abnormally exited process
|
555
|
+
* held it
|
556
|
+
*/
|
557
|
+
|
558
|
+
if (ngx_accept_mutex_ptr) {
|
559
|
+
(void) ngx_shmtx_force_unlock(&ngx_accept_mutex, pid);
|
560
|
+
}
|
561
|
+
|
562
|
+
/*
|
563
|
+
* unlock shared memory mutexes if held by the abnormally exited
|
564
|
+
* process
|
565
|
+
*/
|
566
|
+
|
567
|
+
part = (ngx_list_part_t *) &ngx_cycle->shared_memory.part;
|
568
|
+
shm_zone = part->elts;
|
569
|
+
|
570
|
+
for (i = 0; /* void */ ; i++) {
|
571
|
+
|
572
|
+
if (i >= part->nelts) {
|
573
|
+
if (part->next == NULL) {
|
574
|
+
break;
|
575
|
+
}
|
576
|
+
part = part->next;
|
577
|
+
shm_zone = part->elts;
|
578
|
+
i = 0;
|
579
|
+
}
|
580
|
+
|
581
|
+
sp = (ngx_slab_pool_t *) shm_zone[i].shm.addr;
|
582
|
+
|
583
|
+
if (ngx_shmtx_force_unlock(&sp->mutex, pid)) {
|
584
|
+
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
|
585
|
+
"shared memory zone \"%V\" was locked by %P",
|
586
|
+
&shm_zone[i].shm.name, pid);
|
587
|
+
}
|
549
588
|
}
|
550
589
|
}
|
551
590
|
|