annotate src/http/ngx_http_copy_filter_module.c @ 4195:35f4997c08ce

Fix for socket leak with "aio sendfile" and "limit_rate". Second aio post happened when timer set by limit_rate expired while we have aio request in flight, resulting in "second aio post" alert and socket leak. The patch adds actual protection from aio calls with r->aio already set to aio sendfile code in ngx_http_copy_filter(). This should fix other cases as well, e.g. when sending buffered to disk upstream replies while still talking to upstream. The ngx_http_writer() is also fixed to handle the above case (though it's mostly optimization now). Reported by Oleksandr V. Typlyns'kyi.
author Maxim Dounin <mdounin@mdounin.ru>
date Tue, 11 Oct 2011 18:00:23 +0000
parents d29e8060ca0c
children d620f497c50f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 386
diff changeset
1
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 386
diff changeset
2 /*
444
42d11f017717 nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents: 441
diff changeset
3 * Copyright (C) Igor Sysoev
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 386
diff changeset
4 */
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 386
diff changeset
5
3
34a521b1a148 nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6
33
b2e039840718 nginx-0.0.1-2002-12-19-20:49:51 import
Igor Sysoev <igor@sysoev.ru>
parents: 32
diff changeset
7 #include <ngx_config.h>
99
a059e1aa65d4 nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents: 98
diff changeset
8 #include <ngx_core.h>
a059e1aa65d4 nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents: 98
diff changeset
9 #include <ngx_http.h>
43
53cd05892261 nginx-0.0.1-2002-12-27-19:22:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 42
diff changeset
10
99
a059e1aa65d4 nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents: 98
diff changeset
11
a059e1aa65d4 nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents: 98
diff changeset
12 typedef struct {
141
656d468f4ead nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 135
diff changeset
13 ngx_bufs_t bufs;
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
14 } ngx_http_copy_filter_conf_t;
99
a059e1aa65d4 nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents: 98
diff changeset
15
43
53cd05892261 nginx-0.0.1-2002-12-27-19:22:50 import
Igor Sysoev <igor@sysoev.ru>
parents: 42
diff changeset
16
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
17 #if (NGX_HAVE_FILE_AIO)
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
18 static void ngx_http_copy_aio_handler(ngx_output_chain_ctx_t *ctx,
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
19 ngx_file_t *file);
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
20 static void ngx_http_copy_aio_event_handler(ngx_event_t *ev);
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
21 #if (NGX_HAVE_AIO_SENDFILE)
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
22 static void ngx_http_copy_aio_sendfile_event_handler(ngx_event_t *ev);
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
23 #endif
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
24 #endif
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
25
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
26 static void *ngx_http_copy_filter_create_conf(ngx_conf_t *cf);
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
27 static char *ngx_http_copy_filter_merge_conf(ngx_conf_t *cf,
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
28 void *parent, void *child);
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 667
diff changeset
29 static ngx_int_t ngx_http_copy_filter_init(ngx_conf_t *cf);
10
4f3879d9b6f6 nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 9
diff changeset
30
4f3879d9b6f6 nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 9
diff changeset
31
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
32 static ngx_command_t ngx_http_copy_filter_commands[] = {
10
4f3879d9b6f6 nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 9
diff changeset
33
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
34 { ngx_string("output_buffers"),
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
35 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
36 ngx_conf_set_bufs_slot,
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
37 NGX_HTTP_LOC_CONF_OFFSET,
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
38 offsetof(ngx_http_copy_filter_conf_t, bufs),
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
39 NULL },
10
4f3879d9b6f6 nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 9
diff changeset
40
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
41 ngx_null_command
9
6f58641241bb nginx-0.0.1-2002-09-07-14:14:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 8
diff changeset
42 };
3
34a521b1a148 nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
43
8
708f8bb772ec nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents: 7
diff changeset
44
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
45 static ngx_http_module_t ngx_http_copy_filter_module_ctx = {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
46 NULL, /* preconfiguration */
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 667
diff changeset
47 ngx_http_copy_filter_init, /* postconfiguration */
177
4db54fdbcbe7 nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents: 160
diff changeset
48
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
49 NULL, /* create main configuration */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
50 NULL, /* init main configuration */
69
e43f406e4525 nginx-0.0.1-2003-03-20-19:09:44 import
Igor Sysoev <igor@sysoev.ru>
parents: 67
diff changeset
51
91
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
52 NULL, /* create server configuration */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
53 NULL, /* merge server configuration */
637625a2acdb nginx-0.0.1-2003-05-19-20:39:14 import
Igor Sysoev <igor@sysoev.ru>
parents: 90
diff changeset
54
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
55 ngx_http_copy_filter_create_conf, /* create location configuration */
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
56 ngx_http_copy_filter_merge_conf /* merge location configuration */
26
53cb81681040 nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 24
diff changeset
57 };
53cb81681040 nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 24
diff changeset
58
53cb81681040 nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents: 24
diff changeset
59
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
60 ngx_module_t ngx_http_copy_filter_module = {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
61 NGX_MODULE_V1,
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
62 &ngx_http_copy_filter_module_ctx, /* module context */
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
63 ngx_http_copy_filter_commands, /* module directives */
96
a23d010f356d nginx-0.0.1-2003-05-27-16:18:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 95
diff changeset
64 NGX_HTTP_MODULE, /* module type */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 527
diff changeset
65 NULL, /* init master */
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 667
diff changeset
66 NULL, /* init module */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 527
diff changeset
67 NULL, /* init process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 527
diff changeset
68 NULL, /* init thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 527
diff changeset
69 NULL, /* exit thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 527
diff changeset
70 NULL, /* exit process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 527
diff changeset
71 NULL, /* exit master */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 527
diff changeset
72 NGX_MODULE_V1_PADDING
40
d5d4f3bba6f0 nginx-0.0.1-2002-12-26-10:24:21 import
Igor Sysoev <igor@sysoev.ru>
parents: 33
diff changeset
73 };
8
708f8bb772ec nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents: 7
diff changeset
74
3
34a521b1a148 nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
75
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
76 static ngx_http_output_body_filter_pt ngx_http_next_filter;
141
656d468f4ead nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 135
diff changeset
77
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
78
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
79 static ngx_int_t
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
80 ngx_http_copy_filter(ngx_http_request_t *r, ngx_chain_t *in)
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
81 {
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 569
diff changeset
82 ngx_int_t rc;
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 569
diff changeset
83 ngx_connection_t *c;
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
84 ngx_output_chain_ctx_t *ctx;
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
85 ngx_http_core_loc_conf_t *clcf;
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
86 ngx_http_copy_filter_conf_t *conf;
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
87
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 569
diff changeset
88 c = r->connection;
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 569
diff changeset
89
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 569
diff changeset
90 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
3062
aa720192937b use local variable and fix debug log message
Igor Sysoev <igor@sysoev.ru>
parents: 3053
diff changeset
91 "http copy filter: \"%V?%V\"", &r->uri, &r->args);
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
92
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
93 ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module);
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
94
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
95 if (ctx == NULL) {
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
96 ctx = ngx_pcalloc(r->pool, sizeof(ngx_output_chain_ctx_t));
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
97 if (ctx == NULL) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
98 return NGX_ERROR;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
99 }
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
100
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
101 ngx_http_set_ctx(r, ctx, ngx_http_copy_filter_module);
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
102
3053
0d253659da12 directio_alignment
Igor Sysoev <igor@sysoev.ru>
parents: 3052
diff changeset
103 conf = ngx_http_get_module_loc_conf(r, ngx_http_copy_filter_module);
0d253659da12 directio_alignment
Igor Sysoev <igor@sysoev.ru>
parents: 3052
diff changeset
104 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
0d253659da12 directio_alignment
Igor Sysoev <igor@sysoev.ru>
parents: 3052
diff changeset
105
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 569
diff changeset
106 ctx->sendfile = c->sendfile;
513
fbbf16224844 nginx-0.1.31-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
107 ctx->need_in_memory = r->main_filter_need_in_memory
fbbf16224844 nginx-0.1.31-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
108 || r->filter_need_in_memory;
346
55e496a8ece3 nginx-0.0.3-2004-06-06-23:49:18 import
Igor Sysoev <igor@sysoev.ru>
parents: 343
diff changeset
109 ctx->need_in_temp = r->filter_need_temporary;
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
110
3053
0d253659da12 directio_alignment
Igor Sysoev <igor@sysoev.ru>
parents: 3052
diff changeset
111 ctx->alignment = clcf->directio_alignment;
0d253659da12 directio_alignment
Igor Sysoev <igor@sysoev.ru>
parents: 3052
diff changeset
112
160
e7e094d34162 nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 155
diff changeset
113 ctx->pool = r->pool;
e7e094d34162 nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 155
diff changeset
114 ctx->bufs = conf->bufs;
343
6bdf858bff8c nginx-0.0.3-2004-05-28-19:49:23 import; rename ngx_hunk_t to ngx_buf_t
Igor Sysoev <igor@sysoev.ru>
parents: 334
diff changeset
115 ctx->tag = (ngx_buf_tag_t) &ngx_http_copy_filter_module;
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
116
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
117 ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter;
294
5cfd65b8b0a7 nginx-0.0.3-2004-03-23-09:01:52 import
Igor Sysoev <igor@sysoev.ru>
parents: 177
diff changeset
118 ctx->filter_ctx = r;
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
119
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
120 #if (NGX_HAVE_FILE_AIO)
3778
d29e8060ca0c always update an aio_senfile connection flag accodring to a current
Igor Sysoev <igor@sysoev.ru>
parents: 3776
diff changeset
121 if (ngx_file_aio) {
d29e8060ca0c always update an aio_senfile connection flag accodring to a current
Igor Sysoev <igor@sysoev.ru>
parents: 3776
diff changeset
122 if (clcf->aio) {
d29e8060ca0c always update an aio_senfile connection flag accodring to a current
Igor Sysoev <igor@sysoev.ru>
parents: 3776
diff changeset
123 ctx->aio_handler = ngx_http_copy_aio_handler;
d29e8060ca0c always update an aio_senfile connection flag accodring to a current
Igor Sysoev <igor@sysoev.ru>
parents: 3776
diff changeset
124 }
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
125 #if (NGX_HAVE_AIO_SENDFILE)
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
126 c->aio_sendfile = (clcf->aio == NGX_HTTP_AIO_SENDFILE);
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
127 #endif
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
128 }
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
129 #endif
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
130
3518
eb3aaf8bd2a9 fix SSI include stub for valid empty responses
Igor Sysoev <igor@sysoev.ru>
parents: 3294
diff changeset
131 if (in && in->buf && ngx_buf_size(in->buf)) {
eb3aaf8bd2a9 fix SSI include stub for valid empty responses
Igor Sysoev <igor@sysoev.ru>
parents: 3294
diff changeset
132 r->request_output = 1;
eb3aaf8bd2a9 fix SSI include stub for valid empty responses
Igor Sysoev <igor@sysoev.ru>
parents: 3294
diff changeset
133 }
60
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
134 }
50186b49f2ad nginx-0.0.1-2003-02-11-10:14:40 import
Igor Sysoev <igor@sysoev.ru>
parents: 59
diff changeset
135
3119
4c90c9129a82 fix case when the output filter should add incoming buffers
Igor Sysoev <igor@sysoev.ru>
parents: 3110
diff changeset
136 #if (NGX_HAVE_FILE_AIO)
4c90c9129a82 fix case when the output filter should add incoming buffers
Igor Sysoev <igor@sysoev.ru>
parents: 3110
diff changeset
137 ctx->aio = r->aio;
4c90c9129a82 fix case when the output filter should add incoming buffers
Igor Sysoev <igor@sysoev.ru>
parents: 3110
diff changeset
138 #endif
4c90c9129a82 fix case when the output filter should add incoming buffers
Igor Sysoev <igor@sysoev.ru>
parents: 3110
diff changeset
139
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
140 for ( ;; ) {
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
141 rc = ngx_output_chain(ctx, in);
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
142
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
143 if (ctx->in == NULL) {
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
144 r->buffered &= ~NGX_HTTP_COPY_BUFFERED;
829
362d156f0278 high level HTTP buffered flags should be on per-subrequest basis,
Igor Sysoev <igor@sysoev.ru>
parents: 681
diff changeset
145
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
146 } else {
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
147 r->buffered |= NGX_HTTP_COPY_BUFFERED;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
148 }
829
362d156f0278 high level HTTP buffered flags should be on per-subrequest basis,
Igor Sysoev <igor@sysoev.ru>
parents: 681
diff changeset
149
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
150 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0,
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
151 "http copy filter: %i \"%V?%V\"", rc, &r->uri, &r->args);
583
4e296b7d25bf nginx-0.3.13-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 569
diff changeset
152
3070
6fb94acd3a09 fix building on FreeBSD without --with-file-aio
Igor Sysoev <igor@sysoev.ru>
parents: 3065
diff changeset
153 #if (NGX_HAVE_FILE_AIO && NGX_HAVE_AIO_SENDFILE)
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
154
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
155 if (c->busy_sendfile) {
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
156 ssize_t n;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
157 off_t offset;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
158 ngx_file_t *file;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
159 ngx_http_ephemeral_t *e;
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
160
4195
35f4997c08ce Fix for socket leak with "aio sendfile" and "limit_rate".
Maxim Dounin <mdounin@mdounin.ru>
parents: 3778
diff changeset
161 if (r->aio) {
35f4997c08ce Fix for socket leak with "aio sendfile" and "limit_rate".
Maxim Dounin <mdounin@mdounin.ru>
parents: 3778
diff changeset
162 c->busy_sendfile = NULL;
35f4997c08ce Fix for socket leak with "aio sendfile" and "limit_rate".
Maxim Dounin <mdounin@mdounin.ru>
parents: 3778
diff changeset
163 return rc;
35f4997c08ce Fix for socket leak with "aio sendfile" and "limit_rate".
Maxim Dounin <mdounin@mdounin.ru>
parents: 3778
diff changeset
164 }
35f4997c08ce Fix for socket leak with "aio sendfile" and "limit_rate".
Maxim Dounin <mdounin@mdounin.ru>
parents: 3778
diff changeset
165
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
166 file = c->busy_sendfile->file;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
167 offset = c->busy_sendfile->file_pos;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
168
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
169 if (file->aio) {
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
170 c->aio_sendfile = (offset != file->aio->last_offset);
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
171 file->aio->last_offset = offset;
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
172
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
173 if (c->aio_sendfile == 0) {
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
174 ngx_log_error(NGX_LOG_ALERT, c->log, 0,
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
175 "sendfile(%V) returned busy again",
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
176 &file->name);
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
177 }
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
178 }
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
179
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
180 c->busy_sendfile = NULL;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
181 e = (ngx_http_ephemeral_t *) &r->uri_start;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
182
3085
2f400438466f fix the previous commit
Igor Sysoev <igor@sysoev.ru>
parents: 3084
diff changeset
183 n = ngx_file_aio_read(file, &e->aio_preload, 1, offset, r->pool);
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
184
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
185 if (n > 0) {
3110
c09bf4a53b79 do not pass incoming buf chain twice if data are ready,
Igor Sysoev <igor@sysoev.ru>
parents: 3085
diff changeset
186 in = NULL;
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
187 continue;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
188 }
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
189
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
190 rc = n;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
191
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
192 if (file->aio) {
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
193 file->aio->data = r;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
194 file->aio->handler = ngx_http_copy_aio_sendfile_event_handler;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
195
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
196 r->main->blocked++;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
197 r->aio = 1;
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
198 }
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
199 }
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
200 #endif
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
201
3071
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
202 return rc;
ffc270f696ed retry aio sendfile if data are ready
Igor Sysoev <igor@sysoev.ru>
parents: 3070
diff changeset
203 }
4
c5f071d376e5 nginx-0.0.1-2002-08-22-19:24:03 import
Igor Sysoev <igor@sysoev.ru>
parents: 3
diff changeset
204 }
9
6f58641241bb nginx-0.0.1-2002-09-07-14:14:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 8
diff changeset
205
6f58641241bb nginx-0.0.1-2002-09-07-14:14:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 8
diff changeset
206
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
207 #if (NGX_HAVE_FILE_AIO)
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
208
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
209 static void
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
210 ngx_http_copy_aio_handler(ngx_output_chain_ctx_t *ctx, ngx_file_t *file)
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
211 {
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
212 ngx_http_request_t *r;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
213
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
214 r = ctx->filter_ctx;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
215
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
216 file->aio->data = r;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
217 file->aio->handler = ngx_http_copy_aio_event_handler;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
218
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
219 r->main->blocked++;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
220 r->aio = 1;
3776
7450029ff51e file AIO read may be posted inside loop
Igor Sysoev <igor@sysoev.ru>
parents: 3518
diff changeset
221 ctx->aio = 1;
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
222 }
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
223
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
224
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
225 static void
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
226 ngx_http_copy_aio_event_handler(ngx_event_t *ev)
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
227 {
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
228 ngx_event_aio_t *aio;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
229 ngx_http_request_t *r;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
230
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
231 aio = ev->data;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
232 r = aio->data;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
233
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
234 r->main->blocked--;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
235 r->aio = 0;
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
236
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
237 r->connection->write->handler(r->connection->write);
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
238 }
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
239
3065
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
240
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
241 #if (NGX_HAVE_AIO_SENDFILE)
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
242
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
243 static void
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
244 ngx_http_copy_aio_sendfile_event_handler(ngx_event_t *ev)
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
245 {
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
246 ngx_event_aio_t *aio;
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
247 ngx_http_request_t *r;
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
248
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
249 aio = ev->data;
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
250 r = aio->data;
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
251
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
252 r->main->blocked--;
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
253 r->aio = 0;
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
254 ev->complete = 0;
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
255
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
256 r->connection->write->handler(r->connection->write);
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
257 }
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
258
113cd532b328 aio sendfile
Igor Sysoev <igor@sysoev.ru>
parents: 3062
diff changeset
259 #endif
3052
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
260 #endif
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
261
6060225e9261 FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents: 3050
diff changeset
262
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
263 static void *
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
264 ngx_http_copy_filter_create_conf(ngx_conf_t *cf)
9
6f58641241bb nginx-0.0.1-2002-09-07-14:14:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 8
diff changeset
265 {
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
266 ngx_http_copy_filter_conf_t *conf;
9
6f58641241bb nginx-0.0.1-2002-09-07-14:14:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 8
diff changeset
267
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
268 conf = ngx_palloc(cf->pool, sizeof(ngx_http_copy_filter_conf_t));
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
269 if (conf == NULL) {
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
270 return NULL;
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
271 }
9
6f58641241bb nginx-0.0.1-2002-09-07-14:14:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 8
diff changeset
272
141
656d468f4ead nginx-0.0.1-2003-10-08-19:32:54 import
Igor Sysoev <igor@sysoev.ru>
parents: 135
diff changeset
273 conf->bufs.num = 0;
10
4f3879d9b6f6 nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 9
diff changeset
274
4f3879d9b6f6 nginx-0.0.1-2002-09-11-19:18:33 import
Igor Sysoev <igor@sysoev.ru>
parents: 9
diff changeset
275 return conf;
9
6f58641241bb nginx-0.0.1-2002-09-07-14:14:25 import
Igor Sysoev <igor@sysoev.ru>
parents: 8
diff changeset
276 }
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 43
diff changeset
277
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 43
diff changeset
278
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
279 static char *
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
280 ngx_http_copy_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 43
diff changeset
281 {
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
282 ngx_http_copy_filter_conf_t *prev = parent;
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
283 ngx_http_copy_filter_conf_t *conf = child;
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 43
diff changeset
284
160
e7e094d34162 nginx-0.0.1-2003-10-27-11:53:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 155
diff changeset
285 ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 1, 32768);
44
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 43
diff changeset
286
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 43
diff changeset
287 return NULL;
0e81ac0bb3e2 nginx-0.0.1-2003-01-09-08:36:00 import
Igor Sysoev <igor@sysoev.ru>
parents: 43
diff changeset
288 }
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
289
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
290
501
d4ea69372b94 nginx-0.1.25-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 452
diff changeset
291 static ngx_int_t
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 667
diff changeset
292 ngx_http_copy_filter_init(ngx_conf_t *cf)
334
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
293 {
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
294 ngx_http_next_filter = ngx_http_top_body_filter;
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
295 ngx_http_top_body_filter = ngx_http_copy_filter;
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
296
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
297 return NGX_OK;
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
298 }
af451db3fe99 nginx-0.0.3-2004-05-12-09:37:55 import
Igor Sysoev <igor@sysoev.ru>
parents: 327
diff changeset
299